Hi ,
Yes, You can do it with the DelegatingProcessor, errorHandler can't help
you to update the DB for success.
But you need to do some configure about the errorhandler. Camel will set
a deadLetterHandler which will redeliver the message 6 time if there is
the exchange is failed for you by default, you may need to configure the
maximumRedeliveries number.
Willem
[1]
http://activemq.apache.org/camel/maven/camel-core/apidocs/org/apache/camel/builder/NoErrorHandlerBuilder.html
harinair wrote:
Sorry - I did not get the full answer... I think I am not asking the question
correctly. I have figured out the routing - that was pretty easy. I have a
route similar to this:
from("jms:delivery-queue")
.recipientList().header(Constants.ROUTE_HEADER);
Now based on the ROUTE_HEADER, some endpoint may handle sending of this
message. Now after the message is send to the other system (possibilities
are SFTP, FTP, HTTP/HTTPS), I need to get the control after the
transmission, check the status of exchange and update the database. So for
that do I have to add a DelegatingProcessor before the recipientList?
Something like this? Is this what need to be done?
u myProcessor = new MyDelegatingProcessor();
from("jms:delivery-queue").intercept(myProcessor)
.recipientList().header(Constants.ROUTE_HEADER);
in MyDelegatingProcessor.process()
public void process(Exchange exchange) {
processNext();
if (exchange.isFailed()) {
// update the DB as failed
} else {
// update the DB as successful
}
}
Am I making sense?
Hari Gangadharan
Claus Ibsen wrote:
Hi
Answer on some of your questions.
Exchange has methods: isFailed, getException
http://activemq.apache.org/camel/maven/camel-core/apidocs/org/apache/camel/Exchange.html
I guess you can also configure your error handler to multicast the failed
message to 2 destinations such as:
errorHandler(deadLetterHandler().maximumRedeliveries(2)).multicast().to("seda:dlc",
"xmpp:xxx");
Then you get the dead message in a queue and also a notification. If you
want "redeliver" of the "xmpp:xxx" then this can be split into 2 routes
using a seda queue in the middle.
errorHandler(deadLetterHandler().maximumRedeliveries(2)).multicast().to("seda:dlc",
"seda:xxx");
from("seda:xxx").errorHandler(deadLetterHandler().maximumRedeliveries(5)).to("xmpp:xxx");
The combinations is nearly endless, a bit scary ;)
I think we might have a few DSL for detecting if a message is failed, but
I haven't used them to much. But you can always check from a processor
with java code, or use bean or some kind of EL language.
Well try a bit more and maybe post a sample of how far you got. Then we
can look at it again later.
You can also intercept specific exceptions and route them to your xmpp as
well
Here is some links to check:
http://activemq.apache.org/camel/error-handler.html
http://activemq.apache.org/camel/exception-clause.html
http://activemq.apache.org/camel/dead-letter-channel.html
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk