Hi there,
I am new to Camel, and a little bit disappointed to get the right way to
configure my use case.
- entry point is a JMS queue,
- then a multicast to a second (backup) queue and a content-based router
- the content-based router chooses a WS endpoint based on the XML root
element of the message
- I would like to have a dead letter channel managing inaccessible
webservices, my requirement being not loosing any single message.
jms:startqueue -> multicast (
-> jms:backupqueue
-> content-based router (
{root-element=ws1} -> ws1 endpoint (I need a dead letter
channel here)
{root-element=ws2} -> ws2 endpoint (I need a dead letter
channel here)
)
I think I did not manage to get to the right documentation (again, new
rider), and the only one corresponding to my content-based router seems to
be the dynamic router, using a POJO and @RecipientList ([1]), as Java DSL
does not seem to handle this case with the classic "Content Based Router".
My question, finally :
I would like to have a dead letter channel managing the inaccessible
webservices, given the fact that I used POJOs annotations to build the
route. I would like not to mix Spring DSL / Java DSL / Beans routing
configuraiton. What I felt was that I could use the errorHandlerRef
attribute of the camelContext Spring element, inspired with the Spring based
configuration sample [2], but it the dead letter channel (a JMS queue in my
case) is not filled.
Using this attribute does not trigger the configured dead letter channel,
with the following configuration :
<camelContext id="camelContext"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="myDeadLetterErrorHandler" />
<!-- here we configure our DeadLetterChannel -->
<bean id="myDeadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
<!-- exchanges is routed to ${router.deadLetter.uri} in case redelivery
failed -->
<property name="deadLetterUri" value="${router.deadLetter.uri}" />
<!-- reference the redelivery policy to use -->
<property name="redeliveryPolicy" ref="myRedeliveryPolicyConfig" />
</bean>
<!-- here we set the redelivery settings -->
<bean id="myRedeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
<!--
try redelivery at most 3 times, after that the exchange is dead and
its
routed to the ${router.deadLetter.uri} endpoint
-->
<property name="maximumRedeliveries" value="3" />
<!-- delay 250ms before redelivery -->
<property name="redeliverDelay" value="250" />
</bean>
Another solution would be to :
- decouple the content-based router from the WS endpoint, using a "direct:"
channel, and adding a RouteBuilder defining a dead letter channel between
the "direct:" channels and the WS endpoints :
jms:startqueue -> multicast (
-> jms:backupqueue
-> content-based router (
{root-element=ws1} -> direct:ws1 -> ws1 endpoint (I need a
dead letter channel here)
{root-element=ws2} -> direct:ws2 -> ws2 endpoint (I need a
dead letter channel here)
)
Can someone please help me to find what the problem is, and what would be
the ideal solution ?
Many thanks !
--
Olivier
[1] http://camel.apache.org/dynamic-router.html
[2]
http://camel.apache.org/error-handler.html#ErrorHandler-Springbasedconfigurationsample
-----
--
Olivier Billard
--
View this message in context:
http://old.nabble.com/Defining-a-DeadLetterChannel-when-using-POJO-annotations-tp27455914p27455914.html
Sent from the Camel - Users mailing list archive at Nabble.com.