Operation on Topic Exchange

Before we proceed with the operation on topic exchange, TCUP Admin will first register the user to access MR service through IAM.

Create Topic Exchange

This API is used to create the exchanges of type topic in MR. The different tenants can create different topic exchanges for their use with a unique exchange name.

  • POST http://<domain name>/MessageRouting/v2.0/topicExchanges

Following input JSON is used to create a exchange:

{
  "exchangeName": "DemoExchange=",
  "type": "topic",
 }
  • Following is the response list:

    Name

    Value

    Http Method

    POST

    URL

    /topicExchange

    HTTP Return Status

    200 Ok ,400 Bad Request, 403 Forbidden:Invalid API key, 404 Invalid Payload ,500 Internal Server Error

    Content Type

    application/json

Following two methods are used to create the exchange in MR:

  • 1)Using MR API swagger

  • 2)Using MR portal

Using MR API swagger

  • On clicking on Try it out! button of API swagger with above create JSON and POST http method, the exchange gets created through API and gets the repsonse from the API as shown in the following image:

../../_images/createExchangeAPI.jpg

Using MR portal

You can also create exchange through MR portal as shown in the image below:

  • Go to home page of MR portal and click on Create Rule button as shown below:

../../_images/createExchange.jpg
  • At the bottom you will see Create Exchange button click on it as shown below:

../../_images/createExchange1.jpg
  • A pop up will be displayed, provide the exchange name and type as topic and press Submit button as shown below:

../../_images/createExchange2.jpg

Get Topic Exchange

This API is used to list all the exchanges that are created by a particular tenant in MR. The exchange list is displayed as shown in the image below:

  • GET http://<domain>MessageRouting/v2.0/topicExchanges

  • Click on GET topic exchanges API in swagger and hit Try it out! button, it wil display all the exchanges created by the user as below:

../../_images/getExchange.jpg

Get Topics on Topic Exchange

This API is used to list all the topics that are created on a topic exchange in MR. Basically it lists all the topics that are associated to each MR rule. A single topic exchange can have several topics. The process of topic association to exchange happens when a MR rule is created.

  • GET http://<domain>MessageRouting/v2.0/topicExchanges/topics

  • Click on GET topicExchanges/topics API in swagger and hit Try it out! button, it wil display all the topics associated with the exchange created by the user as below:

../../_images/getTopic.jpg

Delete a Topic Exchange

This API is used to delete a given topic exchange created by a user in MR. The exchange can only be deleted by the owner of the exchange.

  • DELETE http://<domain>MessageRouting/v2.0/topicExchanges/exchangeName

  • Click on DELETE topicExchanges/{exchangeName} API in swagger, provide the name of the topic exchange to be deleted and hit Try it out! button, it will delete the given topic exchange created by user as shown in the image below:

../../_images/deleteExchange.jpg

Warning

The given exchange can be deleted only when all MR rules created on the given exchange are deleted. In other words no MR rule should be present on the given topic exchange before you delete the given exchange.