Creating messages - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

To create a new message in the account of the current user, you can use the following URI:

yammer:messages?[options]

The current Camel message body is what will be used to set the text of the Yammer message. The response body will include the new message formatted the same way as when you consume messages (i.e. as a Messages object by default).

Take this route for instance:

from("direct:start").to("yammer:messages?consumerKey=aConsumerKey&consumerSecret
=aConsumerSecretKey&accessToken=aAccessToken").to("mock:result");

By sending to the direct:start endpoint a "Hi from Camel!" message body:

template.sendBody("direct:start", "Hi from Camel!");

a new message will be created in the current user's account on the server and also this new message will be returned to Camel and converted into a Messages object. Like when consuming messages you can interrogate the Messages object:

Exchange exchange = mock.getExchanges().get(0);
Messages messages = exchange.getIn().getBody(Messages.class);
 
assertEquals(1, messages.getMessages().size());
assertEquals("Hi from Camel!", messages.getMessages().get(0).getBody().getPlain());