Azure MQ App Service API Demo Walkthrough


The MQ App Service API includes a demo mode that can be used for experimenting without requiring connectivity to an active backend IBM WebSphere MQ Server.  The demo mode will retain the most recent 10 messages that have been sent via POST command(s) and will return the messages when a GET is issued.  All of these messages are stored in memory and are lost if the App Service is stopped for any reason.  These instructions show how to configure a demo MQ App Service and use it from a browser via Swagger.  I will have another blog post showing how to code a .Net program to access the service programmatically.

Go to the Azure Preview Portal by logging into Azure, click on the user name in the top right corner and select “Switch to Azure Preview Portal”.  Once the portal opens, click the “New” button in the top left corner, click Web + Mobile, click Marketplace.  Type MQ into the search box and press Enter.  The MQ Connector appears as one of the selections – click on it. 

            

 

Some information appears regarding the connector.  Click on the blue Create button at the bottom of the screen and fill in the configuration settings as shown below.

               

 

An icon will appear indicating the connector is being created.  Once the connector is created an icon will be displayed on the home page.  Click on the new connector.  Before attempting to run the instance, the permissions must be set, by default they are set to Internal.  For this sample the permissions are set to Public (anonymous) – note: this is not recommended for a production system.  To set the permissions – click on the Settings icon, click on Application Settings, select Public (anonymous), click the Save icon, then close the Application settings and the Settings boxes.

      

Once the permissions are set click the URL to test the connector using Swagger.  First a document is displayed that contains details about the MQ Connector, including information regarding the various configuration settings.  Click on the Swagger UI link in the document to experiment with the various api’s that are available.  In the window that opens, click QueueApi and then click /api/{Name}/messages. 

 

In the Parameters area, enter a value for the Queue name (this can be anything since we are in the demo mode).  Enter the json data to send to the connector – this data is case sensitive.  For this sample we are sending string data that will be saved in UTF8 format - {"DataUTF8":"My first message"} - click the Try it out! button to send the data to the demo queue.  The response that is received shows the successful response code and the message type was a Datagram.  When using a live MQ Server, the Message ID will also be returned.

 

To retrieve the message from the queue, click on /api/{Name}messages.  In the Parameters area enter a value for the Queue name and click Try it out!

 

The Response Body should show the message that is returned.  If there is more than 1 message in the queue it will show all messages.

 

 

 

Comments (1)

  1. Juha says:

    Thanks, this was very useful. That last sentence doesn't appear to be true (anymore?) though. I only see the message that's first in the queue.

Skip to main content