use of org.apache.camel.component.jms.JmsMessage in project camel by apache.
the class JmsToFileMessageIdTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
// Make a route from an activemq queue to a file endpoint, then try to call getMessageId()
from("activemq:foo").process(new Processor() {
public void process(Exchange exchange) throws Exception {
// assert camel id is based on jms id
String camelId = exchange.getIn().getMessageId();
assertNotNull(camelId);
JmsMessage jms = (JmsMessage) exchange.getIn();
String jmsId = jms.getJmsMessage().getJMSMessageID();
assertNotNull(jmsId);
assertEquals(jmsId, camelId);
}
}).to("file://target/tofile").process(new Processor() {
public void process(Exchange exchange) {
// in Camel 1.4 or older this caused a NPE
assertNotNull(exchange.getIn().getMessageId());
}
}).to("mock:result");
}
};
}
Aggregations