I solved the problem by adding this line to my configure method:

errorHandler(deadLetterChannel().maximumRedeliveries(-1));

which means try indefinitely if an error occurs. 





olamalam wrote:
> 
> Hi Norman,
> 
> Did you mention stg like this?
> 
> from("jms:test.MyQueue?transacted=true,transactionManager=JmsTransactionManager")
> .to(ftp://[email protected]:21/?password=test);
> 
> 
> I tried this route (without using ProducerTemplate & PollingConsumer) but
> I couldn't receive any message when I stop & start FTP server.
> PS. I can't use lazyCreateTransactionManager because I'm using camel
> 1.6.1. This is why I used transactionManager=JmsTransactionManager option.
> 
> Best regards
> Ilker
> 
> 
> Norman Maurer-3 wrote:
>> 
>> 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.
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/ProducerTemplate---PollingConsumer-problem-tp28445093p28447735.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to