camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Premkumar <premkuma...@cognizant.com>
Subject How do we to setup retries and interval when using Consumer template
Date Mon, 11 Apr 2016 13:17:32 GMT
How do we to setup retries and interval when using Consumer template.  I
tried below code but consumer receive method returns null and consumer
stops. Is there any any thing i am missing here. Appreciate your help.

consumerTemplate.start(); 
                
/* 
Sample srcEndpoint 
"ftp://batch.com:10021//inbox?delete=true&throwExceptionOnConnectFailed=true&binary=true&connectTimeout=30000&maximumReconnectAttempts=3&reconnectDelay=60000&passiveMode=true&password=xxxx&readLock=changed&username=xxxxxx&flatten=true&recursive=false"
*/ 

                // loop to get all the files in the remote site 
                while (true) { 
                    Exchange remoteExchange =
consumerTemplate.receive(srcEndPoint.toString(), 5000); 
                    
                    if (remoteExchange == null) { 
                        break; 
                    } 
                    
                  
                Exchange postExchange =
producerTemplate.send(destEndPoint.toString(),remoteExchange); 
                                
                                /* In case on error 
                                 * 
                                 */ 
                                if(null != postExchange.getException()){ 

                                        throw postExchange.getException(); 
                                        
                                } 
                        } 
                
                } catch (Exception ex){ 
                        LOGGER.error("Error Picking up from Customer ",ex); 
                }finally{ 
                        try { 
                                consumerTemplate.stop(); 
                        } catch (Exception ex) { 
                                LOGGER.error("Error Stopping Consumer
template ",ex); 
                        } 
                } 



--
View this message in context: http://camel.465427.n5.nabble.com/How-do-we-to-setup-retries-and-interval-when-using-Consumer-template-tp5780901.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message