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
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