You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by optixpro <ar...@hotmail.com> on 2013/06/14 03:31:13 UTC
How can i re send the msg when i got the exception.
Hi i have some question abt how to re send the message to endpoint.
i received request from jms and to convert to JSON and then i have to send
it to the Rest endpoint to check
if the thing i looking for in the endpoint is not exist i have to throws
exception and re check it again How can i do that.
public void configure() throws Exception {
onException(Exception.class)
.maximumRedeliveries(1)
.maximumRedeliveryDelay(5000)
.to(requestEndpoint);
from(fromEndpoint)
.setExchangePattern(ExchangePattern.InOnly)
.setProperty(ORIGINAL_REQUEST_PROPERTY, body())
.bean(requestMapping)
.recipientList(simple(requestEndpoint))
.bean(responseMapping)
.to(responseEndpoint);
}
--
View this message in context: http://camel.465427.n5.nabble.com/How-can-i-re-send-the-msg-when-i-got-the-exception-tp5734187.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can i re send the msg when i got the exception.
Posted by Christian Müller <ch...@gmail.com>.
You can use a route scoped onException block (instead of a global one).
But probably the best option by using JMS as source of your message is
using a transacted route. You can simple throw an exception if the "thing"
you are looking for is not available and let the broker re-send the
message. If you use ActiveMQ, you can configure the broker when (after
which time) and how ofter the message should be redelivered.
Best,
Christian Müller
-----------------
Software Integration Specialist
Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html
https://www.linkedin.com/pub/christian-mueller/11/551/642
On Fri, Jun 14, 2013 at 3:31 AM, optixpro <ar...@hotmail.com> wrote:
> Hi i have some question abt how to re send the message to endpoint.
>
> i received request from jms and to convert to JSON and then i have to send
> it to the Rest endpoint to check
> if the thing i looking for in the endpoint is not exist i have to throws
> exception and re check it again How can i do that.
>
> public void configure() throws Exception {
> onException(Exception.class)
> .maximumRedeliveries(1)
> .maximumRedeliveryDelay(5000)
> .to(requestEndpoint);
>
> from(fromEndpoint)
> .setExchangePattern(ExchangePattern.InOnly)
> .setProperty(ORIGINAL_REQUEST_PROPERTY, body())
> .bean(requestMapping)
> .recipientList(simple(requestEndpoint))
> .bean(responseMapping)
> .to(responseEndpoint);
> }
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-can-i-re-send-the-msg-when-i-got-the-exception-tp5734187.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>