In order to listen to notification from the active MQ I add the following route declaration to me app
1: public static RouteBuilder CreateRouteFromActiveMQ ()2: {3: return new RouteBuilder() {4: public void configure() throws Exception {5: from("test-jms:queue:test.queue")6: .unmarshal().jaxb("org.apache.camel.example.console").7: setHeader(Exchange.FILE_NAME, constant("Received.Csv"))8: .to("file:target/TestmyFiles").9: to("stream:out");10: }11: };12:13: }
Register the routes
1: CamelContext context = new DefaultCamelContext();2:3: ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");4: // Note we can explicit name the component5: context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));6:7: context.addRoutes(createRoute());8:9: context.addRoutes(CreateRouteFromActiveMQ());10:11: context.start();
אין תגובות:
הוסף רשומת תגובה