<anypoint-mq:consume config-ref="MQ_config" destination="#[vars.destination]"/>
Anypoint MQ Consume Operation - Mule 4
The Consume operation in the Anypoint MQ connector provides the ability to consume a message at any time of the flow, from any destination.
The syntax to consume a message from a queue is:
The operation above consumes the first available message in the queue identified by the destination, and then converts it to a
MuleMessage resulting in the following structure:
The message’s content as payload.
The message’s metadata in the message attributes.
By default, the ACK mode is
MANUAL, so the message isn’t acknowledged. If you want the message to be acknowledged as soon as it is consumed, set the mode to
For more information, see Anypoint MQ ACK and NACK Operations.
By default, the maximum wait time is configured in 10 seconds, producing a
null result if no message is available in that period.
If configuring a timeout that fits better for your use case, customize the
As stated before, each message received consists of two parts:
Payload - Contains the content of a message.
Attributes - Contains the metadata for a message.
This metadata maps all the information available in a Anypoint MQ message, including:
See Consume for details about the attributes structure.