Have you tried using the Jackson library instead of Xstream? There is Jackson support in camel greater than 2.0 (http://camel.apache.org/json.html). I haven't used the Camel Jackson component but if it works anything like the regular jackson libraries it should be straight forward with no annotations/config for most POJOs. Alternatively, you could just serialize your POJOs to JSON using the Jackson Library (http://jackson.codehaus.org/) and a custom processor bean. And while you are looking at serialization you might want to check out how the different serializers perform: https://github.com/eishay/jvm-serializers/wiki/.
-josh On 12/04/2011 22:25, "Gert Villemos" <gville...@yahoo.de> wrote: >I have problems understanding how the cometd component publish objects. > >I have my own class called 'Parameter'. I want to publish instances of >'Parameter' through cometd to a website. I would expect the data arriving >through cometd to have a structure similar to my Parameter definition. > >However the only thing that arrives is a single field, holding the a value >like >"org.hbird.business.simpleparametersimulator.ConstantParameter@3da03ade", >i.e. it seems the object is transformed to a string using a simple >toString >call. All field information is lost. Not very useful. > >Is there a way to transform any POJO to a format (Map?) that can be >transfered using cometd, keeping the information in the POJO? > >My route looks like; > > > > > > > > >I have tried inserting a Xstream data transformer in the route. Indeed I >receive a different set of data, but its an array of 160 integers, not a >structure reflecting the structure of my 'Parameter' class as I had >expected. > >I know that I can create bean that converts the 'Parameter' instance into >a >Map and put this into the body prior to sending the data over cometd. >However I then have to create a 'formatter' per data type. I had hoped to >have a generic formatter. > >What am I doing wrong? > >-- >View this message in context: >http://camel.465427.n5.nabble.com/Cometd-component-tp4299174p4299174.html >Sent from the Camel - Users mailing list archive at Nabble.com.