Contact Free trial Login
+
+

Anypoint Exchange

Home to the complete listing of connectors, templates, examples and APIs.
Discover and use proven assets built by the MuleSoft ecosystem, or add assets to a private
tenant of Anypoint Exchange for collaboration and sharing of internal best practices.

Sending JSON Data to an AMQP Queue

Sending JSON Data to an AMQP Queue

(0 reviews)

Shows you how to use the AMQP connector to send JSON data to RabbitMQ, an open source message broker that implements AMQP.

screenshot from Anypoint Studio

Example

In this example a message containing sample sales data in JSON is received through an HTTP endpoint. This message is then converted to a string using a transformer and then sent to RabbitMQ using the AMQP connector. Once this message reaches the queue, it can be viewed throught he RabbitMQ web console.

Set Up and Run the Example

  1. After making sure that RabbitMQ is running, log in to the RabbitMQ web admin console at http://localhost:15672
  2. Go to the Exchanges tab and click on Add a new Exchange to create an exchange called salesexchange. You may leave the other feilds as they are and then click on Add exchange.
  3. Now go to the Queues tab and click on Add a new queue to create a queue called salesqueue. You may leave the other fields as they are and then click on Add queue.
  4. Click on salesexchange under the Exchanges tab and then go to the section titled Add binding from this exchange. In the To queue field type in salesqueue and then click on Bind.
  5. Open and run the example project in the studio interface.
  6. Make a HTTP POST request using Postman, curl or the REST Console to send the following JSON data: {"ITEMID"= 001, "ITEMNAME" = "Shirt", "QTY" = 1, "PRICE" = 20}
  7. Now, navigate back to the RabbitMQ web admin console. You should notice an increase in the number of messages in salesqueue. You may also view the message by clicking on salesqueue in the Get messages option.

Documentation

Read full documentation in GitHub

Examples to Try Next


Reviews

Download
Log into Anypoint Platform to download this asset

Overview

Type
Example
Organization
MuleSoft
Created by
MO
MuleSoft Organization
Published onJun 22, 2017

Versions

VersionRuntime version
1.4.13.x
1.3.33.7
1.2.03.6
1.1.03.5