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

                 Key: SM-1689
                 URL: https://issues.apache.org/activemq/browse/SM-1689
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-scripting
    Affects Versions: servicemix-script-2008.01
            Reporter: Andrea Zoppello


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>";

-- 
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