I found a way to do this that i think is correct. The following is
what i came up with (parts borrowed from ScriptComponent):
public void onMessageExchange(MessageExchange exchange)
throws MessagingException {
NormalizedMessage in = exchange.getMessage("in");
Object payload = getBody(in);
// do something with it...
processPayload(payload);
if (isInAndOut(exchange)) {
NormalizedMessage out = exchange.createMessage();
exchange.setMessage(out, "out");
} else {
InOnly outExchange =
getExchangeFactory().createInOnlyExchange();
NormalizedMessage out = outExchange.createMessage();
setBody(out, payload);
outExchange.setInMessage(out);
getDeliveryChannel().sendSync(outExchange);
}
done(exchange);
}
I see that this seems to work fine, but I'd like to know if this is
correct. One thing that bothers me is that i have to do "sendSync"
but I think i want to just send. When I do that i get the following:
SEVERE: [EMAIL PROTECTED] Gor error
processing [EMAIL PROTECTED]
javax.jbi.messaging.MessagingException: illegal call to send
Thanks,
Jason
On Mar 20, 2006, at 10:37 AM, Jason Vinson wrote:
Hi,
I'm very new to servicemix, but I have a question about what is the
best approach to start writing "service engines" to use in a
servicemix esb. My first thought is to write a class that extends
PojoSupport and implements MessageExchangeListener, but I wanted to
find out from the experts if this is the desired implementation.
I've also been drawn towards the TransformComponentSupport class,
which I suppose could be used to plug in a service as well, but the
name implies that it's to be used for transformation, not service
execution. Could I get some info regarding this, or at least
pointers to a clear tutorial on this concept?
Thanks so much,
Jason