*
* @throws Exception
*/
public void xtestOneWayInJmsOutPojo() throws Exception {
final CountDownLatch receivedCountDown = new CountDownLatch(1);
// Configure the components
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
container.addComponent("activemq", jmsComponentClientAcknowledge(connectionFactory));
PojoComponent component = new PojoComponent();
component.addService("listener", new MessageListener(){
public void onMessage(Message msg) {
System.out.println("Received: "+msg);
receivedCountDown.countDown();
}
});
container.addComponent("default", component);
// lets add a jms -> pojo route
container.addRoutes(new RouteBuilder() {
public void configure() {
from("jms:test").to("pojo:listener");
}
});
container.start();
// Send a message to the JMS endpoint
JmsEndpoint endpoint = (JmsEndpoint) container.getEndpoint("jms:test");
Producer<JmsExchange> producer = endpoint.createProducer();
JmsExchange exchange = producer.createExchange();
JmsMessage in = exchange.getIn();
in.setBody("Hello");
in.setHeader("cheese", 123);
producer.process(exchange);
// The Activated endpoint should send it to the pojo due to the configured route.
assertTrue("The message ware received by the Pojo", receivedCountDown.await(5, TimeUnit.SECONDS));
}