Skip to content

Instantly share code, notes, and snippets.

@mcantrell
Last active December 17, 2015 12:19
Show Gist options
  • Save mcantrell/5608833 to your computer and use it in GitHub Desktop.
Save mcantrell/5608833 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc"
xmlns:imaps="http://www.mulesoft.org/schema/mule/imaps" xmlns:context="http://www.springframework.org/schema/context"
xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/imaps http://www.mulesoft.org/schema/mule/imaps/current/mule-imaps.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd
http://www.mulesoft.org/schema/mule/sfdc http://www.mulesoft.org/schema/mule/sfdc/5.0/mule-sfdc.xsd">
<!-- you'll need to create your own conf.properties in src/main/resources
to match your environment -->
<context:property-placeholder location="classpath:conf.properties" />
<spring:beans>
<spring:bean name="emailToSalesForceContactList"
class="com.confluex.cookbook.transformer.EmailToSalesForceContactsList" />
</spring:beans>
<imaps:connector name="imapsConnector" checkFrequency="5000"
deleteReadMessages="false" doc:name="IMAP" />
<sfdc:config name="Salesforce" username="${sf.user}"
password="${sf.password}" securityToken="${sf.token}" doc:name="Salesforce">
<sfdc:connection-pooling-profile
initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW" />
<reconnect-forever />
</sfdc:config>
<flow name="sync-email-contacts-to-salesforce" doc:name="sync-email-contacts-to-salesforce">
<imaps:inbound-endpoint host="${imap.host}"
port="${imap.port}" user="${imap.user}" password="${imap.password}"
responseTimeout="10000" doc:name="IMAP" />
<expression-filter
expression="#[message.inboundProperties.subject == &quot;Receipt&quot;]"
doc:name="Filter non-receipts" />
<transformer ref="emailToSalesForceContactList" doc:name="Convert to Customer" />
<logger message="Upsert contacts: #[payload]" level="INFO"
category="SyncEmailContactsToSalesForce" doc:name="Log Contact Info" />
<sfdc:upsert config-ref="Salesforce" doc:name="Salesforce"
externalIdFieldName="OriginalEmail__c" type="Contact">
<sfdc:objects ref="#[payload]" />
</sfdc:upsert>
<logger message="SalesForce account updated: #[payload]" level="INFO"
category="SyncEmailContactsToSalesForce" doc:name="Log Status" />
</flow>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment