简体   繁体   中英

How to receive a file from ActiveMQ using Camel?

I have sent a file "file.txt" to a Queue "A" as blob message. I want to receive that "file.txt" to my local folder "D:/output".

I tried the following code . bUt no use..

     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");
            }
        });

Please help me..

Thanks Arun

You want to use the Apache Camel File2 Component

The endpoint format is file:directory?options

So in your case:

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

Have a read through the various options on the component and see if they are relevant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM