Hi all,

we are trying to send a message synchronously to a JSR181 component and
return a particular value through the java method, which is attached to the
JSR181 component. Everything works fine as long as the context from which we
are sending is not transactional. If it is, the bus answers with an
exception stating that no suitable flow could be found.

>From what I understand from the code (in Jsr181ExchangeProcessor), the
response is just sent to the caller using the send() method. However, I am
under the impression that it should be sent using sendSync() rather than
send(). Apparently, it does not matter once the transfer is not
transactional, however if it is, special care has to be taken. I feel it
should be something like this:

(File: Jsr181ExchangeProcessor.java)

        // Set response or DONE status
        if (isInAndOut(exchange)) {
            if (ctx.getExchange().hasFaultMessage() &&
ctx.getExchange().getFaultMessage().getBody() != null) {
                Fault fault = exchange.createFault();
                fault.setContent(new StringSource(out.toString()));
                exchange.setFault(fault);
            } else {
                NormalizedMessage outMsg = exchange.createMessage();
                outMsg.setContent(new StringSource(out.toString()));
                exchange.setMessage(outMsg, "out");
            }
// send mode depends on the transactional flag (transactional is taken from
the properties elsewhere).
            if (transactional) {
                channel.sendSync(exchange);
            } else {
                channel.send(exchange);
            }
        } else {
// if we are in-only, just don't care and use send()
            exchange.setStatus(ExchangeStatus.DONE);
            channel.send(exchange);
        }


What do you think?

Best regards
Martin

BTW: This is 3.0-code. It looks different in 3.1 but the actual problem is
the same.
-- 
View this message in context: 
http://www.nabble.com/Possible-problem-in-JSR181--tf2580861s12049.html#a7194322
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to