osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Errors in multicast are not propagated to the dead letter chanel


As far as I can determine, multicast does not integrate with the dead
letter channel. I think that this is a bug. I did discover a work around. I
reworked the "errorMultiDirect" route to be:
((TryDefinition) from(errorMultiDirect).routeId("errorMulticastTest")
.errorHandler(deadLetterChannel(mockError)
              .onPrepareFailure(errorProcessor).maximumRedeliveries(0))
.log(LoggingLevel.INFO, "Testing Error route")
.setHeader(OrderMessageConstants.WIMS_MSG_TYPE, simple("body[messageType]"))
.setHeader(OrderMessageConstants.SAP_MESSAGE_ID, simple("body[messageID]"))
.setHeader(OrderMessageConstants.ORDER_NUMBER,
simple("body[orderHeader][order]"))
.doTry()
.multicast().parallelProcessing().shareUnitOfWork().stopOnException().to("direct:materialsTest",
"direct:qmDocTest", "direct:sdsTest").end())
.doCatch(Exception.class).bean(errorProcessor).to(mockError)
.end()
.to(mockResult)
.to("log:com.sial.NotifyStatusLogger?level=INFO");

calling the multicast component insid doTry() and doCatch() allowed me to
reroute the message in error to an endpoint. I noticed that the multicast
test case was calling multicast in this way.

https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelFailureEndpointTest.java

So why isn't multicast handling errors in a way consistent with other
components, and if this is by design could the documentation provide better
examples?

On Tue, Apr 17, 2018 at 12:42 PM, Webster Homer <webster.homer@xxxxxxxx>
wrote:

> I have a route that uses multicast parallel processing to process messages
> in parallel. It works great, when everything is good. However if an
> exception happens in any of the multicasted routes, the exception is
> handled by the multicast but never written to the route's dead letter
> channel. I am using the "shareUnitOfWork" and "stopOnException" but they
> don't seem to help.
>
> I discovered this while working on a unit test. Here is the unit test
> route:
>
> from(errorMultiDirect).routeId("errorMulticastTest")
> .errorHandler(deadLetterChannel(mock)
>               .onPrepareFailure(errorProcessor).maximumRedeliveries(0))
> .log(LoggingLevel.INFO, "Testing Error route")
> .setHeader(OrderMessageConstants.WIMS_MSG_TYPE,
> simple("body[messageType]"))
> .setHeader(OrderMessageConstants.SAP_MESSAGE_ID,
> simple("body[messageID]"))
> .setHeader(OrderMessageConstants.ORDER_NUMBER, simple("body[orderHeader][
> order]"))
> .multicast().parallelProcessing().shareUnitOfWork().
> stopOnException().to("direct:materialsTest", "direct:qmDocTest",
> "direct:sdsTest").end()
> .to("log:com.sial.NotifyStatusLogger?level=INFO");
>
> The test sends a message that causes "direct:materialsTest" to throw a
> null pointer exception.
>
> I can send the same message to this route which does not use multicast and
> the error is propagated to the dead letter chanel.
>
> from(errorDirect).routeId("errorMaterialTest")
> .errorHandler(deadLetterChannel(mock)
>               .onPrepareFailure(errorProcessor).maximumRedeliveries(0))
> .log(LoggingLevel.INFO, "Testing Error route")
> .setHeader(OrderMessageConstants.WIMS_MSG_TYPE,
> simple("body[messageType]"))
> .setHeader(OrderMessageConstants.SAP_MESSAGE_ID,
> simple("body[messageID]"))
> .setHeader(OrderMessageConstants.ORDER_NUMBER, simple("body[orderHeader][
> order]"))
> .bean(materialsEnrichment)
> .to("log:com.sial.NotifyStatusLogger?level=INFO");
>
> I am using Apache-camel 2.18.2
> I will have to remove the multicast if it won't propagate the exception to
> the Dead letter chanel
>
>
>

-- 


This message and any attachment are confidential and may be
privileged or 
otherwise protected from disclosure. If you are not the intended
recipient, 
you must not copy this message or attachment or disclose the
contents to 
any other person. If you have received this transmission in error,
please 
notify the sender immediately and delete the message and any attachment

from your system. Merck KGaA, Darmstadt, Germany and any of its 
subsidiaries do
not accept liability for any omissions or errors in this 
message which may
arise as a result of E-Mail-transmission or for damages 
resulting from any
unauthorized changes of the content of this message and 
any attachment thereto.
Merck KGaA, Darmstadt, Germany and any of its 
subsidiaries do not guarantee
that this message is free of viruses and does 
not accept liability for any
damages caused by any virus transmitted 
therewith.



Click http://www.emdgroup.com/disclaimer 
<http://www.emdgroup.com/disclaimer> to access the
German, French, Spanish 
and Portuguese versions of this disclaimer.