camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebinsingh <ebenezer.si...@VerizonWireless.com>
Subject Move does not work with file polling
Date Thu, 06 Oct 2011 14:13:09 GMT
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.

Mime
View raw message