FAQ: Anypoint MQ
Anypoint MQ requires a separate Enterprise subscription and is not included in the Anypoint Platform trial version. Contact MuleSoft Support for more information. If you don’t have an Enterprise subscription, you can use Apache Active MQ or Rabbit MQ.
Anypoint MQ standard and FIFO queues are available in these regions:
Northern Virginia (
Central Canada (
Anypoint MQ messages are always transported using in-flight HTTPS encryption with the latest Transport Layer Security (TLS) protocols. If you configure Anypoint MQ queues for encryption at rest, the payloads are encrypted with the AES-256 GCM algorithm on the server side.
If your app requires an additional layer of encryption security, then you can encrypt the payloads yourself before publishing messages to Anypoint MQ. You must manage your encryption keys for both the message publishers and the consumers.
When you have a queue encrypted, the messages are stored encrypted but they are decrypted when they are read. Encryption and decryption are automatic and transparent to the final user. There’s no option to disable the automatic decryption. If you need to encrypt the message so that the payload remains encrypted, manually encrypt the content.
The body of an Anypoint MQ message is sent as a string as part of a JSON message, thus any content that needs to be published should be serializable in a string format from which you can later deserialize. One way to do this is to serialize the Java object to its JSON representation using DataWeave, which can be serialized and deserialized from a string. Sending Java objects that don’t have a proper string serialization causes the message to be unreadable on the receiving end.
No, queues and message exchanges are unique to the region in which they were created and cannot share messages or queues between regions. Developers can manually create custom programs that load balance between regions, but Anypoint MQ itself does not provide multi-region support.
The queues in each region are separate from those in other regions. You can name queues the same in each region, but queues can’t share messages across regions.
In Anypoint Platform > MQ > Message Browser, you can fetch up to 50 messages from a standard (non-FIFO) queue. For a FIFO queue, you can fetch up to 10 messages. The FIFO restriction exists because the FIFO queues are limited to 10 in-flight messages per message group. For more information on in-flight messages, see How many in-flight messages can I have per queue?
Why do I receive fewer messages than my batch size when retrieving messages with the Anypoint MQ REST API?
Anypoint MQ is a highly distributed messaging system, so the results of an API call to receive messages are not guaranteed to be entirely representative of what is fully in the queue. Anypoint MQ operates in a best-effort case. For example, if there are 5 messages in a queue, the system returns anywhere from 0-5 messages in a single API call depending on what distributed subsystems are accessed by that request. Subsequent API calls retrieve more messages and if you keep making API requests to receive messages, then you get all of them. Normally in high throughput cases, repeated API calls happen extremely fast. The Anypoint MQ connector, for example, continuously polls the Anypoint MQ backend for new messages and from the user perspective, the messages are processed nearly instantly even though many API calls were used.
Standard queues attempt to preserve the order of messages, but strict order is not guaranteed. Because standard queues are designed to be scalable and distributed, they can’t guarantee that messages are received in the same order that they are sent. If message order is important, use a FIFO queue or set the Anypoint MQ connector to the Consume operation.
Anypoint MQ limits messages to 10 MB.
If a larger size is required, you can split the payload into multiple messages, or implement a claim check style service in which you store the payload in a file system or blob storage, and then put a pointer to the payload in the message so it can be downloaded later. However, you must manage access control to the blob storage for both the sender and receiver. You also need to consider that messages can be received unordered unless you use a FIFO queue.
That is, how do we ensure message exchanges or queues created in one environment are not confused or connected to message exchanges or queues created in a different environment if they have the same name?
You can have the same object name for queues and exchanges in different environments, but the client app ID and client secret values must be unique. You can’t access a production queue from a development environment if they don’t have the corresponding client app IDs.
You can use Anypoint Platform > Access Management > Business Groups or Environments. The queues and message exchanges created in a business group or environment are only visible to those with access to the business group or environment.
You can publish a message from an on-premises system to Anypoint MQ and have another on-premises subscriber pull messages from Anypoint MQ. Currently, Anypoint MQ cannot be deployed on-premises. If you need a messaging source on-premises, you can use Apache Active MQ instead.
Within each region, Anypoint MQ services deploy to multiple availability zones (AZs) to provide high availability (HA). If service in one availability zone goes down, the Anypoint MQ service operates normally in that region. If all availability zones go down in a region, the Anypoint MQ service is unavailable in that region until at least one of the availability zones comes back up. Because the storage solution for Anypoint MQ is durable, messages that were already in the Anypoint MQ system before service was interrupted are retained.
Anypoint MQ does not have built-in support for duplicating messages or queues across regions.
You cannot use reconnection strategies with the Anypoint MQ connector because it does not use a connection-based protocol. Instead, it uses REST behind the scenes.
On the inbound side, you can easily mimic a retry strategy using a max redelivery attribute set to your maximum number of retries and an exception strategy to move to a dead-letter queue (DLQ) when the limit is reached.
On the outbound side, you should use the same triggering mechanism.
Otherwise, you can use the
until-successful element with this connector.
You should also configure the HTTP connector so that Global Element Properties > Set Max Redelivery is set to the value of
There is no built-in functionality to replay messages from a DLQ. You must implement a special flow or app to consume those messages and forward them back to the original queue for reprocessing.
The network that Anypoint MQ runs on provides high availability replications across its many datacenters.
If a server fails and failover occurs, messages continue to be processed by other servers on the network in which Anypoint MQ runs. Standard Anypoint MQ queues do not guarantee only-once message delivery. Only FIFO queues support only-once message delivery. The high availability network deduplicates messages for FIFO queues automatically.
Yes, Anypoint MQ guarantees "at least once" delivery of messages to the destination.
Every API call to Anypoint MQ counts as one API request. Counting each call as a request includes sending, receiving, and acknowledging messages as well as all operations on queues and exchanges.
Up to 10 messages can be retrieved from a single API call, which only bills as one request. Even if the request to retrieve messages does not return a message, for example, if the queue is empty, it still bills as a single API request.
There is no maximum number of transactions per second (TPS) for standard queues or exchanges. FIFO queues have a limit of 300 TPS. If you batch 10 messages per read and write operation (maximum) using the API, FIFO queues can support up to 3,000 TPS.
There is no maximum number of queues or exchanges.
Anypoint MQ supports up to 120,000 in-flight messages per standard (non-FIFO) queue.
FIFO queues allow up to 10 in-flight messages per message group due to the extra processing required. Anypoint MQ doesn’t limit the number of message groups in FIFO queues.
A single queue can contain an unlimited number of messages. The maximum duration for any message, either in-flight or not, is two weeks, after which Anypoint MQ deletes the message.
The connector does not store the message for resending it. The connector retries 5 times after which the message is discarded and it becomes the responsibility of the app to decide what to do with a message.
Retries for sending messages to Anypoint MQ broker are always synchronous. By contrast, the client mode specifies how to establish the connection to the backend and does not govern message-sending retries.
Retries are arbitrary. The
maxRedelivery parameter indicates how many times the messages were delivered but not processed (either NACK or TimeOut).
Yes. The REST API supports the
batchSize query parameter, which lets you retrieve up to 10 messages in a single call (default value). The maximum number of messages that can be retrieved in a single call is 10. You can configure a lower value using the
Prefetch Config parameter in the Anypoint MQ connector.
The number of messages retrieved by the connector is sometimes fewer than the number configured. A number higher than 10 is overridden.
If you have non-Mule applications, you can use the Anypoint MQ REST APIs to send and receive messages.
Anypoint MQ is horizontally scalable and supports higher throughputs as needed.
Anypoint MQ provides long polling. You can do a REST request and ask the server to keep the TCP socket open for up to 20 seconds to fulfill your request if there are not enough messages.
You can use FIFO queues to process messages in order.
If you don’t want to use FIFO queues, you can process messages one at a time by setting the Anypoint MQ connector to the
This operation retrieves a message from the queue or receives null if a message is not available.
Then, depending on your Mule version:
maxConcurrency="1" attribute to the
Specify this attribute to set the number of simultaneous invocations that a component can receive at any given time to 1.
Mule 4 Example:
<flow name="testanypointmq1by1Flow4" maxConcurrency="1"> <logger level="INFO" doc:name="Logger" message="Flow triggered" /> <anypoint-mq:consume doc:name="Anypoint MQ" config-ref="Anypoint_MQ_Config" destination="queuename" /> <logger level="INFO" doc:name="Logger" message="Processing message received. #[payload]"/> <anypoint-mq:ack ackToken="#[vars.currentAckToken]" config-ref="Anypoint_MQ_Config" doc:name="Anypoint MQ"/> <logger doc:name="Logger" level="INFO" message="Message processed."/> </flow>
processingStrategy="synchronous"on the flow.
Specify this attribute to process messages in the same thread that initially received the message.
Set a poll scope to fire the process at specified intervals.
Mule 3 Example:
<flow name="testanypointmq1by1Flow3" processingstrategy="synchronous"> <poll doc:name="Poll"> <logger doc:name="Logger" level="INFO" message="Polling fired"></logger> </poll> <anypoint-mq:consume config-ref="Anypoint_MQ_Configuration" destination="queuename" doc:name="Anypoint MQ"/> <logger doc:name="Logger" level="INFO" message="Processing message received. #[payload]"/> <anypoint-mq:ack config-ref="Anypoint_MQ_Configuration" doc:name="Anypoint MQ"/> <logger doc:name="Logger" level="INFO" message="Message processed."/> </flow>
More than one in-flight message can occur if the processing time between
anypoint-mq:ack is higher than the value of the Default Acknowledgement Timeout setting for the queue.
Anypoint MQ provides direct access to the message ID and payload. You can see the message headers using the Chrome browser and its Network Inspector feature.
The only officially supported connectors and transports for shared resources are HTTP/HTTPS, VM, JMS, JMS Caching Connection Factory, Database, WMQ, JBoss Transaction Manager, and Bitronix Transaction Manager.
Yes. It applies to all environments.
If your usage exceeds your license limit, Anypoint MQ continues to work. MuleSoft notifies your account administrator and team with any billing-related information.
When using Anypoint MQ as a message processor with prefetch, use only a global prefetch configuration.
For example, the following local prefetch does not work:
<anypoint-mq:subscriber config-ref="Anypoint_MQ_Configuration" destination="programmatically" doc:name="Anypoint MQ" > <anypoint-mq:prefetch fetchSize="50" fetchTimeout="10000"/> </anypoint-mq:subscriber>
Use a global prefetch instead:
<anypoint-mq:prefetch name="Prefetch_Settings" fetchSize="50" fetchTimeout="10000" doc:name="Prefetch Settings"/> <anypoint-mq:subscriber config-ref="Anypoint_MQ_Configuration" destination="programmatically" doc:name="Anypoint MQ" prefetch-ref="Prefetch_Settings"/>
To delete a queue, see Delete a Queue.
To delete a message exchange, see Delete a Message Exchange.