Search code examples
muleanypoint-studio

Mule Flow setup, Payload, Java component


Mule : Could you please help following query : In Anypoint Mule IDE, How to assign values to a Payload like this "Value1|Value2|Value3|Value4|.." ? and then assign the payload to Java component in Mule?

I tried following approach: (1) define Java component and return String object as output (by implementing callable method as below):

public class InputToJavaComponent implements Callable {

@Override
public Object onCall(MuleEventContext eventContext) throws Exception {

    return "Value1|Value2|Value3";
}

I was checking if is there any other simple way to achieve same thing.

Thanks.


Solution

  • Both approaches as follow works fine: (1)

    @Override
    public Object onCall(MuleEventContext eventContext) throws Exception {
        return "Value1|Value2|Value3";
    }
    

    (2)

    [flowVars.Value1+'|']#[flowVars.Value2+'|']#[flowVars.Value3+'|']#[flowVars.Value4]