camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Premkumar <premkuma...@cognizant.com>
Subject Camel reconnectDelay and maximumReconnectAttempts not working with ConsumerTemplete
Date Mon, 28 Mar 2016 19:04:34 GMT
I have Quartz Cron job that runs on some schedule and i am using Camel
Consumer, Producer template to pickup some files from FTP site and copy it
local file system. When using reconnectDelay=60000 and
maximumReconnectAttempts=3,throwExceptionOnConnectFailed=true with FTP
consumer it doesn't try to reconnect, i get null for exchange and consumer
stops.

 
Code snippet

public class ScheduleProcessorJob extends QuartzJobBean {


	@Autowired
	private ProducerTemplate producerTemplate;
	
	@Autowired
	private ConsumerTemplate consumerTemplate;

protected void executeInternal(JobExecutionContext jobContext)
			throws JobExecutionException {

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/Camel-reconnectDelay-and-maximumReconnectAttempts-not-working-with-ConsumerTemplete-tp5779910.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message