Messaging Binding Usage Scenario for Policy Manager (AMQP/JMS)

Learn how to create an AMQP binding for REST, Messaging, and SOAP services and use with a virtual service.

Table of Contents

Introduction

This topic describes how to perform the following tasks in Akana Policy Manager.

  • Create AMQP binding for services of any type (REST, Messaging, SOAP).
  • Create a virtual service that provides a messaging (AMQP or JMS) interface to one or more existing services of any type (REST, Messaging, SOAP).
  • Create a virtual service that provides a RESTful interface for placing messages into a JMS or AMQP queue and pulling messages from the queue.

Step 1—Add Messaging Binding (AMQP or JMS)

  1. Launch the Policy Manager Management Console.
  2. On the right, under Actions, choose Create Physical Service, and then create a physical service using the WADL file at http://www.ebi.ac.uk/ebisearch/ws/rest?_wadl.
  3. Go to Configure > Registry > Bindings and select Add Binding.
  4. Select the service you just added.

    Messaging Binding

  5. On the next screen, for Binding Type, choose Messaging, as shown below.

    Messaging Binding

  6. On the next screen, select AMQP as the Transport protocol.
  7. Provide Destination and Reply To fields with desired I/O/Fault Serializations.
  8. Select Part Type in Parts section. This section is used to assign Path parameters, Query parameters, Body parameters (for example, http://agubba-e6420:9901/VS/{domainid}/entry/{entryids}?fields={fields}&fieldurl={fieldurl}&viewurl={viewurl}&format{format}) is the URL to hit. In this case, the Binding screen configuration should be something like:

    Messaging Binding

    In the above example, the request will go to the following URL:

    http://agubba-e6420:9901/VS/uniprot/entry/WAP_RAT,WAP_MOUSE?fields=descAltName,organism_scientific_name&fieldurl=true&viewurl=true&format=json

  9. Provide an XPath or SQL query for Use selector option (for example, Operation='get').
  10. After adding the required fields, finish the process.

Similarly, select JMS in Transport field, if you want to have a Messaging Binding over JMS protocol.

Step 2—Add AMQP Listener

  1. Select the Containers folder where you will be adding the AMQP listener and select Add Listener.
  2. Select the AMQP Listener type.
  3. Add an AMQP listener with details as shown below.

    Messaging Binding

Step 3—Add JMS Listener

  1. Select the Containers folder and Network Director (ND1) container where you will be adding the JMS listener, and select Add Listener.
  2. Select the JMS listener type.
  3. Add the JMS listener with details as shown below.

    Messaging Binding

Step 4—Assign Messaging Binding to Service

  1. Select the Services folder for the Physical Service. In the Service Overview section select Manage in the Interfaces and Bindings section.

    Messaging Binding

  2. On the Select Interfaces screen, select the Messaging Binding and assign it to the service (copy to the Interfaces Assigned panel), and complete the wizard.

    Messaging Binding

    Messaging Binding

  3. Select Virtualize Service and virtualize the physical service on the AMQP/JMS listener on Network Director (ND1), and assign a service name (for example, VS1).

    Messaging Binding

  4. The virtual service should be hosted on the ND1 where we have previously added the AMQP/JMS listeners.

    Messaging Binding

Step 5—Send Requests to API Using ActiveMQ

  1. Network Director (ND1) must be connected to an AMQP broker such as apache-activemq-5.10.0.
  2. Run ActiveMQ.

    Messaging Binding

  3. Access the activeMQ client at http://agubba-e6420:8161/admin/.
  4. Go to the Queues tab or Topics tab depending on the destination type used during Messaging Binding creation.
  5. Select the Queue; in this scenario, dynamicQueues/dest5.

    Messaging Binding

  6. Find the destination name and click SendTo.
  7. Provide the appropriate Correlation ID, ReplyTo and Message Body and send the request.

    Messaging Binding

Step 6—Create Virtual Service to Provide RESTful Interface for Placing Messages

  1. Virtualize the above service on Network Director (ND2) with HTTP binding, and assign a name (for example, VS2).
  2. Send requests to VS2.
  3. The requests will hit the VS1 > physical service.

    Messaging Binding

And the response is seen.

Step 7—Logging

  1. If the Detailed Auditing policy is attached to VS1 and VS2, usage logs will be generated.
  2. VS2 logs:

    Messaging Binding

    Messaging Binding

    Messaging Binding

    Messaging Binding

  3. VS1 logs:

    Messaging Binding

    Messaging Binding

    Messaging Binding