camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjay Bhattacharya <san...@gmail.com>
Subject Re: Handling FailedToCreateProducerException
Date Tue, 14 Jan 2014 11:01:16 GMT
You can have an exception handling block inside the camelcontext like so:

         <onException>
            <exception>xxx.xxx.FailedToCreateProducerException</exception>
            <handled>
                <constant>true</constant>
            </handled>
            <to uri="bean:mailBean?method=prepareEmail"/>
            <to uri="smtp://user@host"/>
        </onException>

The equivalent Java DSL would be:
onException(FailedToCreateProducerException.class)
                .handled(true)
                .bean(MailBean.class, "prepareEmail")
                .to("smtp://user@host");

Thanks,
Sanjay



On Tue, Jan 14, 2014 at 2:24 AM, ninadmnaik <nninad@gmail.com> wrote:

> I have a route which sends a request to a MOM endpoint. Something like:
>
>       from("direct:serviceRequest").beanRef("serviceName", "methodName").
>             to("momComponent:" + momServiceDefinitionName).
>             beanRef("serviceName", "methodName");
>
> This route works when the "mom endpoint" is up. However, if the mom
> endpoint
> is down, I see:
> *Exception in thread "main"
> org.apache.camel.FailedToCreateProducerException: Failed to create Producer
> for endpoint:
> *
>
> Is there a way to use one of the error handlers to catch
> "FailedToCreateProducerException"? If the mom endpoint is down, I want
> camel
> to start so that I can use another route to send out email alert that the
> service isn't working because the mom endpoint is down.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Handling-FailedToCreateProducerException-tp5745910.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message