Hi,

I am having trouble moving a file to a back up location after it's consumed
and it's contents sent to a queue.

I am new to Camle world and exploring it. Below is the code am using.

*Spring config:*

<bean id="routeProperties"
class="com.verizon.learn.camel.utils.RoutingProperties">
                <constructor-arg
index="0"><value>file:C:\\camelProject\\data\\inbox?move=C:\\camelProject\\data\\inbox\\bkp</value></constructor-arg>
                <constructor-arg
index="1"><value>file:C:\\camelProject\\data\\outbox\\bkp</value></constructor-arg>
                <constructor-arg
index="2"><value>jms:queue:test_queue</value></constructor-arg>
        </bean>


Code snippet:

                        System.out.println("Starting Polloer: 
"+consumerEndpoint);
                        PollingConsumer consumer = 
consumerEndpoint.createPollingConsumer();
                        Producer producer = targetEndpoint.createProducer();
                        consumer.start();
                        while(true){
                                Exchange consumerX = consumer.receive(timeout);
                                while(consumerX != null){
                                        System.out.println("Received message: " 
+ consumerX.getIn().getBody());
                                        Exchange newExchange = 
producer.createExchange(consumerX);
                                        
newExchange.getIn().setBody(consumerX.getIn().getBody());
                                        
newExchange.getIn().setHeaders(consumerX.getIn().getHeaders());
                                        producer.process(newExchange);
                                        
                                        consumerX = consumer.receive(timeout);
                                }
                                Thread.sleep(1000);
                        }
                }catch(Exception ex){
                        ex.printStackTrace();
                }

--
View this message in context: 
http://camel.465427.n5.nabble.com/Move-does-not-work-with-file-polling-tp4876472p4876472.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to