You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pevgen <pe...@km.ru> on 2009/02/09 17:36:55 UTC
content router question
Hello.
How can I create a "content router", if I want to analize a string message
body.
i try to explain my wish by java-like example :
String messageBody = "test 1";
if (messageBody.indexOf("1")>=0) then ... messageBody will be sent to an
"Endpoint1"
else ...messageBody will be sent to an "Endpoint2".
thanks.
Evgeny
--
View this message in context: http://www.nabble.com/content-router-question-tp21916527s22882p21916527.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: content router question
Posted by pevgen <pe...@km.ru>.
Thank you, Julien.
I didn't read Camel guide attentive :(
Evgeny
--
View this message in context: http://www.nabble.com/content-router-question-tp21916527s22882p21950592.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: content router question
Posted by pevgen <pe...@km.ru>.
janstey, thank you, too :)
In your case, i have to write methoths for each value. But, for example, if
i configure my conditions from DB, it's impossible.
Thanks
Evgeny
janstey wrote:
>
> Hmmm.... looks like my response to this question didn't make it to the old
> mail list. I sent to users@camel.apache.org but it looks like nabble is
> only
> showing stuff from camel-user@activemq.apache.org
>
> On Mon, Feb 9, 2009 at 1:15 PM, Jon Anstey <ja...@gmail.com> wrote:
>
>> Try using a bean expression in a choice route
>>
>> from("direct:start").choice()
>> .when().method("myBean", "bodyContainsOne").to("mock:x")
>> .otherwise().to("mock:y");
>>
>> where the bean looks like
>>
>> static class MyBean {
>> public static boolean bodyContainsOne(@Body String messageBody) {
>> return messageBody.indexOf("1") >= 0;
>> }
>> }
>>
>> On Mon, Feb 9, 2009 at 1:06 PM, pevgen <pe...@km.ru> wrote:
>>
>>>
>>> Hello.
>>> How can I create a "content router", if I want to analize a string
>>> message
>>> body.
>>>
>>> i try to explain my wish by java-like example :
>>>
>>> String messageBody = "test 1";
>>> if (messageBody.indexOf("1")>=0) then ... messageBody will be sent to an
>>> "Endpoint1"
>>> else ...messageBody will be sent to an "Endpoint2".
>>>
>>> thanks.
>>> Evgeny
>>> --
>>> View this message in context:
>>> http://www.nabble.com/content-router-question-tp21916527s22882p21916527.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> Cheers,
>> Jon
>>
>> http://janstey.blogspot.com/
>>
>
>
>
> --
> Cheers,
> Jon
>
> http://janstey.blogspot.com/
>
>
--
View this message in context: http://www.nabble.com/content-router-question-tp21916527s22882p21976974.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: content router question
Posted by Jon Anstey <ja...@gmail.com>.
Ah cool. I thought Hadrian said it MAY be a problem yesterday. I just wanted
to share my observations :)
On Wed, Feb 11, 2009 at 10:15 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Yeah I think Hadrian is on top of this, he need to email the Nabble
> guys about the Camel move.
>
>
> On Wed, Feb 11, 2009 at 2:26 PM, Jon Anstey <ja...@gmail.com> wrote:
> > Hmmm.... looks like my response to this question didn't make it to the
> old
> > mail list. I sent to users@camel.apache.org but it looks like nabble is
> only
> > showing stuff from camel-user@activemq.apache.org
> >
> > On Mon, Feb 9, 2009 at 1:15 PM, Jon Anstey <ja...@gmail.com> wrote:
> >
> >> Try using a bean expression in a choice route
> >>
> >> from("direct:start").choice()
> >> .when().method("myBean", "bodyContainsOne").to("mock:x")
> >> .otherwise().to("mock:y");
> >>
> >> where the bean looks like
> >>
> >> static class MyBean {
> >> public static boolean bodyContainsOne(@Body String messageBody) {
> >> return messageBody.indexOf("1") >= 0;
> >> }
> >> }
> >>
> >> On Mon, Feb 9, 2009 at 1:06 PM, pevgen <pe...@km.ru> wrote:
> >>
> >>>
> >>> Hello.
> >>> How can I create a "content router", if I want to analize a string
> message
> >>> body.
> >>>
> >>> i try to explain my wish by java-like example :
> >>>
> >>> String messageBody = "test 1";
> >>> if (messageBody.indexOf("1")>=0) then ... messageBody will be sent to
> an
> >>> "Endpoint1"
> >>> else ...messageBody will be sent to an "Endpoint2".
> >>>
> >>> thanks.
> >>> Evgeny
> >>> --
> >>> View this message in context:
> >>>
> http://www.nabble.com/content-router-question-tp21916527s22882p21916527.html
> >>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >> --
> >> Cheers,
> >> Jon
> >>
> >> http://janstey.blogspot.com/
> >>
> >
> >
> >
> > --
> > Cheers,
> > Jon
> >
> > http://janstey.blogspot.com/
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>
--
Cheers,
Jon
http://janstey.blogspot.com/
Re: content router question
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah I think Hadrian is on top of this, he need to email the Nabble
guys about the Camel move.
On Wed, Feb 11, 2009 at 2:26 PM, Jon Anstey <ja...@gmail.com> wrote:
> Hmmm.... looks like my response to this question didn't make it to the old
> mail list. I sent to users@camel.apache.org but it looks like nabble is only
> showing stuff from camel-user@activemq.apache.org
>
> On Mon, Feb 9, 2009 at 1:15 PM, Jon Anstey <ja...@gmail.com> wrote:
>
>> Try using a bean expression in a choice route
>>
>> from("direct:start").choice()
>> .when().method("myBean", "bodyContainsOne").to("mock:x")
>> .otherwise().to("mock:y");
>>
>> where the bean looks like
>>
>> static class MyBean {
>> public static boolean bodyContainsOne(@Body String messageBody) {
>> return messageBody.indexOf("1") >= 0;
>> }
>> }
>>
>> On Mon, Feb 9, 2009 at 1:06 PM, pevgen <pe...@km.ru> wrote:
>>
>>>
>>> Hello.
>>> How can I create a "content router", if I want to analize a string message
>>> body.
>>>
>>> i try to explain my wish by java-like example :
>>>
>>> String messageBody = "test 1";
>>> if (messageBody.indexOf("1")>=0) then ... messageBody will be sent to an
>>> "Endpoint1"
>>> else ...messageBody will be sent to an "Endpoint2".
>>>
>>> thanks.
>>> Evgeny
>>> --
>>> View this message in context:
>>> http://www.nabble.com/content-router-question-tp21916527s22882p21916527.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> Cheers,
>> Jon
>>
>> http://janstey.blogspot.com/
>>
>
>
>
> --
> Cheers,
> Jon
>
> http://janstey.blogspot.com/
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Re: content router question
Posted by Jon Anstey <ja...@gmail.com>.
Hmmm.... looks like my response to this question didn't make it to the old
mail list. I sent to users@camel.apache.org but it looks like nabble is only
showing stuff from camel-user@activemq.apache.org
On Mon, Feb 9, 2009 at 1:15 PM, Jon Anstey <ja...@gmail.com> wrote:
> Try using a bean expression in a choice route
>
> from("direct:start").choice()
> .when().method("myBean", "bodyContainsOne").to("mock:x")
> .otherwise().to("mock:y");
>
> where the bean looks like
>
> static class MyBean {
> public static boolean bodyContainsOne(@Body String messageBody) {
> return messageBody.indexOf("1") >= 0;
> }
> }
>
> On Mon, Feb 9, 2009 at 1:06 PM, pevgen <pe...@km.ru> wrote:
>
>>
>> Hello.
>> How can I create a "content router", if I want to analize a string message
>> body.
>>
>> i try to explain my wish by java-like example :
>>
>> String messageBody = "test 1";
>> if (messageBody.indexOf("1")>=0) then ... messageBody will be sent to an
>> "Endpoint1"
>> else ...messageBody will be sent to an "Endpoint2".
>>
>> thanks.
>> Evgeny
>> --
>> View this message in context:
>> http://www.nabble.com/content-router-question-tp21916527s22882p21916527.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Cheers,
> Jon
>
> http://janstey.blogspot.com/
>
--
Cheers,
Jon
http://janstey.blogspot.com/
Re: content router question
Posted by Jon Anstey <ja...@gmail.com>.
Try using a bean expression in a choice route
from("direct:start").choice()
.when().method("myBean", "bodyContainsOne").to("mock:x")
.otherwise().to("mock:y");
where the bean looks like
static class MyBean {
public static boolean bodyContainsOne(@Body String messageBody) {
return messageBody.indexOf("1") >= 0;
}
}
On Mon, Feb 9, 2009 at 1:06 PM, pevgen <pe...@km.ru> wrote:
>
> Hello.
> How can I create a "content router", if I want to analize a string message
> body.
>
> i try to explain my wish by java-like example :
>
> String messageBody = "test 1";
> if (messageBody.indexOf("1")>=0) then ... messageBody will be sent to an
> "Endpoint1"
> else ...messageBody will be sent to an "Endpoint2".
>
> thanks.
> Evgeny
> --
> View this message in context:
> http://www.nabble.com/content-router-question-tp21916527s22882p21916527.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Cheers,
Jon
http://janstey.blogspot.com/
Re: content router question
Posted by Julien D <my...@hotmail.com>.
Hi,
check this: http://camel.apache.org/recipientlist-annotation.html
pevgen wrote:
>
> Hello.
> How can I create a "content router", if I want to analize a string message
> body.
>
> i try to explain my wish by java-like example :
>
> String messageBody = "test 1";
> if (messageBody.indexOf("1")>=0) then ... messageBody will be sent to an
> "Endpoint1"
> else ...messageBody will be sent to an "Endpoint2".
>
> thanks.
> Evgeny
>
--
View this message in context: http://www.nabble.com/content-router-question-tp21916527s22882p21936059.html
Sent from the Camel - Users mailing list archive at Nabble.com.