2015-02-23 54 views
0

我已將一個文件「file.txt」作爲blob消息發送到Queue「A」。我想將「file.txt」接收到本地文件夾「D:/ output」。如何使用Camel從ActiveMQ接收文件?

我試過下面的代碼。但是沒有用..

 CamelContext context = new DefaultCamelContext(); 
    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); 

    context.addComponent("test-jms", 
       JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); 
     context.addRoutes(new RouteBuilder() { 
      public void configure() { 
       from("test-jms:queue:A").to("C:/output"); 
      } 
     }); 

請幫助我..

感謝阿倫

回答

2

你想使用Apache的駱駝File2 Component

終結點​​格式file:directory?options

所以在您的情況:

from("test-jms:queue:A").to("file:C:/output"); 

通讀組件上的各種選項並查看它們是否相關。

+0

Thanku vikingsteve – mikhail 2015-03-02 12:28:08