Pavan Kalyan
Pavan Kalyan

Reputation: 1

How to check size of the anypoint mq queue from anypoint studio?

I have a scenario where if the size of queue exceeds from the 10 queues it should send email alert to the client the logice should be done in Anypoint Studio

  1. how can i check the size of the queue ( Anypoint MQ) using anypoint studio

Upvotes: 0

Views: 787

Answers (1)

aled
aled

Reputation: 25812

You can develop a Mule application in Anypoint Studio that calls Anypoint MQ REST API (using the HTTP Request connector) to read the number of messages in a queue. Note that this information is not updated in realtime as the documentation mentions.

Example URL:

https://anypoint.mulesoft.com/mq/stats/api/v1/organizations/ORGANIZATION_ID/environments/ENVIRONMENT_ID/regions/REGION_URL
/queues?destinationIds=DESTINATION_ID

Example OUTPUT:

[
  {
      "destination": "95bgpyxYsVyFE",
      "messages": 0,
      "inflightMessages": 0
  }
]

Note that you need to get an access token from Anypoint Platform to authorize the HTTP request.

Upvotes: 0

Related Questions