camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From moj0002 <mortenjensenh...@hotmail.com>
Subject retrieving iru in onException
Date Mon, 17 Mar 2014 02:48:26 GMT
I am trying to write a simple "ping" application. I ping urls in a multicast
and if there is a connection exception I catch it in a onException which
calls a aggregation that builds an email

If myFirstURLToPing is down I can't figure out out how to pass the URL via
the Exception to the email body.

I can't find something like ${to.uri} in the Message or Exchange. This seems
that it should be easy to get from the exception but I can't find any
references to the uri variable.

<route >
            <from uri="timer://foo?fixedRate=true&amp;period=3600000"
id="pingTine"/>
            <multicast>
                <to http://myFirstURLToPing:1234" />
                <to http://mySecondURLToPing:1234" />
                <to http://myThirdURLToPing:1234" />

            </multicast>
 </route>


<onException useOriginalMessage="true">
            <exception>java.net.ConnectException</exception>
            <exception>java.net.UnknownHostException</exception>
            <handled>
                <constant>true</constant>
            </handled>
            <transform>
                <simple>DOWN  >>>  <HERE  SHOLD the URI BE
DISPLAYED></simple>
            </transform>
           <to uri="direct:buildEmaiBody"/> 
</onException>


<route>
<from uri="direct:buildEmaiBody"/>
<aggregate strategyRef="mailBodyAppender" strategyMethodName="append"
completionTimeout="20000">
<correlationExpression>
   <constant>true</constant>
 </correlationExpression>
 <to smpt://.../>
  </aggregate>
</route>

I would want my email to show

DOWN  >>> http://myFirstURLToPing:1234
DOWN  >>> http://myThirdURLToPing:1234

I have figured out a way by creating a route for each URL to ping, naming
the route the same as the URL to ping and then use ${routeId} but that seems
very clumpsy



--
View this message in context: http://camel.465427.n5.nabble.com/retrieving-iru-in-onException-tp5748904.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message