camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fordm <ford.j.mar...@gmail.com>
Subject Rethrowing an exception using the Dead Letter Error Handler
Date Wed, 24 Jul 2013 12:42:14 GMT
Hi,

I've got a camel route that consumes from an activemq endpoint and persists
the message to a database via jpa.

If, for example, the connection to the database is lost I want to retry a
message a few times and if it still fails put it on a Dead Letter Queue.
This bit is fine:

<camelContext>
    <errorHandler deadLetterUri="myDLQ" type="DeadLetterChannel"
id="myDLErrorHandler">
        <redeliveryPolicy maximumRedeliveries="3" />
    </errorHandler>

    <route errorHandlerRef="myDLErrorHandler">
        <from uri="activemq:myFromQueue" />

        <onException>
           
<exception>org.apache.openjpa.persistence.PersistenceException</exception>
            <redeliveryPolicy maximumRedeliveries="2" />
            <handled>
                <constant>true</constant>
            </handled>
        </onException>

        <to uri="jpa://foo" />
    </route>
</camelContext>

But as well as retrying and putting a failed message on the DLQ I want to
throw my own exception (it'll have some 'special' stuff that gets put into
the log). It's this bit I'm having problems with, I had hoped a simple
<throwException ref="mySpecialException" /> after the <handled>...</handled>
would work but it doesn't.

Any suggestions?

Many thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Rethrowing-an-exception-using-the-Dead-Letter-Error-Handler-tp5736211.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message