ServiceMix 2 now enforces correct use of message exchanges.
You can refer to the jbi spec on pages 31 to 33 to have diagrams about the
different state of an exchange.
Following is a description of the in-only and in-out diagrams, when the
exchange succeeds.
Note that the exchange can also be set to an ERROR status, but in all
cases, it ends with
a DONE state, without any other informations conveyed : you can not set
the answer or
an error and the DONE state at the same time.
In-Only
o the consumer send the message in a ACTIVE state
o the provider receives the message and send it back with a DONE state
In-Out
o the consumer send the message in an ACTIVE state
o the provider receives the message, fill the response and send the
exchange back with an ACTIVE state
o the consumer receives the exchange, set the status to DONE and send it.
Cheers,
Guillaume Nodet
Matthew Clark wrote:
Craig - I am experiencing similar issues with setting status to DONE in
SM2.0... the code surrounding this area is quite hard to read so I
haven't worked out what is going on yet.. for some reason DONE is not in
the list of allowed statuses...
-----Original Message-----
From: Craig Walls [mailto:[EMAIL PROTECTED]
Sent: 10 November 2005 19:12
To: [email protected]
Subject: [servicemix-user] sendSync and SM 2.0
I have a client that sends a message like this:
InOut exchange = serviceMixClient.createInOutExchange();
NormalizedMessage message = exchange.getInMessage();
exchange.setService(new QName("myService"));
message.setProperty("someProperty", "someValue");
message.setContent(new StringSource("<question>How are
you?</question>"));
serviceMixClient.sendSync(exchange);
NormalizedMessage result = exchange.getOutMessage();
On the service-side, my onMessageExchange() method looks a little
something like this:
public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
NormalizedMessage out = exchange.createMessage();
out.setContent(new StringSource("<answer>I am fine</answer>"));
message.setMessage(out, "out"); // PAY ATTENTION
done(exchange); // TO THESE LINES
}
In ServiceMix 1.1, this worked fine. But since moving to ServiceMix
2.0, I
get an error indicating that I can't set the status to done. Fine, so
I
swapped out the commented lines above with:
message.setMessage(out, "out");
send(exchange);
Now my sendSync() never returns. On a hunch, I tried this instead:
answer(exchange, out);
Same effect. onMessageExchange() method completes on the service-side,
but
on the client-side, the sendSync() method never returns.
I'm certain that it's something that I'm doing wrong, but I'm not sure
what. Anybody see the problem? Please help!
This message has been scanned for viruses.