bryan wrote:
I was wondering if the following design was acceptable, or if there is a
better way of doing it. Currently I have a route that reads in a CSV, parses
it, and passes it to a bean. Inside the bean's method call, the CSV data is
converted to an object. The bean also has a reference to a camel spring
remoting proxy, and it calls a method on this and passes in the object. The
proxy adds a message to a queue.
I was concerned that I was calling the proxy from within the bean's route
method. This seems like it will start a new route from within the first
route. It seems to work fine, but wanted to make sure I wouldn't get bitten
by this down the road.
My route looks like this:
<camelContext id="camelContext">
<proxy id="myProxy"
serviceUrl="activemq:queue:myQueue?transferException=true"
serviceInterface="com.pkg.MyApi" />
<endpoint id="fileInput" uri="file:${my.file.dir}" />
<route>
<from ref="fileInput" />
<split parallelProcessing="false" streaming="true">
<tokenize token="\n" regex="false" />
<unmarshal><csv /></unmarshal>
<bean ref="inputBean" method="translate" />
</split>
</route>
</camelContext>
The inputBean has a reference to myProxy, and it calls a method on myProxy
inside the translate() method.
I think it should be OK, as the proxy and route are using the same camel
context, so the proxy can access the endpoints in the route without add
other additional work.
Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang