# RESP Interface

<mark style="color:red;">**RESP**</mark> (<mark style="color:red;">**RE**</mark>dis <mark style="color:red;">**S**</mark>erialization <mark style="color:red;">**P**</mark>rotocol) 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](https://docs.crimsonq.io/server-interfaces/crimsonq-cli).&#x20;

![Using crimsonq-cli ](https://3713973315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuOHtyPxI0oLKt0hKkbnx%2Fuploads%2F46EJsIJPBkW5zACt9H1O%2FScreenshot%202022-02-18%20193619.png?alt=media\&token=f6401604-b832-4ecf-bacb-0b56d9ba2101)

![Using redis-cli](https://3713973315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuOHtyPxI0oLKt0hKkbnx%2Fuploads%2FWt8xJAoC1mYXbuYAmnYc%2FScreenshot%202022-02-18%20193925.png?alt=media\&token=c4edae4a-380c-4510-b880-9fd3b586e8ac)

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

| AUTH                    | *password \[string]*                                                                        |                                                                                                |                                                                                                                                                                                                |
| ----------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| COMMAND                 | *no arguments*                                                                              | \[String Array] of commands and argumetns in the format \["cmd\_name \[arg1] \[arg2] \[arg3]"] |                                                                                                                                                                                                |
| CONSUMER.CREATE         | <ol><li>consumerId \[string]</li><li>topics \[string]</li><li>concurrency \[int]</li></ol>  |                                                                                                | <p>Topics are passed over as a string with comma separated. eg: "/path1/p2,/topic1/t2"<br></p>                                                                                                 |
| 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     | <ol><li>consumerId \[string]</li><li>topics \[string]: comma separate in string</li></ol>   |                                                                                                | Sets the list of topics that a consumer is subscribed to get messages on.                                                                                                                      |
| MSG.COMPLETE            | <ol><li>consumerId \[string]</li><li>messageKey\[string]</li></ol>                          | \[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                 | <ol><li>consumerId \[string]</li><li>status \[string]</li><li>messageKey\[string]</li></ol> |                                                                                                | Deletes a message from a consumer queue based on its status and key                                                                                                                            |
| MSG.FAIL                | <ol><li>consumerId \[string]</li><li>messageKey\[string]</li><li>error\[string]</li></ol>   |                                                                                                | 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           | <ol><li>consumerId \[string]</li><li>status\[string]</li></ol>                              | \[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       | <ol><li>consumerId \[string]</li><li>messagePayload \[string]</li></ol>                     |                                                                                                | Push a message to a single consumer by its consumerId. The payload will be in string format.                                                                                                   |
| MSG.PUSH.TOPIC          | <ol><li>topic \[string]</li><li>messagePayload \[string]</li></ol>                          |                                                                                                | Pushes the message to all consumers that subscribe to a topic match. *See MQTT Topic Matching.*                                                                                                |
| MSG.RETRY               | <ol><li>consumerId \[string]</li><li>messageKey \[string]</li></ol>                         |                                                                                                | 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.                                                                                                                                                         |
