---
schema_version: "1"
id: 712df8658ce71a6336419633817ac92c0bb306c968f1119026177544a4ec8e1d
title: Sending Messages to Multiple Queues Using Message Exchanges
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mq/mq-exchanges.md
canonical_url: https://docs.mulesoft.com/mq/mq-exchanges
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 2c8a1845370d5070b77915dfe54facb11a35561ea2fdf18dfe63cfbddd264fc0
description: MuleSoft Documentation Site
latest: true
---
---
product: MQ
---

# Sending Messages to Multiple Queues Using Message Exchanges

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

You can send messages to multiple standard or FIFO [queues](https://docs.mulesoft.com/mq/mq-queues) simultaneously by binding
those queues to a _message exchange_.

By default, a message exchange sends each message to every bound queue. You can instead route
messages to specific bound queues by creating _intelligent message-routing rules_ on the bindings.
For information, see [Route Messages by Configuring Rules on Message Exchanges](https://docs.mulesoft.com/mq/mq-routing-rules).

The maximum size of a message sent to a message exchange is 10 MB. You can bind a maximum of 450
queues to a message exchange. You can bind a maximum of 25 queues to an exchange with message
routing rules defined. If an exchange has more than 25 queue bindings, you can’t use intelligent
message routing.

Before creating a message exchange, create one or more queues. For information, see
[Create a Queue](https://docs.mulesoft.com/mq/mq-queues#create-a-queue).

> [!NOTE] Message exchanges support only the Publish operation; they don’t support the Consume
> operation. Anypoint MQ forwards messages published to a message exchange to the bound queues that
> are eligible under the binding configuration, and the app consumes from the queue.
>
> If an app attempts to consume from a message exchange, the Anypoint MQ REST API throws this error:
> `The destination should be a queue.`

## Create a Message Exchange

To create a message exchange:

1.  Sign in to Anypoint Platform.

2.  Click **MQ** from the navigation menu or the main Anypoint Platform screen.

3.  Click **Destinations**.

4.  Click the **Add** icon to display the menu:

5.  Select **Exchange** or **FIFO Exchange**.

    For **Queue** or **FIFO Queue**, see [Configuring and Using Queues](https://docs.mulesoft.com/mq/mq-queues).

6.  Name the message exchange in the **Create Exchange** or **Create FIFO Exchange** page.

    Message exchange names can contain up to 127 alphanumeric (a-z, A-Z, 0-9) and punctuation (. -)
    characters. They can’t contain spaces or other characters.

7.  Click the checkboxes to bind queues to this message exchange:

    ![Checkboxes to bind queues to a message exchange in the Create Exchange page](/mulesoft/current/en-us/mq/_images/mq-exchange-bind-queues.png)

    > [!NOTE] You can bind only standard queues to an exchange and only FIFO queues to a FIFO
    > exchange.

8.  Click **Save Changes**.

9.  In the **Destinations** page, click the message exchange type for the new exchange to display
    the bound queues in the details pane:

## Bind a Queue to a Message Exchange

> [!NOTE] You can bind a maximum of 450 queues to a message exchange. You can bind a maximum of 25
> queues to an exchange with message routing rules defined. If an exchange has more than 25 queue
> bindings, you can’t use intelligent message routing.

To bind a queue to a message exchange:

1.  In **Anypoint Platform > MQ**, click **Destinations** in the navigation menu.

2.  Click the message exchange ID to display the **Exchange Settings** page:

    ![Exchange Settings page showing checkboxes for multiple select, and Unbind and Bind buttons](/mulesoft/current/en-us/mq/_images/mq-bind-queue-to-exchange2.png)

    > [!NOTE] The page displays only standard queues for a message exchange and only FIFO queues for
    > a FIFO exchange.

3.  In the settings page, click **Bind** or **Unbind** for each single queue you want to bind to or
    unbind from the message exchange.

    To select multiple queues to bind to the exchange, select the checkboxes and click the **Bind
    Selected Queues** button that appears:

    ![Bind Selected Queues button](/mulesoft/current/en-us/mq/_images/mq-exchange-bind-selected-queues.png)

## Send a Message to a Message Exchange

Sending a message to a message exchange is similar to sending a message to a queue. The exchange
evaluates its bindings and sends the message to each eligible bound queue. The maximum size for a
message sent to a message exchange is 10 MB.

> [!IMPORTANT] A successful publish operation confirms that Anypoint MQ accepted the message for the
> exchange. It doesn’t confirm that a routing rule matched or that a bound queue received the
> message. If no bound queue receives the message, redelivery and dead-letter queue (DLQ) settings
> configured on queues don’t apply because the message never enters a queue.

For details about eligible bindings and unmatched messages, see
[Route Messages by Configuring Rules on Message Exchanges](https://docs.mulesoft.com/mq/mq-routing-rules).

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.

To send a message to a message exchange:

1.  In **Anypoint Platform > MQ**, click **Destinations** in the navigation menu.

2.  Click the message exchange ID to display the **Exchange Settings** page.

3.  In the settings page, click **Message Sender** in the navigation menu:

    ![Message Sender option for the selected message exchange](/mulesoft/current/en-us/mq/_images/mq-exchange-payload.png)

4.  Leave the **Type** field set to **Text**.

5.  Enter text in the **Payload** field, such as `Hello Queues from myMessageExchange`.

6.  If you want, toggle **Add User Properties**, specify the property name-value pairs to send, and
    click **Add Property**:

    ![Message Sender page showing the Add User Properties toggle](/mulesoft/current/en-us/mq/_images/mq-tutorial-message-sender-user-props.png)

7.  Click **Send**.

8.  Click **View Messages** for a queue that is bound to the exchange to view the queue with the
    Message Browser.

    See [Get a Message from a Queue](https://docs.mulesoft.com/mq/mq-queues#get-a-message-from-a-queue).

You also send JSON content or comma-separated values (CSV) in the payload by changing the message
**Type** value. See [Send a JSON Message to a Queue](https://docs.mulesoft.com/mq/mq-queues#send-a-json-message-to-a-queue) and
[Send a CSV Message to a Queue](https://docs.mulesoft.com/mq/mq-queues#send-a-csv-message-to-a-queue).

## Delete a Message Exchange

If a message exchange is no longer needed, you can delete it. All queue bindings for the deleted
exchange queue are lost. Clients can’t publish or subscribe to the exchange.

To delete a message exchange:

1.  In **Anypoint Platform > MQ**, click **Destinations** in the navigation menu.

2.  In the **Destinations** page, click the message exchange type for the exchange to display the
    details pane.

3.  Click the **Delete** icon:

    ![Delete icon in the details pane for deleting an exchange](/mulesoft/current/en-us/mq/_images/mq-exchange-delete.png)

4.  In the **Delete Exchange** window, select the checkbox to confirm and click **Delete Exchange**.

## See Also

- [Configuring and Using Queues](https://docs.mulesoft.com/mq/mq-queues)

- [Anypoint MQ Overview](https://docs.mulesoft.com/mq/)

- [FAQ: Anypoint MQ](https://docs.mulesoft.com/mq/mq-faq)
