camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Can I call umarshall/marshall process/endpoint from a camel bean ?
Date Thu, 18 Jun 2009 08:41:21 GMT
Hi
The Data Format abstraction in Camel is a thin layer. So you could create
your own POJO layer you can invoke.
And in the impl of the POJO layer you more or less do the same as Camel
does, but without the Exchange as parameter.



On Thu, Jun 18, 2009 at 9:58 AM, Charles Moulliard <cmoulliard@gmail.com>wrote:

> 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
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message