Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class SplitAndSetFieldsProcessor implements MessageProcessor
{
private static String[] fields = new String[] {"FirstName", "LastName", "Email", "Title", "Phone"};
public MuleEvent process(MuleEvent event) throws MuleException
{
String[] values = event.getMessageAsString().split(",");
for (int i = 0; i < values.length; i++)
{
String value = values[i];
event.getMessage().setProperty(fields[i], value, PropertyScope.OUTBOUND);
}
return event;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment