Mule ESB –Advanced
Mule Message Structure
 The Mule message is the data that passes through an application via one or
more flows. It consists of two main parts:
 The message header, which contains metadata about the message
 The message payload, which contains your business-specific data.
Mule Message Properties and Variables
 Message header consists of properties which
provide useful information about the message
 variables represent data about a message
 Properties have two main
scopes: inbound and outbound.Inbound Property
Mule Message Variables
 Variables are user-defined metadata about a
message.
 Variables have three scopes:
Flow variables apply only to the flow in which
they exist.
Session variables apply across all flows within the
same application.
Outbound Endpoint
Mapping message headers to transport headers
Mapping transport headers to message headers
Inbound Endpoint
Transformation Types
 3 Types of Transformers
Type transformation - involves converting the ‘type’ of the
message, for example; converting a byte stream to a string or
converting a JMS Message to a Java object.
Message transformation involves converting the message itself,
for example; converting a BookingRequest object into an
AirlineTicket object.
Property Transformations involves the properties on a message.
Each message may contain properties, usually related to
the transport used. For example, a message sent to an SMTP
server would have ‘To’, ‘From’ and ‘CC’ properties
SPLITTER
 A message splitter can be used to break down an outgoing message
into parts and dispatch those parts over different endpoints configured
on the router.
SplitterExample
<flow name="SplitterExampleFlow1" doc:name="SplitterExampleFlow1">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" doc:name="HTTP"/>
<splitter expression="#[xpath('//actor')]" doc:name="Splitter"
enableCorrelation="IF_NOT_SET"/>
<logger message="#[message.payload]" level="INFO"
doc:name="Logger"/>
</flow>
Mule Aggregator
Mule aggregators use the MULE_CORRELATION_ID and
MULE_CORRELATION_GROUP_SIZE to reassemble a split
message.
<flow name="aggregateLineItems">
<jms:inbound-endpoint queue="lineitem.complete“ connector-
ref="jmsConnector"/>
<collection-aggregator timeout="60000“ failOnTimeout="true" />
<custom-transformer
class="com.prancingdonkey.transformer.LineItemsToOrderTransformer"/
>
<component
class="com.prancingdonkey.service.OrderProcessingService"/>
</flow>
Mule Aggregator Example
Resequencer
If fractions of the message are being processed in
parallel in different servers, there's a good chance
that they may take different lengths of time to be
processed, and consequently fall out of order.
 The Resequencer will wait for all of the messages in
the group to arrive (keeping track
of MULE_CORRELATION_ID and
MULE_CORRELATION_GROUP_SIZE )
 Reorder them according to their
MULE_CORRELATION_SEQUENCE index.
 The Resequencer outputs will be in distinct
messages,
Mule advanced

Mule advanced

  • 1.
  • 2.
    Mule Message Structure The Mule message is the data that passes through an application via one or more flows. It consists of two main parts:  The message header, which contains metadata about the message  The message payload, which contains your business-specific data.
  • 3.
    Mule Message Propertiesand Variables  Message header consists of properties which provide useful information about the message  variables represent data about a message  Properties have two main scopes: inbound and outbound.Inbound Property
  • 4.
    Mule Message Variables Variables are user-defined metadata about a message.  Variables have three scopes: Flow variables apply only to the flow in which they exist. Session variables apply across all flows within the same application.
  • 6.
    Outbound Endpoint Mapping messageheaders to transport headers
  • 7.
    Mapping transport headersto message headers Inbound Endpoint
  • 8.
    Transformation Types  3Types of Transformers Type transformation - involves converting the ‘type’ of the message, for example; converting a byte stream to a string or converting a JMS Message to a Java object. Message transformation involves converting the message itself, for example; converting a BookingRequest object into an AirlineTicket object. Property Transformations involves the properties on a message. Each message may contain properties, usually related to the transport used. For example, a message sent to an SMTP server would have ‘To’, ‘From’ and ‘CC’ properties
  • 9.
    SPLITTER  A messagesplitter can be used to break down an outgoing message into parts and dispatch those parts over different endpoints configured on the router.
  • 10.
    SplitterExample <flow name="SplitterExampleFlow1" doc:name="SplitterExampleFlow1"> <http:inbound-endpointexchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/> <splitter expression="#[xpath('//actor')]" doc:name="Splitter" enableCorrelation="IF_NOT_SET"/> <logger message="#[message.payload]" level="INFO" doc:name="Logger"/> </flow>
  • 11.
    Mule Aggregator Mule aggregatorsuse the MULE_CORRELATION_ID and MULE_CORRELATION_GROUP_SIZE to reassemble a split message.
  • 12.
    <flow name="aggregateLineItems"> <jms:inbound-endpoint queue="lineitem.complete“connector- ref="jmsConnector"/> <collection-aggregator timeout="60000“ failOnTimeout="true" /> <custom-transformer class="com.prancingdonkey.transformer.LineItemsToOrderTransformer"/ > <component class="com.prancingdonkey.service.OrderProcessingService"/> </flow> Mule Aggregator Example
  • 13.
    Resequencer If fractions ofthe message are being processed in parallel in different servers, there's a good chance that they may take different lengths of time to be processed, and consequently fall out of order.
  • 14.
     The Resequencerwill wait for all of the messages in the group to arrive (keeping track of MULE_CORRELATION_ID and MULE_CORRELATION_GROUP_SIZE )  Reorder them according to their MULE_CORRELATION_SEQUENCE index.  The Resequencer outputs will be in distinct messages,