Contact Us 1-800-596-4880

Sending Messages to Multiple Queues Using Message Exchanges

You can send messages to multiple standard queues simultaneously by binding those queues to a message exchange.

You can also route messages to specific queues that are bound to the message exchange by creating intelligent message-routing rules on the bindings. For information, see Route Messages by Configuring Rules on Message Exchanges.

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 10 queues to an exchange with message routing rules defined. If an exchange has more than 10 queue bindings, you cannot use intelligent message routing.

Before creating a message exchange, create one or more queues. For information, see Create 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:

    Add icon
  5. Select Exchange.

    For Queue or FIFO Queue, see Configuring and Using Queues.

  6. In the Create Exchange page, name the message exchange.

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

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

    Checkboxes to bind queues to an 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:

    Click the exchange type (1) to display the bound queues (2) in the details pane.

Bind a Queue to a Message Exchange

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 cannot 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:

    (1) Checkboxes for multiple select, and (2) Unbind and (3) Bind buttons
  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

Send a Message to a Message Exchange

Sending a message to a message exchange is similar to sending a message to a queue. The only difference is that you can get the message from any queue bound to a message exchange. The maximum size for a message sent to a message exchange is 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.

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 exchange
  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:

    Add User Properties toggle in the Message Sender page
  7. Click Send.

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

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 and 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
  4. In the Delete Exchange window, select the checkbox to confirm and click Delete Exchange.