camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Preben.Asmussen" <>
Subject Re: Best way for ScheduledBatchPollingConsumer to signal failure
Date Mon, 10 Jun 2013 06:47:43 GMT
Ahh. Just for the update. 
I was developing a custom component, and one has to remember 2 things to
support the BridgeErrorhandler.
1. call the configureConsumer in the Endoint.createConsumer method.
      public Consumer createConsumer(Processor processor) throws Exception {
		DrupalQueueConsumer drupalQueueConsumer = new DrupalQueueConsumer(this,
		return drupalQueueConsumer;
This will attatch the BridgeErrorhander support

2. In the polling consumer catch Exceptions and call
getExceptionHandler().handleException("Error creating exchange", e);

	protected int poll() throws Exception {
		// must reset for each poll
		shutdownRunningTask = null;
		pendingExchanges = 0;
		Messages messages = null;
		if (endpoint.getConfiguration().getTimeout() > 0) {
			try {
				messages = endpoint.getClient().get(getMaxMessagesPerPoll(),
			} catch (HTTPException e) {
				getExceptionHandler().handleException("Error creating exchange", e);
				return 0;
			LOG.trace("Receiving messages with request [messagePerPoll{}, timeout
{}]...", getMaxMessagesPerPoll(),
		LOG.trace("Received {} messages", messages.getMessages().length);

		Queue<Exchange> exchanges = createExchanges(messages.getMessages());
		return processBatch(CastUtils.cast(exchanges));

Then there will be created an dummy exchange with the exception and
everything works as expected.


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message