Skip to content

Instantly share code, notes, and snippets.

@johndemic
Created January 10, 2012 14:28
Show Gist options
  • Save johndemic/1589341 to your computer and use it in GitHub Desktop.
Save johndemic/1589341 to your computer and use it in GitHub Desktop.
Mule configuration that generates an event-stream from the Twitter timeline and performs analysis of the hashtags
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:twitter="http://www.mulesoft.org/schema/mule/twitter"
xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:esper="http://www.mulesoft.org/schema/mule/esper"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/3.2/mule-quartz.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
http://www.mulesoft.org/schema/mule/esper http://www.mulesoft.org/schema/mule/esper/1.0/mule-esper.xsd
http://www.mulesoft.org/schema/mule/twitter http://www.mulesoft.org/schema/mule/twitter/2.0/mule-twitter.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<description>
Esper Cloud Connector example using Twitter
</description>
<esper:config configuration="esper-config.xml"/>
<twitter:config consumerKey="${twitter.key}"
consumerSecret="${twitter.secret}"/>
<flow name="main">
<quartz:inbound-endpoint repeatInterval="60000" startDelay="0" jobName="tweetPoller" >
<quartz:event-generator-job/>
</quartz:inbound-endpoint>
<twitter:get-public-timeline/>
<collection-splitter/>
<esper:send eventPayload-ref="#[payload:]"/>
</flow>
<flow name="Event Listener Flow">
<esper:listen statement="select * from Tweets as tweet,Tweets[hashtagEntities] as tag
where tag.text = 'mule'"/>
<logger level="INFO" message="*** MATCHING TWEET: #[groovy:payload['tweet'].text"/>
</flow>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment