On 09/04/2008, Glen Mazza <[EMAIL PROTECTED]> wrote:
>
> Am Mittwoch, den 09.04.2008, 11:04 +0100 schrieb James Strachan:
>
> > On 09/04/2008, Glen Mazza <[EMAIL PROTECTED]> wrote:
> > > Thanks Willem, one more question, looking at the sample code you linked
> > > to below:
> > >
> > > public void testInvokingJawsServerWithParams() throws Exception {
> > > CxfExchange exchange =
> > > (CxfExchange)template.send(getJaxwsEndpointUri(), new Processor() {
> > > public void process(final Exchange exchange) {
> > > final List<String> params = new ArrayList<String>();
> > > params.add(TEST_MESSAGE);
> > > exchange.getIn().setBody(params);
> > > exchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
> > > GREET_ME_OPERATION);
> > > }
> > > });
> > >
> > > org.apache.camel.Message out = exchange.getOut();
> > > Object[] output = (Object[])out.getBody();
> > > LOG.info("Received output text: " + output[0]);
> > > assertEquals("reply body on Camel", "Hello " + TEST_MESSAGE,
> > > output[0]);
> > > }
> > >
> > > The "params" in "exchange.getIn().setBody(params);" above will come from
> > > the numbers being fed to the queue, with one web service call for each
> > > number fed in. But how can I access (obtain) the numbers being fed into
> > > the queue from within that process(final Exchange exchange) override
> > > above?
> >
> > You can access the parameters (i.e. message body) via
> >
> > exchange.getIn().getBody();
> >
>
>
> (Newbiespeak) So what you're saying here is that once I set a route from
> the message queue to the web service, the Exchange parameter passed into
> the web service will be already be prepopulated with the number
> (getBody()) that was passed into the queue? If so, cool!
Yeah, kinda :)
So if you just did
from("activemq:SomeQueue").process(new Processor() {
public void process(Exchange exchange) {...}
};
then inside the process method the Exchange.getIn().getBody() would be
the payload of the JMS message. So the Object from an ObjectMessage or
the text from a TextMessage etc.
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com