Uploaded image for project: 'ServiceMix Components'
  1. ServiceMix Components
  2. SMXCOMP-228

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

    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      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 }

      }

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            gboccalon Gianfranco Boccalon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: