RESP Interface

RESP (REdis Serialization Protocol) is a protocol built by REDIS to communicate with Redis servers. To make things easier for our CrimsonQ users, we have decided to also implement the same protocol. This will allow developers to connect to CrimsonQ using any Redis library or Redis-Cli tool that supports custom commands. See advanced topics for more information.

To use the RESP you can simply connect to the server using the Redis-Cli command tool, or for a more smooth experience you can use Crimsonq-Cli command tool.

Using crimsonq-cli
Using redis-cli

The commands that can be used with the RESP protocol is as follows;

AUTH

password [string]

COMMAND

no arguments

[String Array] of commands and argumetns in the format ["cmd_name [arg1] [arg2] [arg3]"]

CONSUMER.CREATE

  1. consumerId [string]

  2. topics [string]

  3. concurrency [int]

Topics are passed over as a string with comma separated. eg: "/path1/p2,/topic1/t2"

CONSUMER.DESTROY

consumerId [string]

Destroies the consumer and all the data.

CONSUMER.EXISTS

consumerId [string]

string "true" or "false"

Checks if consumer exists or not.

CONSUMER.FLUSH.FAIL

consumerId [string]

Deletes all failed messages for consumerId

CONSUMER.FLUSH.COMPLETE

consumerId [string]

Deletes all complete messages for consumerId

CONSUMER.LIST

[String Array] of all consumers

Returns a list of all the consumers that have queues.

CONSUMER.TOPICS.GET

consumerId [string]

[String Array]

Returns a list of topics that a consumer is subscribed to get messages from.

CONSUMER.TOPICS.SET

  1. consumerId [string]

  2. topics [string]: comma separate in string

Sets the list of topics that a consumer is subscribed to get messages on.

MSG.COMPLETE

  1. consumerId [string]

  2. messageKey[string]

[String Array]

Returns a list of topics that a consumer is subscribed to get messages from.

MSG.COUNTS

consumerId [string]

[String Array] of message counts grouped by status

The returned array has strings with counts in format ["status:10"]

MSG.DEL

  1. consumerId [string]

  2. status [string]

  3. messageKey[string]

Deletes a message from a consumer queue based on its status and key

MSG.FAIL

  1. consumerId [string]

  2. messageKey[string]

  3. error[string]

Mark and active or delayed message as failed, and will move it to failed status. An error message can be sent and stored in the message for refference.

MSG.KEYS

consumerId [string]

[String Array] [Status:MessageKey]

Returns a list of all Messages with status and keys

MSG.LIST.JSON

  1. consumerId [string]

  2. status[string]

[JSON ] : Messages

Returns a JSON will all messages and information for a status

MSG.PULL

consumerId [string]

[JSON]: Message

Pulls a new message from the queue in JSON. You should then call msg.fail or msg.complete after the pull, if it takes too long to process it will move to delayed, then failed automatically

MSG.PUSH.CONSUMER

  1. consumerId [string]

  2. messagePayload [string]

Push a message to a single consumer by its consumerId. The payload will be in string format.

MSG.PUSH.TOPIC

  1. topic [string]

  2. messagePayload [string]

Pushes the message to all consumers that subscribe to a topic match. See MQTT Topic Matching.

MSG.RETRY

  1. consumerId [string]

  2. messageKey [string]

Re-Queue a message that failed, placing it on top of the queue to be re-pulled.

MSG.RETRYALL

consumerId [string]

Re-Queue all the failed messages, putting them back on top of queue

PING

message[string]

[String] "Pong! {message}"

Quit

Connection to the server is gracefully dropped.

INFO

Returns server information

CONSUMER.CONCURRENCYOK

consumerId [string]

Checks if the number of active messages are still less than the concurrency threshold provided to the consumer.

CONSUMER.INFO

consumerId [string]

[JSON String] with consumer information

This returns the consumer information.

Last updated

Was this helpful?