2009/10/23 Paul Phillips <[email protected]>:
>
> Hi there
>
> bit of a beginner question here.
>
> I have a situation where I want to
>
> - get some xml from a jms queue
> - send an id contained in the xml to a custom component i have written (the
> body of the request should be a string that looks like this: "ID=blah", so I
> use a bean to grab the id using xpath and change the body of the exchange)
> - this will return a message with a body that looks like "MATCHED=TRUE" or
> something
> - if MATCHED=TRUE then I want to send some xml to a different endpoint.
BTW you can do the above like this...
public class MyBean {
@Consume(uri="activemq:SomeQueue")
pubilc void onXml(@XPath("/foo/ID") String myID, Document restOfBody) {
// return the transformed payload
return "MATCHED=TRUE"
}
}
Notice Camel can do the XPath for you and inject the ID parameter to
your transformer method (myID) - also notice the lack of any
middleware APIs etc.
for more details see
http://camel.apache.org/pojo-consuming.html
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/