You can turn on an option on recipient list to ignore invalid endpoints

On Thu, May 25, 2017 at 5:04 PM, stalbot <steve.tal...@ahold.com> wrote:
> I have a route with a recipientList.  The endpoint passed to the
> recipientList comes from a property.  There is a route-specific onException
> handler with redelivery for this route.  It is possible that the endpoint
> can be invalid, causing the recipientList to fail and onException redelivery
> to be triggered.  Since the endpoint is invalid, we don't want the
> redelivery to use the same endpoint and fail again.  I have tried to change
> the property value in the onRedelivery processor when control flow gets
> there, but it appears that the changed property value passed to the
> recipientList isn't used on the redelivery attempt.  It uses the original
> value passed in, which causes the route to fail again and go to my fail
> endpoint.  When I check the property value in the fail endpoint (expecting
> that the endpoint property was not changed), it appears to be the changed
> endpoint, not the original endpoint.  So it seems like the property is
> changed but redelivery doesn't use it.
>
> Is there a way to change the property value prior to its use in the
> recipientList redelivery attempt such that it will be used instead of using
> the original value?
>
> NOTE: I am using this approach to redeliveries:
> http://camel.apache.org/how-do-i-retry-processing-a-message-from-a-certain-point-back-or-an-entire-route.html
>
> Example code below:
>
> from("direct:showList)
>      .onException(HttpOperationFailedException.class)
>           .handled(true)
>           .maximumRedeliveries(MAX_REDELIVERIES)
>           .redeliveryDelay(REDELIVERY_DELAY)
>           .onRedelivery(e->{
>                     e.setProperty(GET_LIST_ENDPOINT,
> "http4://correctedEndpoint");
>           })
>           .to(Endpoint.HANDLE_ERROR_ON_REDELIVERY)
>           .end()
>      ....
>      .to("direct:callGetList")
>      ....
> .end()
>
> from("direct:callGetList")
>      .errorHandler(noErrorHandler())
>      .recipientList(exchangeProperty(GET_LIST_ENDPOINT))
> .end();
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Need-to-be-able-to-change-endpoint-for-recipientList-when-call-is-redelivered-tp5800698.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to