Skip to content

Instantly share code, notes, and snippets.

View estebanroblesluna's full-sized avatar

Esteban Robles Luna estebanroblesluna

View GitHub Profile
<jms:activemq-connector name="jmsConnector" />
<flow name="approve-flow">
<jms:inbound-endpoint queue="approveQueue" />
<activiti:set-variable executionIdExpression="#[groovy:payload.id]"
variableExpression="#[string:approvedBy]" valueExpression="#[header:INBOUND:username]" />
<activiti:signal executionIdExpression="#[groovy:payload.id]" />
</flow>
<flow name="tweet-from-activiti">
<vm:inbound-endpoint path="tweetFromActiviti" exchange-pattern="request-response" />
<twitter:update-status status="#[payload]"/>
</flow>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="processOrderWithTweetPublish" >
<startEvent id="theStart" />
<sequenceFlow sourceRef="theStart" targetRef="processOrderAndTweet" />
<twitter:config name="twitter" format="JSON"
consumerKey="Ng3f..." consumerSecret="PMjQVRew..."
oauthToken="296154332..."
oauthTokenSecret="fsdf..."/>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="processLead" >
<startEvent id="theStart" />
<sequenceFlow sourceRef="theStart" targetRef="createSalesforceContact" />
<flow name="create-contact">
<vm:inbound-endpoint path="createSalesforceContactFromActiviti" exchange-pattern="request-response" />
<custom-processor class="org.mule.module.activiti.SplitAndSetFieldsProcessor" />
<sfdc:create type="Contact">
<sfdc:sObject>
<sfdc:field key="FirstName" value="#[header:OUTBOUND:FirstName]"/>
<sfdc:field key="LastName" value="#[header:OUTBOUND:LastName]"/>
<sfdc:field key="Email" value="#[header:OUTBOUND:Email]"/>
<sfdc:field key="Title" value="#[header:OUTBOUND:Title]"/>
<sfdc:field key="Phone" value="#[header:OUTBOUND:Phone]"/>
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];
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="processOrder" >
<startEvent id="theStart" />
<sequenceFlow sourceRef="theStart" targetRef="waitState" />
public class AddAttachmentMessageProcessor implements MessageProcessor
{
@Override
public MuleEvent process(MuleEvent event) throws MuleException
{
Collection<Attachment> attachments = new ArrayList<Attachment>();
AttachmentImpl attachment = new AttachmentImpl("1");
String attachmentXML = "";