Anypoint MQ Overview | MuleSoft Documentation
# Anypoint MQ Overview
Anypoint MQ is a multi-tenant, cloud-based message queuing service for exchanging data asynchronously between your applications. The Anypoint MQ messaging broker enables applications to communicate by publishing a Mule message to a queue so that another app can consume the message.
Anypoint MQ is fully integrated with Anypoint Platform, offering access control, client management, and connectors. Integration with access management enables you to specify environments and business groups for role-based access control and support for connected apps.
Anypoint MQ supports hybrid use cases, IoT (Internet of Things) in which you collect data from different devices, and provides a REST API to use with device applications. You can also use Anypoint MQ with other app frameworks such as node.js to communicate with queues.
This spotlight video gives an overview of Anypoint MQ:
Anypoint MQ:
  * Provides fully hosted and managed queues and message exchanges in the cloud.
  * Supports large payloads, encryption, queuing, and publish/subscribe (pub/sub) paradigms.
  * Enables you to easily connect to non-Mule applications by using the REST API.
  * Provides Anypoint Studio access, which makes the process of leveraging your queues and message exchanges as simple as drag, drop, and configure.


## Before You Begin Using Anypoint MQ
  1. Make sure you have a paid Anypoint Platform package or subscription with the Anypoint MQ integration add-on.
Anypoint MQ isn’t available in the trial edition of Anypoint Platform.
To add Anypoint MQ to your package or subscription, contact your account team. After purchasing Anypoint MQ, wait one hour for Anypoint MQ to become available in Anypoint Platform.
For information about Anypoint Integration packages, see MuleSoft Anypoint Platform Pricing.
  2. Set up your environment and permissions.
For information, see Setting Up the Environment and Access Permissions.
  3. Review this overview for information about Anypoint MQ.


## Anypoint MQ Features
Anypoint MQ includes these features: 

Queues and Message Exchanges
    
Send messages to queues and pull messages from queues. Use a message exchange to send messages to multiple standard queues simultaneously or route messages to specific queues by using intelligent message routing rules.
For information, see:
  * Queues and Message Exchanges
  * Configuring and Using Queues
  * Sending Messages to Multiple Queues Using Message Exchanges
  * Route Messages by Configuring Rules on Message Exchanges



Management Console
    
Monitor queue statistics, purge queues, and see how many messages are in flight by using the management console. 

Anypoint MQ Connector
    
Send and receive messages from any Mule app, whether it’s deployed in CloudHub or used in a hybrid scenario and deployed on-premises.
For information, see Anypoint MQ Connectors. 

Usage Information
    
View the current and past months' usage, including the total number of messages and API requests. Organization administrators and owners access this information from the **Access Management** page.
For information, see Viewing Anypoint MQ Usage Data. 

REST API
    
Use the REST API to easily communicate with non-Mule applications.
For information, see Anypoint MQ REST APIs. 

Environments and Role-Based Access Control
    
Use Anypoint Platform access management to specify different environments for your queues, who can access each environment, and what they can do within each environment.
For information, see Setting Up the Environment and Access Permissions. 

Client Management
    
Use connected apps to authenticate with Anypoint Platform by using APIs.
Register each consumer registered as a connected app with a name, ID, and secret. The connected app uses the ID and secret to authenticate and get access to queues and message exchanges within a single environment. You can’t use connected apps across multiple environments or business groups.
For information, see Configuring Connected Apps. 

Large Payloads
    
Send large payloads of up to 10 MB.
If the payload contains any format except text (such as CSV, HTML, JSON, and XML), Anypoint MQ converts it to a string before sending, which increases the payload size. This conversion might result in the payload exceeding the maximum payload size of 10 MB and causing a `Payload too large` error. 

Disaster Recovery
    
Ensure your messages are delivered even if services go down temporarily.
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. Messages that were already in the Anypoint MQ system before service was interrupted are retained.
You can enable failover on standard queues, which creates a fallback queue in a fallback region. With failover enabled, if an app that uses Anypoint MQ Connector can’t contact the Anypoint MQ server in a region, the connector switches to the fallback queue to continue publishing and consuming messages. For information, see Configuring Cross-Region Failover for Standard Queues. 

Usage Statistics
    
View a usage statistics chart so that you can manage peak usage and subscription parameters. The chart provides current and past usage, including consumed data, API requests, and the total number of messages received.
For information, see Viewing Anypoint MQ Usage Data.
You can also use the Anypoint MQ Stats API to perform statistical analysis of queue performance.
For information, see Anypoint MQ Stats API.
You can’t use Anypoint MQ with CloudHub Insight or Anypoint Monitoring.   
---  
## Queues and Message Exchanges
_Message queues_ provide temporary storage that enables applications to communicate in a scalable and reliable way. Publishers can publish messages into queues, and subscribers can receive messages from queues.
To distribute messages to multiple queues and consumers, bind multiple queues to a _message exchange_. Messages sent to an exchange appear in all of its bound queues simultaneously:
For example, if a publisher publishes changes in the weather and multiple apps must receive that data, use a message exchange to publish a single message to multiple queues for each app.
A _binding_ is a relationship between the queue and message exchange that tells the message exchange where to send messages. By configuring _intelligent message-routing rules_ on a binding, you can route messages to specific queues that are bound to the message exchange.
  * You can bind a queue to multiple message exchanges.
  * You can bind a maximum of 450 queues to a message exchange.
  * You can bind a maximum of 10 queues to an exchange with message routing rules defined. If an exchange has more than 10 queue bindings, you can’t use intelligent message routing.


In this example, an app running Salesforce customer relationship manager (CRM) uses Anypoint MQ to communicate with two applications that handle different databases:
The Salesforce app sends a pub/sub message to an Anypoint MQ message exchange (`customer-updates`). The two applications (`customer-consumer-1` and `customer-consumer-2`) receive the message from the message exchange and send it to their respective databases.
### Benefits of Queues
Queues provide these benefits:
  * Horizontal scalability
By putting a message in a queue, the work to process that message can be distributed over multiple subscribers.
  * Reliability
Queues ensure that messages are always processed, even in the case of failure.
Anypoint MQ provides reliability with queues by using a lock and acknowledge mechanism. These features ensure that a message is always processed, even in the case of failure.
  * Decoupling
You can use a queue as a communication mechanism between different applications and devices, enabling them to have different development life cycles or maintenance windows without affecting other applications.
  * Aggregation
Multiple message producers can publish to a single queue, which enables easy consumption by consumers.
The message-consumption process is:
    1. A consumer retrieves messages from a queue, which locks the messages and makes the messages invisible to all other consumers.
    2. When retrieving, the consumer specifies a lock timeout. If the message is not processed within the specified window, Anypoint MQ makes the message visible to other consumers. If a failure occurs, such as a consumer node crash, another node can process the message. A locked message does not block other messages from being read.
       * If a consumer processes a message successfully, the client acknowledges the message, and Anypoint MQ removes the message from the queue.
       * If a consumer can’t process a message, the message proceeds with a negative acknowledgment and becomes visible in the queue again.
For information, see ACK and NACK Operations.
  * Unlimited messages in a queue
Anypoint MQ doesn’t limit the number of messages in a queue. The size of each message in a queue is limited to 10 MB.
  * Long polling
Messages are read through long polling. The server holds a request open until new data is available, and then Anypoint MQ delivers a batch of messages with a single read.
  * Billing and charging
Billing is based on the number of messages delivered to subscribers from queues, rather than the number of queues or message exchanges you create.


## Anypoint MQ Features by Control Plane
Anypoint MQ Feature | US Cloud and EU Cloud | Canada Cloud and Japan Cloud (Hyperforce) | MuleSoft Government Cloud  
---|---|---|---  
  *   *   *   *   * Anypoint MQ Connector versions 4.x and later
  * Anypoint MQ Admin API
  * Anypoint MQ Broker API
  * Anypoint MQ Stats API (Anypoint MQ Stats only)
## Anypoint MQ Features by Control Plane
Anypoint MQ Feature | US Cloud and EU Cloud | Canada Cloud and Japan Cloud (Hyperforce) | MuleSoft Government Cloud  
---|---|---|---  
  *   *   *   *   * Anypoint MQ Connector versions 4.x and later
  * Anypoint MQ Admin API
  * Anypoint MQ Broker API
  * Anypoint MQ Stats API (Anypoint MQ Stats only)

  
  * Unencrypted Queues
  * Usage Charts (Access Management)
  * Cross-Region Failover
  *   * Anypoint MQ Connector earlier than 4.x
  * Anypoint MQ Stats API (Usage Metrics)

  
  * CloudHub 1.0 Deployments

  
  * Usage Reports (Usage)

  
## Anypoint MQ on MuleSoft Government Cloud
When you deploy to MuleSoft Government Cloud, all features of Anypoint MQ are supported with these exceptions: 

Unencrypted Queues
    
Unencrypted queues aren’tsupported.
When creating a queue, the **Encryption** option is disabled and defaults to selected. 

Client Apps
    
Client apps aren’t supported. Use connected apps instead. 

Anypoint Connector Versions
    
Anypoint Connector for Anypoint MQ versions earlier than 4.x aren’t supported.
Using connected apps with Anypoint MQ requires Anypoint MQ Connector 4.x for Mule 4. 

Cross-Region Failover
    
Cross-region failover isn’t supported. 

REST APIs
    
These REST APIs in the Anypoint MQ Stats API aren’t supported:
  * Get usage metrics for an org.
  * Get usage metrics for an environment within an org.


You can use the Anypoint MQ Stats API only to retrieve metrics for queues and exchanges. For information, see Anypoint MQ Stats API.
For information about MuleSoft Government Cloud, see Government Cloud Overview.
## Anypoint MQ on Hyperforce
Anypoint MQ is available on these Salesforce Hyperforce (Hyperforce) instances of Anypoint Platform:
  *   * 

For information about the regions where Anypoint MQ is available, see Anypoint MQ Regions.
When you deploy to Canada Cloud or Japan Cloud, all features of Anypoint MQ are supported with these exceptions: 

CloudHub 1
    
Deployments to CloudHub 1 aren’t supported. You can deploy apps to CloudHub 2.0 shared spaces and Anypoint Runtime Fabric. 

Unencrypted Queues
    
Unencrypted queues aren’t supported. When creating a queue, the **Encryption** option is disabled and defaults to enabled. 

Client Apps
    
Client apps aren’t supported. Use connected apps instead. 

Anypoint Connector Versions
    
Anypoint Connector for Anypoint MQ versions earlier than 4.x aren’t supported.
Using connected apps with Anypoint MQ requires Anypoint MQ Connector 4.x for Mule 4. 

Cross-Region Failover
    
Cross-region failover isn’t supported. 

Usage Charts
    
Usage Charts in Access Management aren’t available. Use Usage Reports in Usage instead. 

Rest APIs
    
These REST APIs in the Anypoint MQ Stats API aren’t supported:
  * Get usage metrics for an org
  * Get usage metrics for an environment within an org.


You can use the Anypoint MQ Stats API only to retrieve metrics for queues and exchanges. For information, see Anypoint MQ Stats API.
## See Also
  * Salesforce Hyperforce
  * Anypoint MQ Glossary
  * Anypoint MQ Connectors
  *   * Anypoint MQ Release Notes
  * Anypoint MQ Audit Logging