Anypoint MQ Depth API Specification Design Brief

Jyothikiran sale
5 min readAug 7, 2023

--

INDEX:

Introduction

Challenges

Current setup

Approaches

Proposed steps to implement Anypointmq-depth API

AnypointMQ-depth-API Sequence Diagram

Explanation

Introduction

  • For customers using Anypoint MQ this is a one-place stop for getting queue names in a list format in which messages have crossed the threshold limit.
  • For customers using Anypoint MQ this is a one-place stop for transferring or moving messages from source queue to destination queue.
  • Customers can move the desired number of messages from source to destination.
  • Customers can use this either schedule-based or listener based.
  • Customers can log and have responses of the queues crossing the threshold limit in a detailed format containing business group, region, and environment.
  • Easy to check if a queue is present in the organization based on the queue name.
  • If a queue name is passed in the request it will return the number of messages present in the queue and the business group, region, and environment it belongs to.
  • If the source queue, destination queue names, number of messages, client app id and secret is sent in the request it will return the number of messages transferred.

Challenges

  1. Customers have challenges tracking AnypointMQs in multiple business groups with numerous environments and regions.
  2. Customers today need to monitor queues across their organization on a schedule based especially for Ops teams, that has messages sitting in them exceeding the threshold limit.
  3. Customers don’t have a place to get an aggregated view of queues across all the business groups.
  4. It consumes time and effort to manually loop through each environment in the business group and each region.
  5. Connected app is not supported by Anypoint MQ Admin REST API or Anypoint MQ Stats API.

Current setup

  • To achieve queue details, present in regions, environments, and org, it can be done manually with a user having access to all queues, environments, and organizations.
  • To perform this step every time manually is tiring and not a recommended process.
  • If the customer decides to build an API, it will take around a week or more to discover Anypoint MQ Admin APIs and integrate them to Anypoint MQ Stats API.
  • Hence customers have to invest time, energy, and efforts in developing and testing to make this happen.

Explanation

  • Queue Depth API can be a listener or scheduler based on the customer requirement.
  • This API will produce the details including environment ID and org ID of the queue requested or queue having messages crossing the threshold limit.
  • This API can be configured with the Threshold limit in the property files to get the queue details for only the once exceeding that threshold limit.
  • Queue Depth API can be configured with multiple regions mentioned in the property files based on where the customer created their queues.
  • Queue Depth API configured with connected app and service account, which will take care of Anypoint MQ Admin REST API or Anypoint MQ Stats API logins, giving you fine stats of the Queues.

Approaches

To overcome the challenges, we can consider the below approaches.

Proposed steps to implement Anypointmq-depth API

Customers can now address these challenges by utilizing the AnypoitnMQ queue depth API.

  1. Download the latest version of Anypointmq-depth from the Anypoint exchange or clone code from GIT.
  2. Import into local Anypoint studio.
  3. Go to Dev property files under the config folder and edit as mentioned below:
  • Update the Username and password with the service account username and password.
  • Update the client_id and client_secret with your Connected app client ID and secret.
  • If you want your queues to be checked in more than one region, mention the region names in the regions array on line 17.

4. Save the changes made and deploy on local and test the API.

5. Use the below command to get results of all the available queues present in your Anypoint MQ’s

CURL command:

curl — location — request GET ‘http://localhost:8081/queueInfo?message=true'

Screenshot:

6. Use the below command and in the ‘queue’ query param enter the valid queue name present on your organization’s Anypont MQ’s

CURL command:

curl — location — request GET ‘http://localhost:8081/queueInfo?queue=Mulesoft-Sandbox-DeadLetterQueue'

Screenshot:

7. After testing the API, create other environment property files as per your organization and deploy it your Anypoint platform and test the API.

8. After testing on the Anypoint platform, you can have anypointmq-depth API call triggered via URL or by setting up the schedule.

Limitations:

  • There is no support currently for the connected app talking to Anypoint mq stats API.
  • Customer has to create a connected app to connect AnypointMQ admin REST API and that will fetch you business groups and environment present. But customers should create a service account with the MFA disabled so that the bearer token gets generated because the API can’t go through the MFA for the account every time and this token is used to fetch the Queue details from the AnypointMQ Stats REST API.

Note: Tentative date for connected App support for anypoint stats API feature to be available is at the end of September 2022.

AnypointMQ-depth-API Sequence Diagram:

Explanation

  • Queue Depth API can be a listener or scheduler based on the customer requirement.
  • This API will produce the details including environment ID and org ID of the queue requested or queue having messages crossing the threshold limit.
  • This API can be configured with the Threshold limit in the property files to get the queue details for only the once exceeding that threshold limit.
  • Queue Depth API can be configured with multiple regions mentioned in the property files based on where the customer created their queues.
  • Queue Depth API configured with connected app and service account, which will take care of Anypoint MQ Admin REST API or Anypoint MQ Stats API logins, giving you fine stats of the Queues.

Enhancement:

Furthermore, an extension to the Anypoint MQ Depth API introduces an enhanced capability, enabling seamless message transfers between queues. For more detailed information on this feature, please refer to the documentation provided here.

--

--