Studio Visual Editor
-
Drag a Poll scope onto the canvas.
-
Drag an element inside the poll scope, for example a Twitter connector. Mule uses this message processor to regularly poll the Twitter API for new data to process.
-
Configure the Twitter Connector
Attribute Value Description Operation
Get user timeline by screen name
Captures recent tweets by a particular Twitter user
Screen Name
MuleSoft
Return tweets by the official MuleSoft account. You can use any Twitter account you want.
config reference
Twitter
You must create a Twitter connector as a [global element] to reference here. For your Twitter connector, you need a Twitter developer account.
-
Add more message processors to your flow to perform specific business logic after polling for data. The example below uses a logger component. This [logger] uses the [MEL] expression
#[payload]
to log the message payload collected by the Twitter connector every 1000 milliseconds.
XML Editor or Standlone
-
Add a Poll element to your flow.
Element Description Sample XML poll
Polls an element at regular intervals
<poll frequency="1000"doc:name="Poll">
Attribute Name Value Description Sample XML frequency
integer
The interval, in milliseconds, between calls
frequency="1000"
doc:name
string
(Studio Only) Display a unique name for the poll scope in your application.
doc:name="Poll"
-
Add Twith connector as child element of the poll element.
Child Element Description Sample XML twitter:<operation>
Connects to Twitter. The "operation" is the activity Twitter performs. In the example at right, show recent tweets by a particular Twitter user.
<twitter:get-user-timeline-by-screen-name config-ref= "Twitter" screenName= "mulesoft" doc:name= "Twitter" />
Attribute Name Value Description XML screenName
string
Twitter account to return tweets from. In this example, the official MuleSoft account; you can use any valid Twitter account.
screenName="MuleSoft"
config-ref
string
You must create a Twitter connector as a [global element] to reference here. For your Twitter connector, you need a Twitter developer account.
config-ref="Twitter"
doc:name
string
(Studio only) Name of the poll scope as it will be displayed in your application.
doc:name"Twitter"
-
Add more message processor to your flow to perform specific business logic after polling for data. The example below uses a [logger] component. This logger uses the MEL expression
#[payload]
to log the message payload collect by the Twitter connector every 1000 milliseconds.Element Description Sample XML logger
Logs the message payload
<logger message="#[payload]"level="INFO"doc:name="Logger"/>
Attribute Name Value Description message
string or [Mule expression]
The content that will be logged to console. In this case, the Mule Expression
#[payload]
will output the message payload.level
string, on of ERROR, WARN, INFO, DEBUG, or TRACE
The priority level of the notification, in this case
INFO
.doc:name
string
(Studio only) Name of the logger component as it will appear in your application.