TransformBeanSupport doesn't manage properly fault message when used in Sync 
mode
---------------------------------------------------------------------------------

                 Key: SM-1604
                 URL: https://issues.apache.org/activemq/browse/SM-1604
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-bean
            Reporter: Gianfranco Boccalon


The component sends always a Done message, even if it receives a fault, with 
the sendSync method.

I provide a patch to TransformBeanSupport, to send a fault (or error) message 
if the result of the sendSync is a fault message.
I don't provide a diff file because I have problems accessing the sources on 
SVN.

This is the code I changed in the onMessageExchange method.

            if (transform(exchange, in, out)) {
                if (isInAndOut(exchange)) {
                    exchange.setMessage(out, "out");
                    if (txSync) {
                        getDeliveryChannel().sendSync(exchange);
                    } else {
                        getDeliveryChannel().send(exchange);
                    }
                } else {
                    outExchange.setMessage(out, "in");
                    if (txSync) {
                        getDeliveryChannel().sendSync(outExchange);
                        
                        // HERE THE PATCH BEGINS
                        // Check result
                        if (outExchange.getStatus() == ExchangeStatus.DONE) {
                                log.debug("["+exchange.getExchangeId()+"] | 
sendSync-> Received a DONE STATUS AS RESPONSE");
                            exchange.setStatus(ExchangeStatus.DONE);
                            getDeliveryChannel().send(exchange);
                        // Errors must be sent back to the consumer
                        } else if (outExchange.getStatus() == 
ExchangeStatus.ERROR) {
                                log.debug("["+exchange.getExchangeId()+"] | 
sendSync-> Received an ERROR STATUS AS RESPONSE -> fail");
                            fail(exchange, outExchange.getError());
                        } else if (outExchange.getFault() != null) {
                                log.info("["+exchange.getExchangeId()+"] | 
sendSync-> Received a FAULT AS RESPONSE -> fail");
                                fail(exchange, outExchange.getError());
                        }
                        // HERE THE PATCH END

                    } else {
                        getDeliveryChannel().send(outExchange);

                        // HERE THE PATCH BEGINS
                        exchange.setStatus(ExchangeStatus.DONE);
                        getDeliveryChannel().send(exchange);
                        // HERE THE PATCH END

                    }
                }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to