But if I had a method as follows
public class Bar {
public String doSomething(Exchange exchange) {
// process the exchange
String newFileName=SprringService.generateFileName();
exchange.getIn().setBody("Bye World");
return newFileName;
}
}
Would this be possible?
If so how would the route be written in Java and XML ??
Thanks,
Franklin.
willem.jiang wrote:
>
> Hi Frank
>
> Basically if you want to set the result object back into message body,
> you just need to return that result object in your method, camel-bean
> will take care of it.
>
> BTW, you can also pass the Exchange into your bean's method like this
> so you can set the result object yourself.
> public class Bar {
>
> public void doSomething(Exchange exchange) {
> // process the exchange
> exchange.getIn().setBody("Bye World");
> }
> }
>
> You can find more information about how to use bean in camel here [1][2]
> [1] http://activemq.apache.org/camel/bean.html
> [2] http://activemq.apache.org/camel/bean-binding.html
>
> Willem
>
> Franklin Antony wrote:
>> Thanks Willem. It did clear the confusion.
>>
>> My having my own spring bean I can decouple from Camel code and this I
>> would
>> prefer.
>>
>> However is it possible that I can get back a ResultObject from
>> "mySpringBean" which I would like to pass on to another <to> location?
>>
>> Thanks,
>> Franklin.
>>
>>
>> willem.jiang wrote:
>>> I think Claus just show two ways to combine your transformation business
>>> logic with the spring xml configuration.
>>> The spring configuration could be
>>> <from url="COSUME_XML_URL"/>
>>> <to url="bean:mySpringBean?method=transformation"/>
>>> <to url="mail:xxx"/>
>>> or
>>> <from url="COSUME_XML_URL"/>
>>> <process ref="mySpringBeanThatImplementsProcessor"/>
>>> <to url="mail:xxx"/>
>>>
>>>
>>> mySpringBeanThatImplementsProcessor and mySpringBean have nothing to
>>> relate. They just implement the same transformation business logic.
>>>
>>> Willem
>>>
>>> Franklin Antony wrote:
>>>> And the processor as:
>>>> <process ref="mySpringBeanThatImplementsProcessor"/>
>>>>
>>>> And then you need the regular spring beans configuration in spring as
>>>> well
>>>> to link to the actual class file
>>>> <bean id="mySpringBeanThatImplementsProcessor" class="xxx.yyy"/>
>>>> <bean id="mySpringBean" class="xxx.yyy.zzz"/>
>>>>
>>>> mySpringBean is just a regular POJO that doesn't have to have import
>>>> any
>>>> camel classes.
>>>>
>>>>
>>>>
>>>> How is mySpringBeanThatImplementsProcessor and mySpringBean related ??
>>>>
>>>> Thanks,
>>>> Franklin
>>>
>>>
>>
>
>
>
--
View this message in context:
http://www.nabble.com/Transformation-task-in-Spring-tp18647141s22882p20828353.html
Sent from the Camel - Users mailing list archive at Nabble.com.