Skip to content

Instantly share code, notes, and snippets.

@rossmason
rossmason / mule-twitter-poll.xml
Created January 11, 2011 06:18
A Polling Twitter snippet for Mule Cloud Connect
<twitter:config name="jsontwitter" format="JSON"
consumerKey="${twitter.consumer.key}" consumerSecret="${twitter.consumer.secret}"/>
<flow name="twiiter-search">
<poll frequency="5000">
<twitter:search query="mule" config-ref="jsonTwitter" />
</poll>
</flow>
<twitter:config name="jsontwitter" format="JSON"
consumerKey="${twitter.consumer.key}"
consumerSecret="${twitter.consumer.secret}"/>
<flow name="orderProcessingFlow">
<inbound-endpoint ref="orderEndpoint"/>
<enricher target="#[variable:state_short]">
<outbound-endpoint ref="stateLookup">
<expression-transformer evaluator="xpath" expression="/order/address/zip" />
</outbound-endpoint>
</enricher>
<outbound-endpoint ref="orderStep2"/>
</flow>
<logger message="just processed foo" level="DEBUG" />
<logger message="Ooops! #[payload] is an invalid message!" level="ERROR" />
<logger message="Accept Header is #[header:INBOUND:Accept]" level="INFO" />
<?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:http="http://www.mulesoft.org/schema/mule/http"
xmlns:amqp="http://www.mulesoft.org/schema/mule/amqp"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.1/mule-file.xsd
<bridge name="nasdaqCompositePoller" exchange-pattern="one-way">
<poll frequency="360000">
<outbound-endpoint address="${nasdaq.composite.feed.url}" />
</poll>
<amqp:outbound-endpoint ref="financialExchange"
routingKey="stockmarket.nasdaq.composite" />
</bridge>
<flow name="choiceFlow">
<description>
Flow that shows the use of the choice element for content-based routing
<description>
<jms:inbound-endpoint queue="in"/>
<choice>
<when expression="/element/@name = 'foo'" evaluator="xpath">
<jms:outbound-endpoint queue="fooQueue"/>
</when>
<when expression="/element/@name = 'bar'" evaluator="xpath">
<?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:file="http://www.mulesoft.org/schema/mule/file"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.1/mule-file.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.1/mule-jms.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
xmlns:jms="http://www.mulesource.org/schema/mule/jms/2.2"
xsi:schemaLocation="
http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd
http://www.mulesource.org/schema/mule/jms/2.2 http://www.mulesource.org/schema/mule/jms/2.2/mule-jms.xsd">