Hi
Yeah use a BEAN and send the body using ProducerTemplate, then it really should
be a new exchange.
> from("jbi:service:http://www.mycompany.org/xstreamService")
> .convertBodyTo(String.class).to("bean:myBean")
You then configure myBean in the registry (eg spring xml)
<bean id="myBean" class="..."/>
If you don't know how to get a ProducerTemplate injected then see for instance
the AXIS tutorial:
http://activemq.apache.org/camel/tutorial-axis-camel.html
You can also use annotations to get it injected
And in MyBean
public void doSomething(String body) {
...
producer.sendBody("seda:foo", body);
}
Or use Exchange as the parameter and get the camel context from that one and
invoke createProducerTemplate
public void doSomething(Exchange exchange) {
exchanage.getCamelContext().createProducerTeamplate()
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: raulvk.soa [mailto:[EMAIL PROTECTED]
Sent: 23. oktober 2008 14:23
To: [email protected]
Subject: RE: XStream with JBI
Hi Claus,
Just tried it and it still continues being a JbiMessage with a
NormalisedMessageImpl objects as the in message.
Any other ideas?
Claus Ibsen wrote:
>
> Hi
>
> You can send the jbi stuff to a seda queue, and then poll the seda queue
> in a 2nd route. Then it should be a new Exchange and a Camel exchange as a
> org.apache.camel.impl.DefaultExchange object.
>
>
> from("jbi:service:http://www.mycompany.org/xstreamService")
> .convertBodyTo(String.class).to("seda:foo")
>
> From("seda:foo")...
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: raulvk.soa [mailto:[EMAIL PROTECTED]
> Sent: 23. oktober 2008 13:48
> To: [email protected]
> Subject: Re: XStream with JBI
>
>
>
> XStream does not throw any exception (probably because it does its
> processing well and it returns the generated object). However, the object
> returned by XStream is not set as the IN message because it is not XML.
> When
> iBATIS receives the message, it throws an exception because the Body is
> NULL.
>
> I have created the following test to illustrate this behaviour:
>
>
> XStream xst = new XStream();
> xst.alias("Person", Person.class);
> XStreamDataFormat xstdf = new XStreamDataFormat();
> xstdf.setXStream(xst);
>
>
> from("jbi:service:http://www.mycompany.org/xstreamService")
> .convertBodyTo(String.class).process(new Processor() {
> public void process(Exchange exchange) throws
> Exception {
>
> System.out.println("11111111-------------------->>>>>> " +
> exchange.getIn());
> if (exchange.getIn() != null)
> System.out.println("::::: Body:
> " + exchange.getIn().getBody());
> else
> System.out.println("::::: Body
> IS NULL");
> }
> })
> .unmarshal(xstdf).process(new Processor() {
> public void process(Exchange exchange) throws
> Exception {
>
> System.out.println("22222222-------------------->>>>>> " +
> exchange.getIn());
> if (exchange.getIn() != null)
> System.out.println("::::: Body:
> " + exchange.getIn().getBody());
> else
> System.out.println("::::: Body
> IS NULL");
> }
> })
>
>
> Basically, this is what happens:
> - before XStream --> the in message is of type NormalisedMessageImpl,
> and
> the body is of type DOMSource.
> - after XStream --> the in message is of type NormalisedMessageImpl,
> and
> the body is NULL.
>
> Basically, a solution that comes to mind is to convert the JbiExchange to
> a
> standard Camel Exchange... but where can I do this? I can't do this in a
> Processor, because it wont allow me to SUBSTITUTE the exchange itself....
>
> Any ideas?
>
>
>
> Gert Vanthienen wrote:
>>
>> L.S.,
>>
>> What is the exception or error you are getting? We should definitely
>> support this use case out-of-the-box...
>>
>> Regards,
>>
>> Gert
>>
>> raulvk.soa wrote:
>>> Hi,
>>>
>>> I am using Camel embedded in ServiceMix. My camel route receives a JBI
>>> message, turns it into a Java Object by using XStream and then passes it
>>> on
>>> to iBATIS.
>>>
>>> However, I am facing problems with the XStream processing. I suspect
>>> that
>>> these are derived from the fact that the underlying Camel Exchange is
>>> actually a JbiExchange which only accepts XML as the in and out body
>>> messages.
>>>
>>> Therefore, I need to get rid of all the Jbi stuff and simply use a
>>> standard
>>> Camel Exchange which will allow me to set an Object as the in message.
>>>
>>> Is it possible to do so out of the box?
>>>
>>> Thanks!
>>>
>>
>>
>>
>> -----
>> ---
>> Gert Vanthienen
>> http://gertvanthienen.blogspot.com
>>
>
> --
> View this message in context:
> http://www.nabble.com/XStream-with-JBI-tp20129124s22882p20129325.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
--
View this message in context:
http://www.nabble.com/XStream-with-JBI-tp20129124s22882p20129812.html
Sent from the Camel - Users mailing list archive at Nabble.com.