You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sura Monday <su...@yahoo.com> on 2012/09/11 09:30:04 UTC

implementing route filter proeprties.

Hi All,
I am trying to implement a custom end point.
An example route looks like this:

from("jason:message?illoc_force=tell")   
                     .to("jason:message?sender = mary");

With the properties illoc_force and sender set in the route means that the first end point should pass only messages that has illoc_force = tell. Similarly, the second end point should process only messages sent by mary.

In order to achieve this, I do the following in the consumer:

String e_illoc = endpoint.getIlloc_force();
String illoc = value sent by my application;

if (e_illoc.equals(illoc ) || e_illoc == null)
                 getProcessor().process(exchange);

this assures that only messages with illoc_force=tell are sent in the router.

Similarly at the producer, 
String er = endpoint.getReceiver();
String r = (String)headerInfo.get("receiver");

if ((r.equals(ei) || er.equals(null))
 pass it to my application

However, when I look at the source codes of some components in the camel source code, I do not see this type of filtering done. 

So I would like to know whether this type of filtering logic is against camel design conventions?

/Sura

Re: implementing route filter proeprties.

Posted by suralk <su...@yahoo.com>.
thanks  a lot for the confirmation :)



--
View this message in context: http://camel.465427.n5.nabble.com/implementing-route-filter-proeprties-tp5719082p5719159.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: implementing route filter proeprties.

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

There is EIPs for that such as the filter or content based router
http://camel.apache.org/eip

But as a component writer, you are free to develop you component as you want.
And if it makes sense to have filter option built-in then go ahead.




On Tue, Sep 11, 2012 at 9:30 AM, Sura Monday <su...@yahoo.com> wrote:
> Hi All,
> I am trying to implement a custom end point.
> An example route looks like this:
>
> from("jason:message?illoc_force=tell")
>                      .to("jason:message?sender = mary");
>
> With the properties illoc_force and sender set in the route means that the first end point should pass only messages that has illoc_force = tell. Similarly, the second end point should process only messages sent by mary.
>
> In order to achieve this, I do the following in the consumer:
>
> String e_illoc = endpoint.getIlloc_force();
> String illoc = value sent by my application;
>
> if (e_illoc.equals(illoc ) || e_illoc == null)
>                  getProcessor().process(exchange);
>
> this assures that only messages with illoc_force=tell are sent in the router.
>
> Similarly at the producer,
> String er = endpoint.getReceiver();
> String r = (String)headerInfo.get("receiver");
>
> if ((r.equals(ei) || er.equals(null))
>  pass it to my application
>
> However, when I look at the source codes of some components in the camel source code, I do not see this type of filtering done.
>
> So I would like to know whether this type of filtering logic is against camel design conventions?
>
> /Sura



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen