FoMS Experts

News / World of Mulesoft

DATA PACKED IN A MESSAGE

Mule event and Mule message overview

Mule event and Mule message overview
Share
FacebookGoogle plusLinkedInStumbleuponTwitter
M. Petricevic14.7.2021

Key concepts for anything Anypoint-related include Mule event, Mule message, variables, attributes and payload.

Just as a Mule event, a Mule message is immutable, i.e. a new instance is created every time there is a change. Within a single flow, a new Mule message is returned by each processor that receives a Mule message.

When is a Mule event first generated in a flow? A Mule event creation is triggered by a message source or an event source (HTTP Listener, Scheduler, On New File, On Updated File, etc.). In other words, an event source detects a trigger. The same event source creates a Mule event, the first event instance in the flow. The Mule event is then passed to the following processor.

A mule event is divided into two objects or two parts: Mule message and variables. There is a simple reason for separating variables from a Mule message.

A Mule message is used to save content and metadata mostly from external sources. These include a message payload and its corresponding attributes. Payload is just another way to denote the body of a Mule message, i.e. the main content - an HTTP request response or a response of any kind of operation. Payload-specific and message-specific metadata is saved in attributes. All the properties and headers can be found within attributes.

Variables in a Mule event are specific to that event. They are not to be confused with variables defined in a DataWeave script (their scope does not go beyond the DataWeave script). Mule event variables can be used to store any data type. Mule event variables are created using the Set Variable component. Variables can be accessed within the scope of the flow in which they were created. Another flow connected to the flow in which a variable by a Flow Reference component was created is also included in this scope.

RELATED ARTICLES

Register now