using filter inside when?

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

using filter inside when?

xuan
Hi all,

What I'm trying to do is to authenticate a message before sending it to be processed using message filter, so I have something like

.filter().method(MyAuthenticator.class, "isAuthenticated")

However in my route builder, I also route the messages based on their types using choice. So for example I have

from(IN_QUEUE).choice()
                .when(header(JMS_TYPE).isEqualTo("Type1"))
                    .to("bean:myBean?method=handleMessage")
                .when(header(JMS_TYPE).isEqualTo("Type2"))
                    .to("bean:yourBean?method=handleMessage")
                .otherwise().to("activemq:myqueue.in.DLQ")
                .routeId("jms-my-route");

the filter seems to work when I put it before choice, like this
 
from(IN_QUEUE)
                ..filter().method(ClientAuthenticator.class, "isAuthenticated")
                .choice()
                .when(header(JMS_TYPE).isEqualTo("Type1"))
                    .to("bean:myBean?method=handleMessage")
                .when(header(JMS_TYPE).isEqualTo("Type2"))
                    .to("bean:yourBean?method=handleMessage")
                .otherwise().to("activemq:myqueue.in.DLQ")
                .routeId("jms-my-route");

But I want to only authenticate Type1 messages, not Type2 messages.

So I tried

from(IN_QUEUE).choice()
                .when(header(JMS_TYPE).isEqualTo("Type1"))
                    .filter().method(ClientAuthenticator.class, "isAuthenticated")
                    .to("bean:myBean?method=handleMessage").end()
                .when(header(JMS_TYPE).isEqualTo("Type2"))
                    .to("bean:yourBean?method=handleMessage")
                .otherwise().to("activemq:myqueue.in.DLQ")
                .routeId("jms-my-route");

But the second when clauses is not valid.

Can I use filter inside when?If not, is there another solution?

Thanks!
xuan

Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

anoordover
I would try to solve this by splitting the route in smaller "subroutes".
Perhaps you can filter in the subroute.
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

Claus Ibsen-2
In reply to this post by xuan
Hi

Have you seen this FAQ.
http://camel.apache.org/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html

Also if you put the predicate inside the filter as a parameter then it
helps the DSL as well.

filter( xxxx )

instead of

filter().xxxx()



On Thu, Apr 19, 2012 at 7:06 PM, Xuan Huang <[hidden email]> wrote:

> Hi all,
>
> What I'm trying to do is to authenticate a message before sending it to be processed using message filter, so I have something like
>
> .filter().method(MyAuthenticator.class, "isAuthenticated")
>
> However in my route builder, I also route the messages based on their types using choice. So for example I have
>
> from(IN_QUEUE).choice()
>                .when(header(JMS_TYPE).isEqualTo("Type1"))
>                    .to("bean:myBean?method=handleMessage")
>                .when(header(JMS_TYPE).isEqualTo("Type2"))
>                    .to("bean:yourBean?method=handleMessage")
>                .otherwise().to("activemq:myqueue.in.DLQ")
>                .routeId("jms-my-route");
>
> the filter seems to work when I put it before choice, like this
>
> from(IN_QUEUE)
>                ..filter().method(ClientAuthenticator.class, "isAuthenticated")
>                .choice()
>                .when(header(JMS_TYPE).isEqualTo("Type1"))
>                    .to("bean:myBean?method=handleMessage")
>                .when(header(JMS_TYPE).isEqualTo("Type2"))
>                    .to("bean:yourBean?method=handleMessage")
>                .otherwise().to("activemq:myqueue.in.DLQ")
>                .routeId("jms-my-route");
>
> But I want to only authenticate Type1 messages, not Type2 messages.
>
> So I tried
>
> from(IN_QUEUE).choice()
>                .when(header(JMS_TYPE).isEqualTo("Type1"))
>                    .filter().method(ClientAuthenticator.class, "isAuthenticated")
>                    .to("bean:myBean?method=handleMessage").end()
>                .when(header(JMS_TYPE).isEqualTo("Type2"))
>                    .to("bean:yourBean?method=handleMessage")
>                .otherwise().to("activemq:myqueue.in.DLQ")
>                .routeId("jms-my-route");
>
> But the second when clauses is not valid.
>
> Can I use filter inside when?If not, is there another solution?
>
> Thanks!
> xuan
>



--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

xuan
Thanks very much Claus, adding endChoice() at the end of the filter works perfectly.


On 20 Apr 2012, at 08:14, Claus Ibsen wrote:

> Hi
>
> Have you seen this FAQ.
> http://camel.apache.org/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html
>
> Also if you put the predicate inside the filter as a parameter then it
> helps the DSL as well.
>
> filter( xxxx )
>
> instead of
>
> filter().xxxx()
>
>
>
> On Thu, Apr 19, 2012 at 7:06 PM, Xuan Huang <[hidden email]> wrote:
>> Hi all,
>>
>> What I'm trying to do is to authenticate a message before sending it to be processed using message filter, so I have something like
>>
>> .filter().method(MyAuthenticator.class, "isAuthenticated")
>>
>> However in my route builder, I also route the messages based on their types using choice. So for example I have
>>
>> from(IN_QUEUE).choice()
>>                .when(header(JMS_TYPE).isEqualTo("Type1"))
>>                    .to("bean:myBean?method=handleMessage")
>>                .when(header(JMS_TYPE).isEqualTo("Type2"))
>>                    .to("bean:yourBean?method=handleMessage")
>>                .otherwise().to("activemq:myqueue.in.DLQ")
>>                .routeId("jms-my-route");
>>
>> the filter seems to work when I put it before choice, like this
>>
>> from(IN_QUEUE)
>>                ..filter().method(ClientAuthenticator.class, "isAuthenticated")
>>                .choice()
>>                .when(header(JMS_TYPE).isEqualTo("Type1"))
>>                    .to("bean:myBean?method=handleMessage")
>>                .when(header(JMS_TYPE).isEqualTo("Type2"))
>>                    .to("bean:yourBean?method=handleMessage")
>>                .otherwise().to("activemq:myqueue.in.DLQ")
>>                .routeId("jms-my-route");
>>
>> But I want to only authenticate Type1 messages, not Type2 messages.
>>
>> So I tried
>>
>> from(IN_QUEUE).choice()
>>                .when(header(JMS_TYPE).isEqualTo("Type1"))
>>                    .filter().method(ClientAuthenticator.class, "isAuthenticated")
>>                    .to("bean:myBean?method=handleMessage").end()
>>                .when(header(JMS_TYPE).isEqualTo("Type2"))
>>                    .to("bean:yourBean?method=handleMessage")
>>                .otherwise().to("activemq:myqueue.in.DLQ")
>>                .routeId("jms-my-route");
>>
>> But the second when clauses is not valid.
>>
>> Can I use filter inside when?If not, is there another solution?
>>
>> Thanks!
>> xuan
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/

Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

prabumca06@gmail.com
Hi All,

 I am having added below code in my camel routing,but it not work at all.

 I want to use when and filter both for my routing
 
  from(ACT_TYPE_SPECFIC_QNAME).choice()
    .when(header(EVENT_TYPE).isEqualTo(ACT_TRANSACTION))          
      .filter(simple("{body[isCredit]} == true"))
     .process(new Processor() {
      public void process(Exchange exchange) {
        Map map = (Map) exchange.getIn().getBody();
        String Account_No = (String) map.get(ACCOUNT_ID);
        Map<String,Object> newBody = new HashMap<String, Object>();
        newBody.put(ACCOUNT_ID, Account_No);
        exchange.getIn().setBody(newBody);                                                        
       }}).to(ACTIVATE_QNAME).endChoice()
   .otherwise()
   .setHeader(DESTINATION, constant(DESTINATION_VALUE))
   .to(EROOR_QNAME)
   .end();

I also added .endChoice()  like you suggest...but ti didn't work pls kindly help me.

Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

Claus Ibsen-2
Hi

The filter simple predicate is wrong

>     .filter(simple("{body[isCredit]} == true"))

See syntax on the simple docs, eg use ${ } as the tokens.

On Tue, Oct 8, 2013 at 8:49 AM, [hidden email]
<[hidden email]> wrote:

> Hi All,
>
>  I am having added below code in my camel routing,but it not work at all.
>
>  I want to use when and filter both for my routing
>
>   from(ACT_TYPE_SPECFIC_QNAME).choice()
>     .when(header(EVENT_TYPE).isEqualTo(ACT_TRANSACTION))
>       .filter(simple("{body[isCredit]} == true"))
>      .process(new Processor() {
>       public void process(Exchange exchange) {
>         Map map = (Map) exchange.getIn().getBody();
>         String Account_No = (String) map.get(ACCOUNT_ID);
>         Map<String,Object> newBody = new HashMap<String, Object>();
>         newBody.put(ACCOUNT_ID, Account_No);
>         exchange.getIn().setBody(newBody);
>        }}).to(ACTIVATE_QNAME).endChoice()
>    .otherwise()
>    .setHeader(DESTINATION, constant(DESTINATION_VALUE))
>    .to(EROOR_QNAME)
>    .end();
>
> I also added .endChoice()  like you suggest...but ti didn't work pls kindly
> help me.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741081.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

prabumca06@gmail.com
Thanks you so much,It work now..

One more doubt.

.filter(simple("${body[isCredit]} == true")) 

Body is map message and isCredit is key and value is true/false (boolean value)

I want check is it true or false and read key and value  from constant value

How can i do that?

Regards
Prabu.N


On Tue, Oct 8, 2013 at 12:22 PM, Claus Ibsen-2 [via Camel] <[hidden email]> wrote:
Hi

The filter simple predicate is wrong

>     .filter(simple("{body[isCredit]} == true"))

See syntax on the simple docs, eg use ${ } as the tokens.

On Tue, Oct 8, 2013 at 8:49 AM, [hidden email]
<[hidden email]> wrote:

> Hi All,
>
>  I am having added below code in my camel routing,but it not work at all.
>
>  I want to use when and filter both for my routing
>
>   from(ACT_TYPE_SPECFIC_QNAME).choice()
>     .when(header(EVENT_TYPE).isEqualTo(ACT_TRANSACTION))
>       .filter(simple("{body[isCredit]} == true"))
>      .process(new Processor() {
>       public void process(Exchange exchange) {
>         Map map = (Map) exchange.getIn().getBody();
>         String Account_No = (String) map.get(ACCOUNT_ID);
>         Map<String,Object> newBody = new HashMap<String, Object>();
>         newBody.put(ACCOUNT_ID, Account_No);
>         exchange.getIn().setBody(newBody);
>        }}).to(ACTIVATE_QNAME).endChoice()
>    .otherwise()
>    .setHeader(DESTINATION, constant(DESTINATION_VALUE))
>    .to(EROOR_QNAME)
>    .end();
>
> I also added .endChoice()  like you suggest...but ti didn't work pls kindly
> help me.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741081.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen



If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741082.html
To unsubscribe from using filter inside when?, click here.
NAML



--
Thanks & Regards
 Prabu.N
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

Claus Ibsen-2
On Tue, Oct 8, 2013 at 11:10 AM, [hidden email]
<[hidden email]> wrote:
> Thanks you so much,It work now..
>
> One more doubt.
>
> .filter(simple("${body[isCredit]} == true"))
>
> Body is map message and *isCredit* is key and value is true/false (boolean
> value)
>

Yeah that is what the predicate above will test for. Lookup a key
'isCredit' from the body as a Map type. And compare it to a boolean
true value.

> I want check is it true or false and read key and value  from constant value
>
> How can i do that?
>

I dont understand what you want here? Which constant value do you want to read?



> *Regards*
> Prabu.N
>
>
> On Tue, Oct 8, 2013 at 12:22 PM, Claus Ibsen-2 [via Camel] <
> [hidden email]> wrote:
>
>> Hi
>>
>> The filter simple predicate is wrong
>>
>> >     .filter(simple("{body[isCredit]} == true"))
>>
>> See syntax on the simple docs, eg use ${ } as the tokens.
>>
>> On Tue, Oct 8, 2013 at 8:49 AM, [hidden email]<http://user/SendEmail.jtp?type=node&node=5741082&i=0>
>> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5741082&i=1>>
>> wrote:
>>
>> > Hi All,
>> >
>> >  I am having added below code in my camel routing,but it not work at
>> all.
>> >
>> >  I want to use when and filter both for my routing
>> >
>> >   from(ACT_TYPE_SPECFIC_QNAME).choice()
>> >     .when(header(EVENT_TYPE).isEqualTo(ACT_TRANSACTION))
>> >       .filter(simple("{body[isCredit]} == true"))
>> >      .process(new Processor() {
>> >       public void process(Exchange exchange) {
>> >         Map map = (Map) exchange.getIn().getBody();
>> >         String Account_No = (String) map.get(ACCOUNT_ID);
>> >         Map<String,Object> newBody = new HashMap<String, Object>();
>> >         newBody.put(ACCOUNT_ID, Account_No);
>> >         exchange.getIn().setBody(newBody);
>> >        }}).to(ACTIVATE_QNAME).endChoice()
>> >    .otherwise()
>> >    .setHeader(DESTINATION, constant(DESTINATION_VALUE))
>> >    .to(EROOR_QNAME)
>> >    .end();
>> >
>> > I also added .endChoice()  like you suggest...but ti didn't work pls
>> kindly
>> > help me.
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741081.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5741082&i=2>
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741082.html
>>  To unsubscribe from using filter inside when?, click here<
>> .
>> NAML<
http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
> Thanks & Regards
>  Prabu.N
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741111.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

prabumca06@gmail.com

Issue : 1

It didn't work

Msg Send code
 txnmsg.put("IsCredit" ,true);

Camel
.filter(simple("${body[isCredit]} == true "))  

But if i specify like below it work

Msg Send code
txnmsg.put("IsCredit" ,"true")

Camel
.filter(simple("${body[isCredit]} == 'true'"))  

Issue:2

Camel routing in one class file it implements interface (Camleconstant) there i have defined all constant 

I want to use constant in simple like below

.filter(simple("${body[Camleconstant.Iscredit]} == 'true'"))  


Regards
Prabu.n


On Tue, Oct 8, 2013 at 6:46 PM, Claus Ibsen-2 [via Camel] <[hidden email]> wrote:
On Tue, Oct 8, 2013 at 11:10 AM, [hidden email]
<[hidden email]> wrote:
> Thanks you so much,It work now..
>
> One more doubt.
>
> .filter(simple("${body[isCredit]} == true"))
>
> Body is map message and *isCredit* is key and value is true/false (boolean
> value)
>

Yeah that is what the predicate above will test for. Lookup a key
'isCredit' from the body as a Map type. And compare it to a boolean
true value.

> I want check is it true or false and read key and value  from constant value
>
> How can i do that?
>

I dont understand what you want here? Which constant value do you want to read?



> *Regards*
> Prabu.N
>
>
> On Tue, Oct 8, 2013 at 12:22 PM, Claus Ibsen-2 [via Camel] <
> [hidden email]> wrote:
>
>> Hi
>>
>> The filter simple predicate is wrong
>>
>> >     .filter(simple("{body[isCredit]} == true"))
>>
>> See syntax on the simple docs, eg use ${ } as the tokens.
>>
>> On Tue, Oct 8, 2013 at 8:49 AM, [hidden email]<http://user/SendEmail.jtp?type=node&node=5741082&i=0>
>> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5741082&i=1>>
>> wrote:

>>
>> > Hi All,
>> >
>> >  I am having added below code in my camel routing,but it not work at
>> all.
>> >
>> >  I want to use when and filter both for my routing
>> >
>> >   from(ACT_TYPE_SPECFIC_QNAME).choice()
>> >     .when(header(EVENT_TYPE).isEqualTo(ACT_TRANSACTION))
>> >       .filter(simple("{body[isCredit]} == true"))
>> >      .process(new Processor() {
>> >       public void process(Exchange exchange) {
>> >         Map map = (Map) exchange.getIn().getBody();
>> >         String Account_No = (String) map.get(ACCOUNT_ID);
>> >         Map<String,Object> newBody = new HashMap<String, Object>();
>> >         newBody.put(ACCOUNT_ID, Account_No);
>> >         exchange.getIn().setBody(newBody);
>> >        }}).to(ACTIVATE_QNAME).endChoice()
>> >    .otherwise()
>> >    .setHeader(DESTINATION, constant(DESTINATION_VALUE))
>> >    .to(EROOR_QNAME)
>> >    .end();
>> >
>> > I also added .endChoice()  like you suggest...but ti didn't work pls
>> kindly
>> > help me.
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741081.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5741082&i=2>
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>>

>> .
>> NAML<
http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>

>
>
>
> --
> Thanks & Regards
>  Prabu.N
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741111.html

> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen



If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741132.html
To unsubscribe from using filter inside when?, click here.
NAML



--
Thanks & Regards
 Prabu.N
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

Claus Ibsen-2
What Camel version do you use?



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

prabumca06@gmail.com
Camel  2.8

Regards
Prabu.N


On Tue, Oct 8, 2013 at 7:36 PM, Claus Ibsen-2 [via Camel] <[hidden email]> wrote:
What Camel version do you use?



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen



If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741137.html
To unsubscribe from using filter inside when?, click here.
NAML



--
Thanks & Regards
 Prabu.N
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

Claus Ibsen-2
Try upgrading, as 2.8 is EOL.

On Tue, Oct 8, 2013 at 4:09 PM, [hidden email]
<[hidden email]> wrote:

> Camel  2.8
>
> *Regards*
> Prabu.N
>
>
> On Tue, Oct 8, 2013 at 7:36 PM, Claus Ibsen-2 [via Camel] <
> [hidden email]> wrote:
>
>> What Camel version do you use?
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5741137&i=0>
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741137.html
>>  To unsubscribe from using filter inside when?, click here<
>> .
>> NAML<
http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
> Thanks & Regards
>  Prabu.N
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741139.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

prabumca06@gmail.com
In reply to this post by Claus Ibsen-2
Please kindly help...

Regards
Prabu.N



On Tue, Oct 8, 2013 at 7:38 PM, Prabu <[hidden email]> wrote:
Camel  2.8

Regards
Prabu.N


On Tue, Oct 8, 2013 at 7:36 PM, Claus Ibsen-2 [via Camel] <[hidden email]> wrote:
What Camel version do you use?



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen



If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741137.html
To unsubscribe from using filter inside when?, click here.
NAML



--
Thanks & Regards
 Prabu.N



--
Thanks & Regards
 Prabu.N
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

Claus Ibsen-2
The simple language uses a string to lookup in a map, you cannot
reference a java class field etc. I suggest to read the docs some
more.

Camel supports many other languages, so you can just use another and
more powerful language such as groovy, mvel, ognl, javascript etc that
can compile the script into byte code or whatnot.

Or write a java bean with a method that does the check and use that.





On Tue, Oct 8, 2013 at 5:24 PM, [hidden email]
<[hidden email]> wrote:

> Please kindly help...
>
> *Regards*
> Prabu.N
>
>
>
> On Tue, Oct 8, 2013 at 7:38 PM, Prabu <[hidden email]> wrote:
>
>> Camel  2.8
>>
>> *Regards*
>> Prabu.N
>>
>>
>> On Tue, Oct 8, 2013 at 7:36 PM, Claus Ibsen-2 [via Camel] <
>> [hidden email]> wrote:
>>
>>> What Camel version do you use?
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> Red Hat, Inc.
>>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5741137&i=0>
>>> Twitter: davsclaus
>>> Blog: http://davsclaus.com
>>> Author of Camel in Action: http://www.manning.com/ibsen
>>>
>>>
>>> ------------------------------
>>>  If you reply to this email, your message will be added to the
>>> discussion below:
>>>
>>> http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741137.html
>>>  To unsubscribe from using filter inside when?, click here<
>>> .
>>> NAML<
http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>>
>>
>>
>> --
>> Thanks & Regards
>>  Prabu.N
>>
>
>
>
> --
> Thanks & Regards
>  Prabu.N
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741143.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

prabumca06@gmail.com

I am using camel 2.8 which language fit for my case...pls give some sample for that.i only.used simple dont know grovvy..etc

On Oct 8, 2013 10:03 PM, "Claus Ibsen-2 [via Camel]" <[hidden email]> wrote:
The simple language uses a string to lookup in a map, you cannot
reference a java class field etc. I suggest to read the docs some
more.

Camel supports many other languages, so you can just use another and
more powerful language such as groovy, mvel, ognl, javascript etc that
can compile the script into byte code or whatnot.

Or write a java bean with a method that does the check and use that.





On Tue, Oct 8, 2013 at 5:24 PM, [hidden email]
<[hidden email]> wrote:

> Please kindly help...
>
> *Regards*
> Prabu.N
>
>
>
> On Tue, Oct 8, 2013 at 7:38 PM, Prabu <[hidden email]> wrote:
>
>> Camel  2.8
>>
>> *Regards*
>> Prabu.N
>>
>>
>> On Tue, Oct 8, 2013 at 7:36 PM, Claus Ibsen-2 [via Camel] <
>> [hidden email]> wrote:
>>
>>> What Camel version do you use?
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> Red Hat, Inc.
>>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5741137&i=0>
>>> Twitter: davsclaus
>>> Blog: http://davsclaus.com
>>> Author of Camel in Action: http://www.manning.com/ibsen
>>> > Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen



If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741147.html
To unsubscribe from using filter inside when?, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

ceposta
Why can't you just concatenate? You define the expression in a string...
and if CamelConstant.IsCredit is a string just concatenate it. Obviously,
this would have to truly be a constant (doesn't change) otherwise it won't
be updated.

.filter(simple("${body[" + Camleconstant.IsCredit +"]} == 'true'"))


On Tue, Oct 8, 2013 at 2:01 PM, [hidden email]
<[hidden email]>wrote:

> I am using camel 2.8 which language fit for my case...pls give some sample
> for that.i only.used simple dont know grovvy..etc
> On Oct 8, 2013 10:03 PM, "Claus Ibsen-2 [via Camel]" <
> [hidden email]> wrote:
>
> > The simple language uses a string to lookup in a map, you cannot
> > reference a java class field etc. I suggest to read the docs some
> > more.
> >
> > Camel supports many other languages, so you can just use another and
> > more powerful language such as groovy, mvel, ognl, javascript etc that
> > can compile the script into byte code or whatnot.
> >
> > Or write a java bean with a method that does the check and use that.
> >
> >
> >
> >
> >
> > On Tue, Oct 8, 2013 at 5:24 PM, [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5741147&i=0>
> > <[hidden email] <http://user/SendEmail.jtp?type=node&node=5741147&i=1>>
> > wrote:
> >
> > > Please kindly help...
> > >
> > > *Regards*
> > > Prabu.N
> > >
> > >
> > >
> > > On Tue, Oct 8, 2013 at 7:38 PM, Prabu <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5741147&i=2>>
> > wrote:
> > >
> > >> Camel  2.8
> > >>
> > >> *Regards*
> > >> Prabu.N
> > >>
> > >>
> > >> On Tue, Oct 8, 2013 at 7:36 PM, Claus Ibsen-2 [via Camel] <
> > >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5741147&i=3
> >>
> > wrote:
> > >>
> > >>> What Camel version do you use?
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>> Claus Ibsen
> > >>> -----------------
> > >>> Red Hat, Inc.
> > >>> Email: [hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5741137&i=0>
> > >>> Twitter: davsclaus
> > >>> Blog: http://davsclaus.com
> > >>> Author of Camel in Action: http://www.manning.com/ibsen
> > >>>
> > >>>
> > >>> ------------------------------
> > >>>  If you reply to this email, your message will be added to the
> > >>> discussion below:
> > >>>
> > >>>
> > >>> .
> > >>> NAML<
> >
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
> > >>>
> > >>
> > >>
> > >>
> > >> --
> > >> Thanks & Regards
> > >>  Prabu.N
> > >>
> > >
> > >
> > >
> > > --
> > > Thanks & Regards
> > >  Prabu.N
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> >
> http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741143.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5741147&i=4>
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741147.html
> >  To unsubscribe from using filter inside when?, click here<
> >
> > .
> > NAML<
>
http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741164.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta
Reply | Threaded
Open this post in threaded view
|

Re: using filter inside when?

prabumca06@gmail.com
In reply to this post by Claus Ibsen-2
I have upgraded to camel to 2.11

Please suggest what approach best for my case.


Regards
Prabu.N


On Wed, Oct 9, 2013 at 8:14 AM, Claus Ibsen-2 [via Camel] <[hidden email]> wrote:
Try upgrading, as 2.8 is EOL.

On Tue, Oct 8, 2013 at 4:09 PM, [hidden email]
<[hidden email]> wrote:

> Camel  2.8
>
> *Regards*
> Prabu.N
>
>
> On Tue, Oct 8, 2013 at 7:36 PM, Claus Ibsen-2 [via Camel] <
> [hidden email]> wrote:
>
>> What Camel version do you use?
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5741137&i=0>
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>>

>> .
>> NAML<
http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>

>
>
>
> --
> Thanks & Regards
>  Prabu.N
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741139.html

> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen



If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/using-filter-inside-when-tp5652300p5741184.html
To unsubscribe from using filter inside when?, click here.
NAML



--
Thanks & Regards
 Prabu.N