Skip to content

Instantly share code, notes, and snippets.

@gastrodon
Created September 27, 2020 18:59
Show Gist options
  • Save gastrodon/e7774b707406952382adc208c83350d1 to your computer and use it in GitHub Desktop.
Save gastrodon/e7774b707406952382adc208c83350d1 to your computer and use it in GitHub Desktop.
GET /queues

GET a list of queues, with some information about them queues returned are ordered firstly by creation time, secondly by UUID

Responses

  • 200

    A list of queues

    Body

{
    "queues": [
        {
            "id": "queue UUID",
            "name": "queue name",
            "ephemeral": "is this queue ephemeral?",
            "size": "int size of this queue"
        },
        "..."
    ],
    "count": {
        "queues": "int length of the queues list"
    }
}
POST /queues

Create a queue

Body
name type description default
name string Name of this queue. Can be used instead interchangeably with its id in API calls, and so it should be unique random
ephemeral bool Is this queue ephemeral? Ephemeral queues are not backed by any storage, but instead are completely in memory. This allowes them to be written to read read from quickly, but they are lost when the server goes down false
capacity int or null The capacity of this queue If messages are pushed onto a full queue, whatever is on the head is pushed out in a fifo style. If the capacity is null, the queue has an unlimited size null

Body

{
    "name": "queue name",
    "ephemeral": "is this queue ephemeral?"
}

Responses

  • 200

    The queue was created

GET /queues/:queue

Get information about this queue

Responses

  • 200

    Information about this queue

    Body

{
    "queue": {
        "id": "queue UUID",
        "name": "queue name",
        "ephemeral": "is this queue ephemeral?",
        "size": "int size of this queue"
    }
}
  • 400

    Nothing was found here

    Body

{
    "error": "not_found"
}
PUT /queues/:queue

Put a message onto the tail of this queue If this queue does not exist, it will be created populated with the sent message

Responses

  • 201

    The message was put onto the queue's tail

DELETE /queues/:queue

Delete this queue Multiple calls are idempotent, so if there is no queue targeted nothing will happen

Responses

  • 204

    Queue was deleted

GET /queues/:queue/consume/:index

Consume a message from this queue Consuming a message will return its content, and delete it from the queue. Indexing is 0 based, starting from the head, where the most recent message will be

Responses

  • 200

    Whatever is on the queue at this index

  • 400

    Nothing is on the queue here

GET /queues/:queue/head

Pop the next message on this queue This will consume the item at the queue's head This is equivalent to GET /queues/:queue/consume/0

Responses

  • 200

    Whatever is on this queue's head

  • 400

    Nothing is on the queue here

GET /queues/:queue/peek/:index

Read a message from this queue without consuming it This functions similarly to /consume, but does not consume messages when they are read. Thus allowing you to "peek" at messages

Responses

  • 200

    Whatever is on the queue at this index

  • 400

    Nothing is on the queue here

GET /queues/:queue/tail

Get the last message on this queue This will consume the items at the queue's tail This is equivalent to GET /queues/:queue/consume/<len> where <len> == this queue's length - 1

Responses

  • 200

    Whatever is on this queue's tail

  • 400

    Nothing is on the queue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment