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,
processor);
configureConsumer(drupalQueueConsumer);
drupalQueueConsumer.setMaxMessagesPerPoll(configuration.getMaxMessagesPerPoll());
return drupalQueueConsumer;
}
This will attatch the BridgeErrorhander support
2. In the polling consumer catch Exceptions and call
getExceptionHandler().handleException("Error creating exchange", e);
@Override
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(),
endpoint.getConfiguration().getTimeout());
} catch (HTTPException e) {
getExceptionHandler().handleException("Error
creating exchange", e);
return 0;
}
LOG.trace("Receiving messages with request
[messagePerPoll{}, timeout
{}]...", getMaxMessagesPerPoll(),
endpoint.getConfiguration().getTimeout());
}
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:
http://camel.465427.n5.nabble.com/Best-way-for-ScheduledBatchPollingConsumer-to-signal-failure-tp5732703p5734056.html
Sent from the Camel - Users mailing list archive at Nabble.com.