If you receive a synchronous transactional exchange, you
need to answer using sendSync, so that the transaction
is also conveyed synchronously back to the consumer
component.
You can check if the jbi exchange is synchronous and transacted
with the following code:
boolean txSync = exchange.isTransacted() &&
Boolean.TRUE.equals(exchange.getProperty(JbiConstants.SEND_SYNC));
If txSync is true, you MUST use sendSync to send the answer.
On 9/20/06, Martin Landua <[EMAIL PROTECTED]> wrote:
Hi,
I have written a polling component which generates messages that it is
sending to its delivery channel synchronously. It operates on a InOut
Message Exchange.
Also, I have created an OutBinding component, which is supposed to create an
answer to the message that it receives. The answer is being sent through the
answer method of the OutBinding component.
Now it appears to me that everything works fine as long as the polling
component does not create a transaction. If it does, the answer() method
actually throws an exception, because it cannot find an appropriate flow
that can handle this message exchange.
From what I can tell from the sources, the SedaFlow checks whether it can
handle a ME. And it does it like this:
public boolean canHandle(MessageExchange me) {
if (isPersistent(me)) {
return false;
}
if (isClustered(me)) {
return false;
}
if (isTransacted(me)) {
if (!isSynchronous(me)) {
// we have the mirror, so the role is the one for the target
component
if (me.getStatus() == ExchangeStatus.ACTIVE) {
return false;
}
}
}
return true;
}
The problem here is that the answer() method actually clears the SEND_SYNC
property, therefore the ME appears to be async although it is not. And why
does this test only happen when transactions are enabled?
Am I using the wrong flow?
Please note that I'm running ServiceMix in JBoss using the JBoss deployer
(all built from SVN-Head).
Any advice?
Cheers
Martin
--
View this message in context:
http://www.nabble.com/Answering-synchronous-transactional-InOut-MEP-tf2307890.html#a6416047
Sent from the ServiceMix - User mailing list archive at Nabble.com.
--
Cheers,
Guillaume Nodet