This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Animal { | |
private String name; | |
public Animal(){ | |
name="maxMule"; | |
} | |
public Animal(String name){ | |
this.name=name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OnCallClass implements Callable { | |
@Override | |
public Object onCall(MuleEventContext eventContext) throws Exception { | |
eventContext.getMessage().setProperty("surname", "Martinez", PropertyScope.SESSION); | |
System.out.println("Session Variable updated \n"); | |
System.out.println("Returning Animal Object in the payload"); | |
return new Animal(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="usingCallable"> | |
<http:listener config-ref="HTTP_Listener_Configuration" path="/onCall" doc:name="HTTP" allowedMethods="GET" /> | |
<component class="javacall.OnCallClass" doc:name="Java" /> | |
<object-to-string-transformer doc:name="Object to String" /> | |
</flow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MessageProcessorCall implements MessageProcessor{ | |
@Override | |
public MuleEvent process(MuleEvent event) throws MuleException { | |
System.out.println("\n-------Process Executing, updating payload-------"); | |
event.getMessage().setPayload("Payload Modified from Message processor"); | |
System.out.println("\n-------Process executed, payload updated-------"); | |
return event; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="usingCustomMessageProcessor"> | |
<http:listener config-ref="HTTP_Listener_Configuration" path="/customMessage" doc:name="HTTP" allowedMethods="GET"/> | |
<custom-processor class="javacall.MessageProcessorCall" doc:name="Custom Processor"/> | |
<object-to-string-transformer doc:name="Object to String"/> | |
</flow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnimalTransformer extends AbstractMessageTransformer{ | |
public Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException { | |
String flowVarName = message.getProperty("flowVarName", PropertyScope.INVOCATION); | |
Animal animal=new Animal(flowVarName); | |
return animal; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="usingTransformer"> | |
<http:listener config-ref="HTTP_Listener_Configuration" path="/transformer" allowedMethods="GET" doc:name="HTTP"/> | |
<set-variable variableName="flowVarName" value="#['Max the Mule']" doc:name="Variable"/> | |
<custom-transformer returnClass="model.Animal" class="javacall.AnimalTransformer" doc:name="Java"/> | |
<object-to-string-transformer doc:name="Object to String"/> | |
</flow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ContainsTransformerMethods | |
public class AnimalTransformerAnnotation { | |
@Transformer | |
public Animal returnAnimal(@Payload String name){ | |
return new Animal(name); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="usingTransformerAnnotation"> | |
<http:listener config-ref="HTTP_Listener_Configuration" path="/transformerAnnotation" doc:name="HTTP" allowedMethods="GET"/> | |
<set-payload value="#['Annotated Max!']" doc:name="Set Payload"/> | |
<component class="javacall.AnimalTransformerAnnotation" doc:name="Java"/> | |
<object-to-string-transformer doc:name="Object to String"/> | |
</flow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration doc:name="Configuration"> | |
<expression-language> | |
<global-functions> | |
def dayOfTheMonth(date){ | |
import java.util.Calendar; | |
import java.text.SimpleDateFormat; | |
cal = Calendar.getInstance(); | |
sdf = new SimpleDateFormat('yyyyMMdd'); |
OlderNewer