mule filters, scopes, and routers
TRANSCRIPT
Mule Filters, Scopes, and Routers
Filters
• Evaluate a message to determine whether it can proceed through a flow
• Simplest filters implement basic logic operators (and, or and not)
• Simple elements can be combined in various ways to specify complex logical conditions
Filters - Example
• Use a filter near the beginning of your flow to reject any requests from a particular range of IP addresses
• Use a filter to reject any messages with a particular payload, or with a null payload
Scopes
• Encapsulate other message processors so that they function as a single unit
• Wrap several message processors together to form a transactional unit, so that they succeed or fail to process a message together, thus ensuring accurate updating of a database
Scopes - Example
• Wrap several message processors together within a cache scope to store the result of their processing for reuse
• Wrap a single message processor within a message enricher scope to add to a message payload without manipulating the original contents
Routers
• Rirect or otherwise control messages within a flow• Controls act as splitters, resequencers, or
aggregators, splitting messages into individual items for processing, resequencing message content, or aggregating split messages
• Evaluating a message’s payload, properties, or variables, then routing to the message down a particular "pathway" according to those contents
Routers- Example
• Use a choice flow control to examine part of a message payload
• Route the message to the first "pathway" for which the set condition evaluates to true, such as where an order exceeds $5,000
Example - Expression Filter
Example - Expression Filter
Example - Message Enricher and Cache Scope
Example - Choice Router
Question and answer