You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by titexe <ti...@yahoo.Fr> on 2009/10/21 16:12:16 UTC

Camel: Dynamic routing based on XML File ?

Hi Everybody! 

I need to develop a camel route to do the following actions: 

(1) Get the Message, (2) Extracting value of partner from the header of the
message [Message Properties], (3)check in the XML file value of this
partner. 
and (4) put this value in the header of message [Message Properties].

I've read the documentation, and I still don't have a clue on how to do
this, I'm not even sure how to start  .

Can anyone help me please? 

Thanks in advance.

-- 
View this message in context: http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p25993330.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel: Dynamic routing based on XML File ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Oct 22, 2009 at 11:04 AM, titexe <ti...@yahoo.fr> wrote:
>
> Thank you for your reply
>
> Here is the configuration XML that,what do you think? it is a good way to
> develop this camel route?
>
> <route streamCache="true">
>        <from uri="activemq:queue:IN"/>
>                <from uri="file:///c:/TEST.XML"/>
>                <choice>
>            <when>
>                                <xpath>/$Partner = $Partner</xpath>
>                                <setHeader headerName="CamelJmsDestinationName">
>                                        <simple>${in.header.Partner}</simple>
>                                </setHeader>
>                                <to uri="activemq:queue:AA"/>
>                    </when>
>                        <otherwise>
>                                <to uri="activemq:queue:Error"/>
>                        </otherwise>
>                </choice>
> </route>
>
> Thank you in advance
>

Yeah its not to bad. Mind that the xpath stuff can be tricky to get working.

You may try to set it as or something.

<xpath>/partner/@id = 'PARIS'</xpath>




> titexe
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Thu, Oct 22, 2009 at 10:21 AM, titexe <ti...@yahoo.fr> wrote:
>>>
>>> Thank you for your response,
>>>
>>> I receive messsage with this format
>>> - Header
>>> - Message Properties (Partner = PARIS)
>>> - Body
>>>
>>> I want to verify if PARIS exist in my XML file (c;\test.xml),
>>>
>>> 1- if OK i must route this message to queue PARIS,
>>> 2- if not i must route this message to queue error.
>>>
>>> Thank you in advance,
>>>
>>
>> Its the classic Content Based Router EIP, see more at
>> http://camel.apache.org/content-based-router.html
>>
>> Which should help you on the way.
>>
>>
>>> best regards,
>>>
>>> titexe
>>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> Hi
>>>>
>>>> Can you write more details as its not clear to me what you want?
>>>>
>>>> Camel can certainly consume a message (1), extract a header (2) using
>>>> xpath for example
>>>> And then in (3) why do you mean exactly?
>>>> And put a value in a header (4) on the message.
>>>>
>>>>
>>>>
>>>> On Wed, Oct 21, 2009 at 4:12 PM, titexe <ti...@yahoo.fr> wrote:
>>>>>
>>>>> Hi Everybody!
>>>>>
>>>>> I need to develop a camel route to do the following actions:
>>>>>
>>>>> (1) Get the Message, (2) Extracting value of partner from the header of
>>>>> the
>>>>> message [Message Properties], (3)check in the XML file value of this
>>>>> partner.
>>>>> and (4) put this value in the header of message [Message Properties].
>>>>>
>>>>> I've read the documentation, and I still don't have a clue on how to do
>>>>> this, I'm not even sure how to start  .
>>>>>
>>>>> Can anyone help me please?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p25993330.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p26005850.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p26006493.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Camel: Dynamic routing based on XML File ?

Posted by titexe <ti...@yahoo.Fr>.
Thank you for your reply

Here is the configuration XML that,what do you think? it is a good way to
develop this camel route?

<route streamCache="true">
        <from uri="activemq:queue:IN"/>
		<from uri="file:///c:/TEST.XML"/>
		<choice>
            <when>
				<xpath>/$Partner = $Partner</xpath>
				<setHeader headerName="CamelJmsDestinationName">
					<simple>${in.header.Partner}</simple>
				</setHeader>
				<to uri="activemq:queue:AA"/>
		    </when>
			<otherwise>
				<to uri="activemq:queue:Error"/>
			</otherwise>
		</choice>
</route>

Thank you in advance

titexe



Claus Ibsen-2 wrote:
> 
> On Thu, Oct 22, 2009 at 10:21 AM, titexe <ti...@yahoo.fr> wrote:
>>
>> Thank you for your response,
>>
>> I receive messsage with this format
>> - Header
>> - Message Properties (Partner = PARIS)
>> - Body
>>
>> I want to verify if PARIS exist in my XML file (c;\test.xml),
>>
>> 1- if OK i must route this message to queue PARIS,
>> 2- if not i must route this message to queue error.
>>
>> Thank you in advance,
>>
> 
> Its the classic Content Based Router EIP, see more at
> http://camel.apache.org/content-based-router.html
> 
> Which should help you on the way.
> 
> 
>> best regards,
>>
>> titexe
>>
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> Can you write more details as its not clear to me what you want?
>>>
>>> Camel can certainly consume a message (1), extract a header (2) using
>>> xpath for example
>>> And then in (3) why do you mean exactly?
>>> And put a value in a header (4) on the message.
>>>
>>>
>>>
>>> On Wed, Oct 21, 2009 at 4:12 PM, titexe <ti...@yahoo.fr> wrote:
>>>>
>>>> Hi Everybody!
>>>>
>>>> I need to develop a camel route to do the following actions:
>>>>
>>>> (1) Get the Message, (2) Extracting value of partner from the header of
>>>> the
>>>> message [Message Properties], (3)check in the XML file value of this
>>>> partner.
>>>> and (4) put this value in the header of message [Message Properties].
>>>>
>>>> I've read the documentation, and I still don't have a clue on how to do
>>>> this, I'm not even sure how to start  .
>>>>
>>>> Can anyone help me please?
>>>>
>>>> Thanks in advance.
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p25993330.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p26005850.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p26006493.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel: Dynamic routing based on XML File ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Oct 22, 2009 at 10:21 AM, titexe <ti...@yahoo.fr> wrote:
>
> Thank you for your response,
>
> I receive messsage with this format
> - Header
> - Message Properties (Partner = PARIS)
> - Body
>
> I want to verify if PARIS exist in my XML file (c;\test.xml),
>
> 1- if OK i must route this message to queue PARIS,
> 2- if not i must route this message to queue error.
>
> Thank you in advance,
>

Its the classic Content Based Router EIP, see more at
http://camel.apache.org/content-based-router.html

Which should help you on the way.


> best regards,
>
> titexe
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Can you write more details as its not clear to me what you want?
>>
>> Camel can certainly consume a message (1), extract a header (2) using
>> xpath for example
>> And then in (3) why do you mean exactly?
>> And put a value in a header (4) on the message.
>>
>>
>>
>> On Wed, Oct 21, 2009 at 4:12 PM, titexe <ti...@yahoo.fr> wrote:
>>>
>>> Hi Everybody!
>>>
>>> I need to develop a camel route to do the following actions:
>>>
>>> (1) Get the Message, (2) Extracting value of partner from the header of
>>> the
>>> message [Message Properties], (3)check in the XML file value of this
>>> partner.
>>> and (4) put this value in the header of message [Message Properties].
>>>
>>> I've read the documentation, and I still don't have a clue on how to do
>>> this, I'm not even sure how to start  .
>>>
>>> Can anyone help me please?
>>>
>>> Thanks in advance.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p25993330.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p26005850.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Camel: Dynamic routing based on XML File ?

Posted by titexe <ti...@yahoo.Fr>.
Thank you for your response,

I receive messsage with this format
- Header
- Message Properties (Partner = PARIS)
- Body

I want to verify if PARIS exist in my XML file (c;\test.xml),

1- if OK i must route this message to queue PARIS,
2- if not i must route this message to queue error.

Thank you in advance,

best regards,

titexe




Claus Ibsen-2 wrote:
> 
> Hi
> 
> Can you write more details as its not clear to me what you want?
> 
> Camel can certainly consume a message (1), extract a header (2) using
> xpath for example
> And then in (3) why do you mean exactly?
> And put a value in a header (4) on the message.
> 
> 
> 
> On Wed, Oct 21, 2009 at 4:12 PM, titexe <ti...@yahoo.fr> wrote:
>>
>> Hi Everybody!
>>
>> I need to develop a camel route to do the following actions:
>>
>> (1) Get the Message, (2) Extracting value of partner from the header of
>> the
>> message [Message Properties], (3)check in the XML file value of this
>> partner.
>> and (4) put this value in the header of message [Message Properties].
>>
>> I've read the documentation, and I still don't have a clue on how to do
>> this, I'm not even sure how to start  .
>>
>> Can anyone help me please?
>>
>> Thanks in advance.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p25993330.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p26005850.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel: Dynamic routing based on XML File ?

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

Can you write more details as its not clear to me what you want?

Camel can certainly consume a message (1), extract a header (2) using
xpath for example
And then in (3) why do you mean exactly?
And put a value in a header (4) on the message.



On Wed, Oct 21, 2009 at 4:12 PM, titexe <ti...@yahoo.fr> wrote:
>
> Hi Everybody!
>
> I need to develop a camel route to do the following actions:
>
> (1) Get the Message, (2) Extracting value of partner from the header of the
> message [Message Properties], (3)check in the XML file value of this
> partner.
> and (4) put this value in the header of message [Message Properties].
>
> I've read the documentation, and I still don't have a clue on how to do
> this, I'm not even sure how to start  .
>
> Can anyone help me please?
>
> Thanks in advance.
>
> --
> View this message in context: http://www.nabble.com/Camel%3A-Dynamic-routing-based-on-XML-File---tp25993330p25993330.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus