Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 89198 invoked from network); 13 Jul 2008 06:13:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jul 2008 06:13:56 -0000 Received: (qmail 68728 invoked by uid 500); 13 Jul 2008 06:13:56 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 68701 invoked by uid 500); 13 Jul 2008 06:13:56 -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 68690 invoked by uid 99); 13 Jul 2008 06:13:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jul 2008 23:13:56 -0700 X-ASF-Spam-Status: No, hits=2.4 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [68.230.241.39] (HELO fed1rmmtao107.cox.net) (68.230.241.39) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Jul 2008 06:13:01 +0000 Received: from fed1rmimpo03.cox.net ([70.169.32.75]) by fed1rmmtao107.cox.net (InterMail vM.7.08.02.01 201-2186-121-102-20070209) with ESMTP id <20080713061323.WZPD29505.fed1rmmtao107.cox.net@fed1rmimpo03.cox.net> for ; Sun, 13 Jul 2008 02:13:23 -0400 Received: from [192.168.0.10] ([70.181.128.238]) by fed1rmimpo03.cox.net with bizsmtp id pJDP1Z00758l3T204JDPmf; Sun, 13 Jul 2008 02:13:23 -0400 Message-ID: <48799D04.5010801@cox.net> Date: Sat, 12 Jul 2008 23:13:24 -0700 From: Vadim Chekan User-Agent: Thunderbird 2.0.0.14 (X11/20080505) MIME-Version: 1.0 To: camel-user@activemq.apache.org Subject: Re: Deserializing mesage References: <4C1FB9C00D24A140906239533638C4D204BD8505@EXVS04.exserver.dk> In-Reply-To: <4C1FB9C00D24A140906239533638C4D204BD8505@EXVS04.exserver.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org As usually, I go my own way :) I got nice xml using xstream but now I'm trying to extract an element from it with xpath or xquery. Should I use process or transform and what is the difference between them? from("timer://kickoff?period=10000&delay=1"). process(new Processor() { public void process(Exchange exchange) throws Exception { ArrayList> ds = new ArrayList>(); HashMap h = new HashMap(); h.put("column1", "log body"); ds.add(h); exchange.getOut().setBody(ds); } }).marshal(). xstream(). process(xquery("/list")). //to("xmpp://vchekan@jabber.org/?password=fotokot&room=room33@conference.jabber.org"); to("xmpp://..........."); Vadim. Claus Ibsen wrote: > Hi > > As always with Camel there are several/many solutions. Some more elegant. > > 1) > Yes your own processor would do fine. List> is what you get from JDBC. It's a list of rows, where each row is a Map object with the JDBC column name as the string key, and the value is the Object. > > I would use my own processor to do my transformation to the string that XMPP expects. > > 2) > BTW: There is also the DataFormat solution where you can define your own data format and serialize/deserialize to/from this format. > http://activemq.apache.org/camel/data-format.html > > 3) > Or the type converter, then Camel will automatically pick it up and convert it. > > @Converter > public class MyConverter > @Converter > public static String convertToString(List> jdbcResult) { > ... > return string > } > Then you need a special marker file in the META-INF folder. Its all documented in the wiki. You can check out camel-core.jar to see this marker file. > > But I am not 100% sure the type converter solution will work as the type is a generic. > http://activemq.apache.org/camel/type-converter.html > > > Feedback on the documentation is highly appreciated. And if the generic type converter works also. > > > > Med venlig hilsen > > Claus Ibsen > ...................................... > Silverbullet > Skovsg�rdsv�nget 21 > 8362 H�rning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk > > -----Original Message----- > From: Vadim Chekan [mailto:vchekan@cox.net] > Sent: 11. juli 2008 04:18 > To: camel-user@activemq.apache.org > Subject: Deserializing mesage > > Hi all, > I'm trying to send message from jdbc to xmpp amd I'm getting > deserialization error. Jdbc creates a message of type > "ArrayList>" but xmpp expects a String. > Should I add my own Processor or there exist more elegant way to > transform an object into text or even better into xml? > > Vadim. >