Why not use transactions then? Just mark the route transacted, this should work.
Bye Norman 2010/5/4, olamalam <[email protected]>: > > Hi to all, > > I'm trying to write a route (with camel 1.6.1) that listens to a JMS queue > and sends file to a FTP server. Simply: > from("jms:test.MyQueue").to("ftp://[email protected]:21/?password=test"); > > But I have to handle the case that the FTP server is down. In order not to > loose any message I have to keep the messages when the server is down and > resend to the server when it is started again. To implement this case I've > used ProducerTemplate & PollingConsumer instade of the route above. Now my > code looks like this: > > public void configure() { > from("file://e:/temp/data?noop=true").to("jms:test.MyQueue"); > final ProducerTemplate<Exchange> producerTemplate = > getContext().createProducerTemplate(); > > producerTemplate.send("jms:test.MyQueue", processor);// processor updates > the file name. > PollingConsumer<Exchange> consumer = null; > try{ > final Endpoint<Exchange> endpoint = > getContext().getEndpoint("ftp://[email protected]:21/?password=test"); > consumer = endpoint.createPollingConsumer(); > > consumer.start(); > while(true){ > final Exchange receive = consumer.receive(); > } > }catch(final Exception e1){ > LOG.error(e1.getMessage()); > }finally{ > try{ > consumer.stop(); > }catch(final Exception e){ > LOG.error(e.getMessage()); > } > }} > > When I stop the ftp server and send messages to queue I still loose these > messages after starting the ftp server. Does anyone knows what I'm missing > here? > > Thanks in advance > Ilker > -- > View this message in context: > http://old.nabble.com/ProducerTemplate---PollingConsumer-problem-tp28445093p28445093.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
