camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roman Kalukiewicz <roman.kalukiew...@gmail.com>
Subject Re: Facing problems while using Set Header camel Processor
Date Wed, 29 Apr 2009 08:58:36 GMT
Hello Sailaja,

There is another question - do you send your test message as InOnly or
InOut? In JMS world if you set JMSReplyTo property to some value Camel
will work as InOut flow, so sending the message to Q1
("jms:queue:TestMF1") will cause Camel to wait for the response and
will override all headers of your message with JMS properties of the
response.

If you want to preserve some value anyway you can set it as a property
instead of a header in Camel.

Roman

2009/4/29 sailaja p <spindipr@progress.com>:
>
> Hi All,
>
> I am facing some difficulty when deploying a Camel Spring XML configuration
> with Message Translator pattern and Set Header Processor into Service mix
> 3.4.0.1.
>
> I have defined a route with JMS Endpoint(TestMF)-> Set Header Processor
> (Xpath) -> JMS Endpoint (TestMF1) -> Message Translator (Header) -> Convert
> Body To (String) -> JMS Endpoint (TestMF2).
>
> Below is my Camel configuration file and the input xml.
>
> Camel Configuration
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation=" http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/camel/schema/spring
> http://activemq.apache.org/camel/schema/spring/camel-spring-1.5.0.xsd">
>        <camelContext id="camelroute"
>                xmlns="http://activemq.apache.org/camel/schema/spring">
>                <route xmlns="http://activemq.apache.org/camel/schema/spring"
>                        id="null_1">
>                        <from uri="jms:queue:TestMF" id="JMS_0" />
>                        <setHeader headerName="TestHeader" id="SetHeader_0">
>                                <xpath>//Input</xpath>
>                        </setHeader>
>                        <to uri="jms:queue:TestMF1" id="JMS_1" />
>                        <transform id="MessageTranslator_0">
>                                <description>A special filter to
translate one data format into
> another</description>
>                                <header>TestHeader</header>
>                        </transform>
>                        <convertBodyTo type="java.lang.String" id="ConvertBodyTo_0">
>                                <description>To convert using the
default content type to a particular
> type</description>
>                        </convertBodyTo>
>                        <to uri="jms:queue:TestMF2" id="JMS_2" />
>                </route>
>        </camelContext>
> </beans>
>
> Input File is
>
> <Sample>
> <Input>Test</Input>
> </Sample>
>
> I am sending the above input xml to the JMS Endpoint (Q1). I was expecting
> that the Set Header Process adds a Header to the message and it assigns
> XPath Expression output as a Header value (TestHeader="Test"). But I didnt
> observe the header in the message received at JMS Endpoint (Q2). But the
> Message Translator is processing the message succesfully based on the header
> that is set by the Set Header Processor. I have two questions regarding
> this.
>
> 1. Why I didnt see the Header in the JMS Endpoint (Q2)?
> 2. Can I assign the node value to a header? Like assigning the following
> value to the header.
>
> <Sample>
> <Input><Value>Test</Value></Input>  ------> apply Xpath,
/Sample/Input
> ------->  assign this "<Value>1234</Value>" to a Header
> </Sample>

Mime
View raw message