Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 73030 invoked from network); 7 Jul 2008 09:46:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jul 2008 09:46:51 -0000 Received: (qmail 59622 invoked by uid 500); 7 Jul 2008 09:46:51 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 59602 invoked by uid 500); 7 Jul 2008 09:46:51 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 59588 invoked by uid 99); 7 Jul 2008 09:46:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jul 2008 02:46:51 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jul 2008 09:45:57 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1KFnIY-0004y3-AP for camel-user@activemq.apache.org; Mon, 07 Jul 2008 02:46:18 -0700 Message-ID: <18313223.post@talk.nabble.com> Date: Mon, 7 Jul 2008 02:46:18 -0700 (PDT) From: cmoulliard To: camel-user@activemq.apache.org Subject: RE: How can I set the content of the body when I left a bean and before to go to the next bean ? In-Reply-To: <4C1FB9C00D24A140906239533638C4D204BD7F91@EXVS04.exserver.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: cmoulliard@gmail.com References: <18282228.post@talk.nabble.com> <4C1FB9C00D24A140906239533638C4D204BD7E64@EXVS04.exserver.dk> <18310870.post@talk.nabble.com> <4C1FB9C00D24A140906239533638C4D204BD7F6F@EXVS04.exserver.dk> <18312377.post@talk.nabble.com> <4C1FB9C00D24A140906239533638C4D204BD7F91@EXVS04.exserver.dk> X-Virus-Checked: Checked by ClamAV on apache.org Claus, I use Camel 1.4-SNAPSHOT but I haven't made a build since around two weeks. Regards, Charles Claus Ibsen wrote: >=20 > Hi Charles, >=20 > I will try to hack a unit test that demonstrates your route and bean > chain, to help identify the problem. >=20 > What version of Camel are you using? > Have you tried with the latest 1.4-SNAPSHOT version of Camel? >=20 >=20 > Med venlig hilsen > =20 > Claus Ibsen > ...................................... > Silverbullet > Skovsg=C3=A5rdsv=C3=A6nget 21 > 8362 H=C3=B8rning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk >=20 > -----Original Message----- > From: cmoulliard [mailto:cmoulliard@gmail.com]=20 > Sent: 7. juli 2008 10:42 > To: camel-user@activemq.apache.org > Subject: RE: How can I set the content of the body when I left a bean and > before to go to the next bean ? >=20 >=20 > Hi Claus, >=20 > Unfortunately, what you propose does not work. For your information, my > activemq is defined in my camelcontext as a vm queue. >=20 > When I use in my route "direct" endpoint instead of "activemq", the objec= t > transformed is well send to the "save" bean. >=20 > From("File:///c:/temp") > .unmarshall(jaxb) > .to("direct:input"); > =20 > 2nd part : > From ("direct.input") > .to("bean:converter) > .to("bean:save"); > .to("direct:output"); >=20 > Regards, >=20 > Charles=20 >=20 >=20 > Claus Ibsen wrote: >>=20 >> Hi >>=20 >> I assume since the original input is from a file you are doing an InOnly >> message exchange pattern (MEP).=20 >>=20 >> So whenever you receive a message from the jms queue:myqueue and it >> hasn't >> a reply-to set it should also be a InOnly message out-of-the-box. >>=20 >> So I would expect that if you set the altered message on the In message >> then the save bean should see this change: >>=20 >> private void sendTransformedMesage(Exchange in, Object object) { >> in.getIn().setBody(object); >> } >>=20 >>=20 >> Med venlig hilsen >> =20 >> Claus Ibsen >> ...................................... >> Silverbullet >> Skovsg=C3=A5rdsv=C3=A6nget 21 >> 8362 H=C3=B8rning >> Tlf. +45 2962 7576 >> Web: www.silverbullet.dk >>=20 >> -----Original Message----- >> From: cmoulliard [mailto:cmoulliard@gmail.com]=20 >> Sent: 7. juli 2008 08:40 >> To: camel-user@activemq.apache.org >> Subject: RE: How can I set the content of the body when I left a bean an= d >> before to go to the next bean ? >>=20 >>=20 >> Hi claus, >>=20 >> My explanation was not enough clear. The JAXB unmarshalling has already >> be >> done : >> Here is my routing for the first part of the job: >>=20 >> DataFormat jaxb =3D new >> JaxbDataFormat("com.myapplication.schema.myschema"); >>=20 >> From("File:///c:/temp"). >> unmarshall(jaxb) >> .to("activemq:queue:myqueue"); >>=20 >> 2nd part : >> From ("activemq:queue:myqueue") >> .to("bean:converter) >> .to("bean:save"); >>=20 >> My "converter" bean receives as input the JAXB object (through the >> message >> body coming from the queue) and has to perform a java to java >> transformation. In this bean, I perform the transformation and I would >> like >> to send the transformation result to the "save" bean endpoint. >>=20 >> I try to send a new message using the following code (after analizing th= e >> pipeline camel test case) but without success : >>=20 >> public Class Converter implements Processor ( >> =20 >> public void process(Exchange in) throws Exception ( >> .... part where transformation of the jaxb object into another java >> object took place >> sendTransformedMessage(in, object); >> } >>=20 >>=20 >> private void sendTransformedMesage(Exchange in, Object object) { >> in.getOut(true).copyFrom(Exchange.getIn()); >> in.getOut()/setBody(object); >> } >>=20 >> Should I have to define the pattern as a InOut between "converter" and >> "save" ? >>=20 >> Regards, >>=20 >> Charles >>=20 >>=20 >> Claus Ibsen wrote: >>>=20 >>> Hi Charles >>>=20 >>> Convertion from the dataformat JAXB to Order is supported out of the bo= x >>> in Camel with its Data Format: >>> http://activemq.apache.org/camel/data-format.html >>>=20 >>> And the JAXB: >>> http://activemq.apache.org/camel/jaxb.html >>>=20 >>>=20 >>> DataFormat jaxb =3D new JaxbDataFormat("com.mycompany"); >>> // where com.mycompany is the package where your domain objecs it - eg >>> Order >>>=20 >>> from("File:///c:/temp"). >>> unmarshal(jaxb). >>> to("bean:save); >>>=20 >>> Then your Order class must be annotated with the JAXB annotations for >>> this. >>> And you should have a jaxb.index file the JAXB classes you have in the >>> package =3D Order. >>>=20 >>> For examples see the camel-jaxb component that has a unit DataFormatTes= t >>> that does something like the above. >>>=20 >>> See this unit test and its related files and you will have something to >>> go >>> along with. >>>=20 >>>=20 >>> Med venlig hilsen >>> =20 >>> Claus Ibsen >>> ...................................... >>> Silverbullet >>> Skovsg=C3=A5rdsv=C3=A6nget 21 >>> 8362 H=C3=B8rning >>> Tlf. +45 2962 7576 >>> Web: www.silverbullet.dk >>> -----Original Message----- >>> From: cmoulliard [mailto:cmoulliard@gmail.com]=20 >>> Sent: 4. juli 2008 18:05 >>> To: camel-user@activemq.apache.org >>> Subject: How can I set the content of the body when I left a bean and >>> before to go to the next bean ? >>>=20 >>>=20 >>> Hi, >>>=20 >>> In a bean component receiving a message, I would like to transform the >>> content of a object received from something into something different >>> (like >>> from JAXB towards Order object). >>> To achieve this, I create a pipeline routes : >>>=20 >>> from("File:///c:/temp"). >>> to("bean:converter). >>> to("bean:save"); >>>=20 >>> Unfortunately, when I define : =20 >>>=20 >>> in.getOut().setBody(order, Order.class)=20 >>>=20 >>> after the transformation step in order to send the message to my bean : >>> save, I see that the message is send back to my bean converter and not >>> propagated to the bean : save !!!! >>>=20 >>> Where is the issue ? How Can I put the order object into the message >>> that >>> Camel will send to bean : save >>>=20 >>> Regards, >>>=20 >>> Charles >>> --=20 >>> View this message in context: >>> http://www.nabble.com/How-can-I-set-the-content-of-the-body-when-I-left= -a-bean-and-before-to-go-to-the-next-bean---tp18282228s22882p18282228.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>=20 >>>=20 >>>=20 >>=20 >> --=20 >> View this message in context: >> http://www.nabble.com/How-can-I-set-the-content-of-the-body-when-I-left-= a-bean-and-before-to-go-to-the-next-bean---tp18282228s22882p18310870.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >>=20 >>=20 >>=20 >=20 > --=20 > View this message in context: > http://www.nabble.com/How-can-I-set-the-content-of-the-body-when-I-left-a= -bean-and-before-to-go-to-the-next-bean---tp18282228s22882p18312377.html > Sent from the Camel - Users mailing list archive at Nabble.com. >=20 >=20 >=20 --=20 View this message in context: http://www.nabble.com/How-can-I-set-the-conte= nt-of-the-body-when-I-left-a-bean-and-before-to-go-to-the-next-bean---tp182= 82228s22882p18313223.html Sent from the Camel - Users mailing list archive at Nabble.com.