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

ServiceMix Scripting does not support all the features of the old one ( The lightweight )

    XMLWordPrintableJSON

Details

    Description

      The main point is that the old component ( as all the
      lightweight components extending TransformComponentSupport ) let you to
      trasparently manage the case of receiving an InOnly or InOut exchange.

      This let the user to write script file that are able to manage the output message in the script.

      With the old component:

      1) when it receive an InOnly exchange, after the script execution it provides to create automatically a new InOnly exchange with the content of the out message you set in groovy.

      2) when it receive an InOnly exchange,after the script execution it provides fill the output message with the content of the out message you set in groovy.

      At the moment only the 2) is supported by servicemix-scripting.

      Here the example:

      // DOM4j is in the cp
      import org.dom4j.*;
      import org.dom4j.xpath.*;

      // Get the input as a String and set the output content
      def String xmlInput = null;
      xmlInput = new String(inMessage.bodyText);

      def org.dom4j.Document document = DocumentHelper.parseText(xmlInput);
      parCustomerType = document.valueOf("/Customer/@customerType");

      def String decodedCustomerType = "GENERIC";

      if (parCustomerType == "1"){
      decodedCustomerType = "CUSTOMER_TYPE_1";
      }

      if (parCustomerType == "2"){
      decodedCustomerType = "CUSTOMER_TYPE_2";
      }

      outMessage.bodyText =
      "<DECODED_CUSTOMER_TYPE>"decodedCustomerType"</DECODED_CUSTOMER_TYPE>";

      Attachments

        Activity

          People

            lhein Lars Heinemann
            zoppello Andrea Zoppello
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: