Hi,

I would like to know if it is possible for a camel bean to call an
unmarshall/marshall endpoint/process (I don't know if it must be considerate
as an endpoint or process) from a Camel bean ?

In a normal routing, we call unmarshall/marshall like this :

  <route>
    <from uri="direct:start"/>
    <marshal ref="myJaxb"/>
    <to uri="direct:marshalled"/>
  </route>

What I would like to do is to declare marshal/unmarshal in a spring
DSL file (if it possible) and call it inside a bean ?
Why, because the payload to be marshalled/unmarshalled is part of an
object and I would like to keep this object during the pipeline route.

ex

<from uri=file://temp/data/>
<convertBodyTo type="java.io.String"/>
<bean ref="ServiceHelper" method="createRequest" /> // The Request
object is an object used by Hibernate and will contain the content of
the file. So this object cannot be unmarshalled/marshalled by its
content well
<bean ref="ServiceHelper" method="parseRequest" /> // Method who will
call the unmarshall/marshall endpoint / process defined in Spring DSL
file. This method send the string content to the endpoint
who will unmarshall by example the content into a collection of
Objects. The result is saved into the object Request
<bean ref=ServiceHelper" method="saveRequest"/>

because it is not possible to do this without loosing the Request object

<from uri=file://temp/data/>
<convertBodyTo type="java.io.String"/>
<bean ref="ServiceHelper" method="createRequest" />
<unmarshall ref="csbBindyDataFormat"/>
<bean ref=ServiceHelper" method="saveRequest"/>


Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com

Reply via email to