REST Interface
CrimsonQ has its own REST API
You can control CrimsonQ from REST APIs, whether you need to manage the consumers, or push messages or even consume them. The only downside with REST APIs is the lack of constant connectivity to the server to know when a message is enqueued in the queue. This can be done with the Websocket connection though.
We recommend to use the RESP interface with your applications to communicate with the CrimsonQ.
CrimsonQ by default opens port 8080 and exposes the commmands to HTTP://DOMAIN:8080/api
path.
If you use the REST interface you will need to poll the route /api/msg/counts/:consumerId
with a timer, this keeps the consumer alive and not expire, this will also allow you to know if new messages have arrived to the pending state.
Authentication
To authenticate and be able to use the REST API you will need to generate a JWT token by authenticating through POST /login
and pass Form data Username
& Password
. This will return a JWT token in a JSON Object, you will then need to use the JWT token to authenticate with every API request by sending the token as Authorization as Bearer.
REST Commands
You can find the list of commands you can use below;
GET
/api/command
{JSON} List of comands
GET
/api/consumer/concurrency/ok/:consumerId
consumerId
{JSON} Returns true or false depending on if the consumer has bandwidth to process messages
GET
/api/consumer/info/:consumerId
consumerId
{JSON} Returns consumer information.
GET
/api/consumer/exists/:consumerId
consumerId
JSON
GET
/api/consumer/list
{JSON} List of all consumers
GET
/api/consumer/topics/get/:consumerId
consumerId
{JSON} Returns the topics the consumer is listening on
GET
/api/info
{JSON} CrimsonQ Server Information
GET
/api/msg/counts/:consumerId
consumerId
{JSON} List Count of messages grouped by status
GET
/api/msg/keys/:consumerId
consumerId
{JSON} List of all keys prefixed with status
GET
/api/msg/list/json/:consumerId/:status
consumerId - status
{JSON} Gets all of the messages' body for a spesific consumerId and Status
GET
/api/msg/pull/:consumerId
consumerId
{JSON} Pulls and returns a message with its body
GET
/api/ping/:messageString
messageString
{JSON} Returns Pong! + [messageString]
POST
/login
Username - Password
{JSON} JWT Token
POST
/api/consumer/concurrency/set
consumerId - concurrency
{JSON} ok or Error
POST
/api/consumer/create
consumerId - topics - concurrency
{JSON} ok or Error
POST
/api/consumer/destroy
consumerId
{JSON} ok or Error
POST
/api/consumer/flush/complete
consumerId
{JSON} ok or Error
POST
/api/consumer/flush/failed
consumerId
{JSON} ok or Error
POST
/api/consumer/topics/set
consumerId - topics
{JSON} ok or Error
POST
/api/msg/complete
consumerId - messageId
{JSON} ok or Error
POST
/api/msg/del
consumerId - status - messageId
{JSON} ok or Error
POST
/api/msg/fail
consumerId - messageId - errMsg
{JSON} ok or Error
POST
/api/msg/push/consumer
consumerId - messageString
{JSON} ok or Error
POST
/api/msg/push/topic
topicString - messageString
{JSON} ok or Error
POST
/api/msg/retryall
consumerId
{JSON} ok or Error
POST
/api/msg/retry
consumerId - messageId
{JSON} ok or Error
Last updated
Was this helpful?