Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Message Sources and Message Processors

Mule 3 provides two different constructs that can be used to build applications:

  • Flows. A flow is a combination of message sources and message processors that doesn’t have a fixed format. It can be as simple or as complex as required, and can include, for instance, processing by multiple components before any output is performed.

  • Configuration Patterns. A configuration pattern is like a pre-built flow: the logic is already built into it, so that only some simple tailoring is needed to make it functional.

A Mule application can contain any or all of these.

Within flows, the streamlined architecture of Mule 3 allows Transformers, Filters, Components, Routers and other message processing artifacts to be used, and nested, freely as required. They all implement a common MessageProcessor interface and can be used interchangeably.

Here you’ll find information about the different building blocks provided by Mule presented in categories.

Message Sources

MessageEndpointIcon

A message source receives or generates new messages to be processed by Mule. Mule supports the following types of message sources:

Inbound Endpoints

Inbound Endpoints receive new messages from a channel or resource by using a server socket, polling a remote socket or resource, or by registering a listener.

For information about available transports see Connecting Using Transports

For information about configuring endpoints see Configuring Endpoints

Polls

Rather than using an inbound endpoint you can poll any message processor and use the result as the source of your flow. A frequency in milliseconds can be configured otherwise the default of 1s is used. Examples of things you can poll are outbound-endpoints, other flows or processor chains or any message processor.

To configure polling use the <poll> element instead of an inbound endpoint.


          
       
1
2
3
4
5
6
7
<flow name="myFlow">
   <poll frequency="2000">
        <http:outbound-endpoint host=".." port=".."/>
   </poll>
   <processor ref=""/>
   <processor ref=""/>
</flow>

Currently <poll> has no support for cron expression of for customizing it’s threading profile

Custom Message Sources

You can replace any inbound endpoint in a flow with a custom message source. This allows you to use any class as a message source to the flow, including connectors. You configure the custom message source using the <custom-source> element. In the element you identify the class for the custom source. You can further configure the custom message source using Spring bean properties.

The following code example configures a custom message source for a flow:


          
       
1
2
3
4
5
6
<flow name="useMyCustomSource">
   <custom-source class="org.my.customClass">
      <spring:property name="threads" value="500"/>
   </custom-source>
   <vm:outbound-endpoint path="output" exchange-pattern="one-way"/>
</flow>

In this topic: