API Gateway Integration with Rabbit MQ
This POC demonstrates API Gateway's Integration capabilities with RabbitMQ
using AMQP Assertion. You may follow the below steps to perform this POC.
1. POC Environment
a. API Gateway 9.2 VM installed with AMQPAssertion-9.2.00-46836.saar
You may request for AMQP Tactical Assertion at
https://cawiki.ca.com/display/Tactical/How+to+File+a+Tactical+ticket or
requesting the same by opening a CA Support Ticket.
b. ERLang 5.10.4
c. RabbitMQ 3.6.9
2. Install ERLang and RabbitMQ in the same sequence
a. Download RabbitMQ supported Erlang version
from http://www.erlang.org/downloads and install the same.
b. Download RabbitMQ from http://www.rabbitmq.com/download.html
and install the same
3. Configure RabbitMQ
RabbitMQ must be configured with minimum 6 steps as shown, before it can be
used in API Gateway.
RabbitMQ Configuration
c. Authorize the User
a.Enable Management
b. Create User to access default
console
Virtual Host /
f. Bind Exchange to
e. Create an
the Queue with d. Create a Queue
Exchange
Routing Key
Follow the process below to configure the 6 steps in RabbitMQ.
a. Enable RabbitMQ Management console: This helps to manage RabbitMQ
via Browser based UI. You may enable the same using the below step:
C:\<RabbitMQ Installation folder>\sbin>rabbitmq-plugins enable rabbitmq_management
RabbitMQ Management Console can be assessed at
http://<hostname>:15672 and use the default login credentials
Username: guest
Password: guest
RabbitMQ Management Screen after successful login:
b. Create User as shown:
c. Grant Access to the default Virtual Host / for the above user as shown:
d. Create a Queue as shown:
e. Create an Exchange as shown:
f. Bind the Exchange and the Queue with a Routing Key as shown:
RabbitMQ is now ready with all the configuration.
4. Configure AMQP Outbound Destination in API Gateway
a. Configure Outbound Destination as shown:
b. Create a service to send/produce a message to the Outbound Destination
as shown and invoke the same several times:
Producer Service :
Producer.xml
Invoke the Producer service several times as shown:
Verify the messages pushed from Producer Service in the RabbitMQ as
shown:
5. Configure AMQP Inbound Destination in API Gateway
Before configuring the Inbound Destination, we need to create a Service on API
Gateway that needs to be called by the Inbound configuration.
a. Create a WEBAPI called Consumer on API Gateway as shown, this
service gets called for every item in the Queue:
Consumer Policy file:
Consumer.xml
b. Configure Inbound Destination with the above service as shown:
Once Stop Listening checkbox from the above screen shot is unchecked and
and Saved, then Consumer service will get called number of times depending on
the Queue length, after the Consumer service reads the Queue item, it gets
deleted in the Queue. Eg: If the queue has 3 items, then it gets called 3 times.
Here’s the screen shot from View Log showing showing the Consumer service
was executed and it read the Queue contents:
Invoking Producer service populates the Queue and because Stop Listening
is unchecked in the Inbound Destination, the Consumer service gets called
immediately as you can see in the Gateway Audit Log screen shot below:
This demonstrates basic API Gateway Integration capabilities with RabbitMQ.