camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mayur_bm <>
Subject Re: Handling Exceptions not handled by the DeadLetterChannelBuilder
Date Wed, 23 Nov 2016 08:49:25 GMT

Thanks Claus.

 my goal is to handle exception in DoStart method of my custom class which
implements *DefaultConsumer*.  here i re-used the concept from the link you
have given and tried throwing exception using below approach which will
raise ExchangeFailedEvent . this event can be handled and i can take
corrective action. 

private void triggerCMISComponentException(boolean onError,final String
message,final Throwable cause) throws CMISComponentException{
			ProducerTemplate template =
			 template.send("direct:file-error", new Processor() {
		            public void process(Exchange exchange) throws Exception {
		                // set an exception on the message from the start so the
error handling is triggered

without this approach i want to just throw Exceptions from DoStart Method
(while validating some configuration data) and raise

below is the simple scenario i am checking in DoStart metod and throwing
exception if invalid configuration found. 

	exchange = ((DemoEndpoint) getEndpoint()).createExchange();
try {
			Logging.log(this.getClass(), LogLevel.DEBUG, "Path under monitoring:" +

			directory = FileUtil.getFile(path);
		catch (IllegalArgumentException | IOException e) {
			throw new IOException(messageBody);

how do i handle this exception in simple way? is there any way i can raise
CamelContextStartupFailureEvent ?


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

View raw message