You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lleclerc <ll...@aim-rg.com> on 2012/12/10 23:11:02 UTC

Removing invalid endpoints from recipientList

Hi,

How can I remove invalid endpoints from a recipientList ?
If I use the route from(direct).doTry().recipientList(..).doCatch().....

Using the line exchange.getProperty(Exchange.FAILURE_ENDPOINT,
String.class);
will return me the 'direct' uri and not the failure recipient.
Like shown in this screenshot : http://postimage.org/image/d9azbpyfj/full/

The value "myURI" is the URI of the fakeEndpoint but it's hided in a
specific Exception, I don't want to manage every exception, only remove the
invalid endpoints.

I created a unit test there :
http://pastebin.com/fYTpU4BU

Using camel 2.10.2

Thanks for any hints!



--
View this message in context: http://camel.465427.n5.nabble.com/Removing-invalid-endpoints-from-recipientList-tp5723863.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Removing invalid endpoints from recipientList

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See the documentation of the eip
http://camel.apache.org/recipient-list.html

There is an option ignoreInvalidEndpoints


On Tue, Dec 11, 2012 at 8:00 PM, lleclerc <ll...@aim-rg.com> wrote:
> How can aggregationStrategy help me if the fake endpoint never get to create
> an Exchange ?
> Here is the test I did : http://pastebin.com/ZTJzxS64
>
> My fake endpoint will fail because it will return null as a producer
> (FailedToCreateProducerException).
>
> That is probably too heavy of an error. What I want is to be able to remove
> unused (or in error) endpoints from the recipientList. Is there a way to
> know if the endpoints still have active consumers attached to them ?
>
>
> In the final project, we have an OSGI bundle that manage a route with it's
> camelContext and send a message to the recipient list, and then we can have
> other OSGI bundles that use an exported service from the first project to
> give their personal Endpoint to be added in the recipientList.
>
> I had like that the first project can stay alive without building an endless
> list of useless endpoints, when the other project fails.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Removing-invalid-endpoints-from-recipientList-tp5723863p5723914.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Removing invalid endpoints from recipientList

Posted by lleclerc <ll...@aim-rg.com>.
How can aggregationStrategy help me if the fake endpoint never get to create
an Exchange ?
Here is the test I did : http://pastebin.com/ZTJzxS64

My fake endpoint will fail because it will return null as a producer
(FailedToCreateProducerException).

That is probably too heavy of an error. What I want is to be able to remove
unused (or in error) endpoints from the recipientList. Is there a way to
know if the endpoints still have active consumers attached to them ?


In the final project, we have an OSGI bundle that manage a route with it's
camelContext and send a message to the recipient list, and then we can have
other OSGI bundles that use an exported service from the first project to
give their personal Endpoint to be added in the recipientList.

I had like that the first project can stay alive without building an endless
list of useless endpoints, when the other project fails.



--
View this message in context: http://camel.465427.n5.nabble.com/Removing-invalid-endpoints-from-recipientList-tp5723863p5723914.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Removing invalid endpoints from recipientList

Posted by Willem jiang <wi...@gmail.com>.
The recipientList is more complicate then you thought. It is leverage the multicast to send the exchange to the other endpoints. As the Exception is thrown before the camel have a chance to send the message to the fack endpoint that you created. The RedeliveryErrorHandler just set the FAILURE_ENDPOINT to the last to endpoint.
I suggest you try to access the exception from the aggregation which is configured to the recipientList to find the real reason of the exception.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Tuesday, December 11, 2012 at 6:11 AM, lleclerc wrote:

> Hi,
>  
> How can I remove invalid endpoints from a recipientList ?
> If I use the route from(direct).doTry().recipientList(..).doCatch().....
>  
> Using the line exchange.getProperty(Exchange.FAILURE_ENDPOINT,
> String.class);
> will return me the 'direct' uri and not the failure recipient.
> Like shown in this screenshot : http://postimage.org/image/d9azbpyfj/full/
>  
> The value "myURI" is the URI of the fakeEndpoint but it's hided in a
> specific Exception, I don't want to manage every exception, only remove the
> invalid endpoints.
>  
> I created a unit test there :
> http://pastebin.com/fYTpU4BU
>  
> Using camel 2.10.2
>  
> Thanks for any hints!
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Removing-invalid-endpoints-from-recipientList-tp5723863.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).