Download OpenAPI specification:Download
Querator is a Distributed Durable Execution System built on top of an Almost Exactly Once Delivery (AEOD) Queue.
Querator provides high-throughput, lease-based queue operations with Almost Exactly Once Delivery semantics. Unlike streaming systems, items are leased to consumers who gain exclusive processing rights until completion or retry.
Support for scheduled item delivery via enqueue_at timestamps, enabling delayed processing and retry scheduling.
The API follows a lease-based workflow:
All operations support batch processing for high throughput scenarios.
Querator supports pluggable storage backends with minimal requirements (ordered primary keys only):
For more information, visit querator.io or the GitHub repository.
Core queue operations including produce, lease, complete, retry, and queue management.
Queue Operations:
queue.produce - Add items to queues with optional schedulingqueue.lease - Lease items for exclusive processingqueue.complete - Mark leased items as successfully processedqueue.retry - Retry failed items or move to dead letter queuequeue.stats - Get queue performance statisticsqueue.clear - Clear queue data (destructive operation)Queue Management:
queues.create - Create new queues with specified configurationqueues.list - List all available queues with paginationqueues.info - Get detailed information about a specific queuequeues.update - Update queue configurationqueues.rebalance - Give every queue the partitions its requested count and the saved affinities call forqueues.delete - Delete queues and associated dataStorage Operations:
storage/items.* - Direct storage inspection and manipulationProduce an item on a queue. Calls to the endpoint may provide multiple items to produce. The call will not return until all items provided have been written to storage.
The call will return when the item(s) provided are written to storage or when request_timeout has been reached. If the call returns with a non 200 response code, the client should consider the items provided as not written to the queue. The client should NOT cancel the request before request_timeout has been reached. If the call fails to return after request_timeout is reached the client can safely cancel the request.
| queue_name required | string The name of the queue |
| request_timeout required | string Default: "5m" The duration this request should block before the client will cancel the request |
required | Array of objects (QueueProduceItem) [ 1 .. 1000 ] items List of items to be queued |
{- "queue_name": "queue-name",
- "request_timeout": "30s",
- "items": [
- {
- "encoding": "application/json",
- "kind": "webhook-v2",
- "reference": "account-1234",
- "utf8": "{\"key\":\"value\"}"
}, - {
- "encoding": "application/json",
- "kind": "webhook-v2",
- "reference": "account-5323",
- "bytes": "eyJrZXkiOiJ2YWx1ZSJ9"
}
]
}{- "code": 200
}Lease a items from the requested queue. When a items is lease by a consumer, that consumer gains exclusive rights to the items. No other consumer will be provided the same items unless the lease_deadline has expired
and the consumer with the lease has not marked the items via /queue.complete or /queue.retry
If a items is not acknowledge via /queue.complete within the lease_deadline period it will be offered to another consumer.
The call will return when a lease is successful or when request_timeout has been reached. If the call returns with a 454 Retry Request response code, this means there were no items in the queue and the request_timeout was reached. In this case the client should retry the lease request.
The client should NOT cancel the request before request_timeout has been reached. If the call fails to return after request_timeout is reached the client can safely cancel the request.
| queue_name required | string The name of the queue |
| client_id required | string A unique id which identifies this client. Duplicate client id's are not allowed |
| request_timeout required | string Default: "1m" The duration this request should block before the client will cancel the request. |
| batch_size | integer [ 1 .. 1000 ] The maximum number of items to be leased for this request |
{- "queue_name": "queue-name",
- "batch_size": 1000,
- "client_id": "client-01",
- "request_timeout": "30s"
}{- "items": [
- {
- "encoding": "application/json",
- "kind": "webhook-v2",
- "reference": "account-1234",
- "id": "2m75RTp9PBx69hw1Q7mjoB0F73Q",
- "lease_deadline": "2024-07-02T20:50:49.366215Z",
- "bytes": "R29vZCBuZXdzIGV2ZXJ5b25lLCBteSBJUSB0ZXN0IGNhbWUgYmFjayBuZWdhdGl2ZQ=="
}
], - "queue_name": "webhooks",
- "partition": 0
}Retry an item to be processed again at a later date/time. Once the retry_at time is reached, querator will enqueue this item into the specified queue and the attempted counter for this item will increment by 1.
If the item should not be retried, but failed immediately. Set dead: true and the item will be placed in the dead letter queue regardless of the number of attempts left on the items.
If you wish to fail a items such that it is deleted from the queue and never offered to another consumer, nor placed into the dead letter queue, then call /queue.complete instead.
| queue_name required | string The queue name provided when the item was leased. If the |
| partition required | integer The partition provided when the item was leased. If the |
required | Array of objects (QueueRetryItem) |
{- "queue_name": "queue-name",
- "partition": 0,
- "items": [
- {
- "id": "2m75RTp9PBx69hw1Q7mjoB0F73Q",
- "retry_at": "2024-01-01 12:00:00.0000",
- "dead": false
}, - {
- "id": "2m75RTp9PBx69hw1Q7mjoB0F73R",
- "retry_at": "2024-01-01 12:00:00.0000",
- "dead": false
}, - {
- "id": "2m75RTp9PBx69hw1Q7mjoB0F73S",
- "retry_at": "2024-01-01 12:00:00.0000",
- "dead": false
}
]
}{- "code": 200
}Mark leased items as completed. The item can then be removed from the queue by Querator and will not be offered to any other consumers.
If any of the ids provided cannot be marked as completed then the entire request will be rejected with a code 453 Request Failed. It is the responsibility of the client to remove the offending id and try again.
The call will return when the id(s) provided are completed to storage or when request_timeout has been reached. If the call returns with a non 200 response code, the client should consider the items provided as not completed to the queue. The client should NOT cancel the request before request_timeout has been reached. If the call fails to return after request_timeout is reached the client can safely cancel the request.
| queue_name required | string The name of the queue these ids are from |
| partition required | integer The Partition these ids are from |
| request_timeout required | string The duration this request should block before the client will cancel the request |
| ids required | Array of strings A list of the item ids to mark as complete |
{- "queue_name": "queue-name",
- "partition": 0,
- "request_timeout": "30s",
- "ids": [
- "id-1234",
- "id-1235",
- "id-1236"
]
}{- "code": 200
}List all the available queues
| pivot required | string The name of the queue to pivot upon when paging through lists of queues |
| limit required | integer <= 1000 The maximum number of items to return in a single list response |
{- "pivot": "queue-302",
- "limit": 500
}{- "items": [
- {
- "name": "queue-1",
- "created_at": "2024-01-01 12:00:00.0000",
- "updated_at": "2024-01-01 12:00:00.0000",
- "dead_queue": "queue-1-dead",
- "reference": "jake@statefarm.com",
- "lease_timeout": "60m",
- "expire_timeout": "24h",
- "max_attempts": 10,
- "requested_partitions": 5
}, - {
- "name": "queue-2",
- "created_at": "2024-01-01 12:00:00.0000",
- "updated_at": "2024-01-01 12:00:00.0000",
- "dead_queue": "queue-2-dead",
- "reference": "jake@statefarm.com",
- "lease_timeout": "60m",
- "expire_timeout": "24h",
- "max_attempts": 20,
- "requested_partitions": 100
}
]
}Create a new queue with the provided characteristics. requested_partitions may be at most 1024; larger requests are rejected with an invalid-option error (HTTP 400).
| queue_name required | string The name of the queue |
| created_at required | string <date-time> The timestamp the queue was created |
| updated_at required | string <date-time> The timestamp the queue was last updated |
| dead_queue required | string The name of the dead letter queue for this queue. If this is a dead letter queue then this field will be empty when retrieved via |
| reference required | string This is a user supplied field which could contain metadata or specify who owns this queue |
| lease_timeout required | string The default lease timeout for this queue |
| expire_timeout required | string How long an item can wait in the queue regardless of attempts before it is moved to the dead letter queue |
| max_attempts required | integer The maximum number of times an item can be retried by a consumer before it is placed in the dead letter queue or removed. Infinite attempts if max_attempts is set to '0'. |
| requested_partitions required | integer The number of partitions this queue has requested. |
Array of objects (PartitionInfo) The partitions of this queue and the storage backend which holds each one. Set by Querator; ignored by | |
object (QueuePendingRebalance) What a rebalance would change for this queue, worked out on each | |
| rebalance_refused | string Why a rebalance would be refused. A backend with affinity above 0 missing from the config file, and no backend able to take partitions, use the words |
{- "queue_name": "queue-name",
- "dead_queue": "queue-name-dead",
- "reference": "jake@statefarm.com",
- "lease_timeout": "60m",
- "expire_timeout": "24h",
- "max_attempts": 10,
- "requested_partitions": 25
}"{\n \"code\": 200,\n\n}"Update the details of a queue. A field the request leaves out, or sends as null, keeps its current value. To remove the dead letter queue send "dead_queue": "", to remove the reference send "reference": "", and to allow unlimited attempts send "max_attempts": 0.
| queue_name required | string The name of the queue to update |
| dead_queue | string The name of the dead letter queue for this queue. Left out, the current dead letter queue is kept. An empty string removes it. |
| reference | string A user supplied field which could contain metadata or specify who owns this queue. Left out, the current reference is kept. An empty string removes it. |
| lease_timeout | string The default lease timeout for this queue. Left out, empty or '0s', the current lease timeout is kept. |
| expire_timeout | string How long an item can wait in the queue regardless of attempts before it is moved to the dead letter queue. Left out, empty or '0s', the current expire timeout is kept. |
| max_attempts | integer The maximum number of times an item can be retried by a consumer before it is placed in the dead letter queue or removed. Left out, the current limit is kept. '0' allows unlimited attempts. |
| requested_partitions | integer The number of partitions this queue has requested. Left out or '0', the current count is kept. Above 1024 is rejected and nothing is saved. |
| created_at | string <date-time> Accepted so a request can carry back what |
| updated_at | string <date-time> Accepted so a request can carry back what |
| namespace | string Accepted so a request can carry back what |
Array of objects (PartitionInfo) Accepted so a request can carry back what |
{- "queue_name": "queue-name",
- "dead_queue": "queue-name-dead",
- "reference": "account-12345",
- "lease_timeout": "60m",
- "expire_timeout": "24h",
- "max_attempts": 35
}{- "code": 200
}Returns the queue's saved settings next to the partitions it is running. pending lists the partitions a rebalance would create and the ones it would mark draining, and is left out when a rebalance would change nothing. rebalance_refused gives the reason when a rebalance would be refused. /queues.list returns the same fields for each queue it lists.
| queue_name required | string The name of the queue to retrieve info about |
{- "queue_name": "queue-name"
}{- "name": "queue-name",
- "created_at": "2024-01-01 12:00:00.0000",
- "updated_at": "2024-01-01 12:00:00.0000",
- "dead_queue": "queue-name-dead",
- "reference": "jake@statefarm.com",
- "lease_timeout": "60m",
- "expire_timeout": "24h",
- "max_attempts": 50,
- "requested_partitions": 456
}Delete a queue and all associated data. Use the force parameter to delete queues that have active items or leases.
| queue_name required | string The name of the queue to delete |
| force required | boolean force indicates the deletion should ignore any current open leases or items in the queue and delete all data related to the queue. In addition, this forcibly cancels all in progress client lease requests. |
{- "queue_name": "queue-name",
- "force": true
}{- "code": 200
}Retrieve statistics about a queue. Queue stats provide information on the health of a partition in a queue
| queue_name required | string |
{- "queue_name": "queue-name"
}{- "queue_name": "queue-name",
- "logical_queues": [
- {
- "produce_waiting": 12,
- "lease_waiting": 32,
- "complete_waiting": 2,
- "in_flight": 54,
- "partitions": [
- {
- "partition": 0,
- "total": 65012,
- "total_leased": 5000,
- "average_age": "1m23s",
- "average_leased_age": "43s"
}
]
}, - {
- "produce_waiting": 12,
- "leased_waiting": 32,
- "complete_waiting": 2,
- "in_flight": 54,
- "partitions": [
- {
- "partition": 1,
- "total": 65012,
- "total_leased": 5000,
- "average_age": "1m23s",
- "average_leased_age": "43s"
}, - {
- "partition": 2,
- "total": 650133,
- "total_leased": 5000,
- "average_age": "1m23s",
- "average_leased_age": "43s"
}
]
}
]
}Clears items from a queue. Items scheduled for retry are scheduled items, and only the scheduled flag removes them.
| queue_name required | string The name of the queue to clear |
| scheduled required | boolean Indicates any 'scheduled' items in the queue will be cleared. If true, every item still waiting to be enqueued is removed, including one whose enqueue time has passed but which has not yet moved into the queue, and items scheduled for retry. Only this flag removes scheduled items. |
| queue required | boolean Indicates any items currently waiting in the FIFO queue will clear. If true, any items in the queue which have NOT been leased will be removed. |
| destructive required | boolean Indicates the Queue operation should be destructive in that items are removed regardless of lease status. Scheduled items are kept unless Scheduled is also set. For example, if used with ClearRequest.Queue = true, then ALL items in the queue regardless of lease status will be removed. This means that clients who currently have ownership of those items will not be able to "complete" those items, as querator will have no knowledge of those items. |
{- "queue_name": "queue-name",
- "scheduled": false,
- "queue": true,
- "destructive": true
}{- "code": 200
}List items in a queue partition
| queue_name required | string |
| partition required | integer |
| pivot required | string |
| limit required | integer |
{- "queue_name": "string",
- "partition": 0,
- "pivot": "string",
- "limit": 0
}{- "items": [
- {
- "id": "string",
- "is_leased": true,
- "lease_deadline": "2019-08-24T14:15:22Z",
- "dead_deadline": "2019-08-24T14:15:22Z",
- "expire_deadline": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "enqueue_at": "2019-08-24T14:15:22Z",
- "attempts": 0,
- "max_attempts": 0,
- "reference": "string",
- "encoding": "string",
- "kind": "string",
- "payload": "string"
}
]
}Import items into a partition
| queue_name required | string |
| partition required | integer |
required | Array of objects (StorageItem) |
{- "queue_name": "string",
- "partition": 0,
- "items": [
- {
- "id": "string",
- "is_leased": true,
- "lease_deadline": "2019-08-24T14:15:22Z",
- "dead_deadline": "2019-08-24T14:15:22Z",
- "expire_deadline": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "enqueue_at": "2019-08-24T14:15:22Z",
- "attempts": 0,
- "max_attempts": 0,
- "reference": "string",
- "encoding": "string",
- "kind": "string",
- "payload": "string"
}
]
}{- "items": [
- {
- "id": "string",
- "is_leased": true,
- "lease_deadline": "2019-08-24T14:15:22Z",
- "dead_deadline": "2019-08-24T14:15:22Z",
- "expire_deadline": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "enqueue_at": "2019-08-24T14:15:22Z",
- "attempts": 0,
- "max_attempts": 0,
- "reference": "string",
- "encoding": "string",
- "kind": "string",
- "payload": "string"
}
]
}| queue_name required | string |
| partition required | integer The partition number these ids belong to |
| ids required | Array of strings |
{- "queue_name": "string",
- "partition": 0,
- "ids": [
- "string"
]
}{- "code": 200
}Gives every queue the partitions its requested partition count and the saved affinities call for. A partition a storage backend should no longer hold becomes draining, and new partitions are created on the backends that hold too few. Calling it again finishes a rebalance that stopped part way. Refused with nothing changed when no storage backend has an affinity above 0, or when a storage backend with an affinity above 0 is missing from this instance's config file. The reply counts what was saved and does not say a drain finished. It also lists in waiting_queues every queue with one partition that has a draining partition on a storage backend missing from this instance's config file, whether or not this call changed it. Such a queue leases nothing once it reaches that partition, which is when the partitions before it are empty, until the backend is back in the config file. The list is empty when no queue is in that state. A queue with more than one partition and a backend that is in the config file but down are not listed. Needs the queue.rebalance permission in the _system namespace.
Takes no fields.
{ }{- "queues_changed": 1,
- "partitions_created": 2,
- "partitions_draining": 1,
- "waiting_queues": [
- {
- "queue_name": "orders",
- "namespace": "_system",
- "backend": "disk-b",
- "partition": 0
}
]
}Saves the affinity. Left out, it keeps its saved value. Rejects a negative or non-finite affinity, and a backend with no saved record that is also not in this instance's config file. Never changes where a partition lives. Needs the backend.update permission in the _system namespace.
| backend required | string The storage backend's name. |
| affinity | number <double> >= 0 How large a part of every queue's partitions the backend holds. Zero means none. Left out, the saved affinity is kept. |
{- "backend": "postgres-1",
- "affinity": 0
}{- "code": 200
}Lists every storage backend with a saved record. Replies even when a storage backend is down. Takes no filter and does not page. Needs the backend.list permission in the _system namespace.
Takes no fields.
{ }{- "backends": [
- {
- "backend": "string",
- "affinity": 0.1,
- "configured": true,
- "safe_to_stop": true,
- "partitions": [
- {
- "queue_name": "string",
- "partition": 0,
- "state": "available",
- "unleased": 0,
- "leased": 0,
- "scheduled": 0,
- "failures": 0
}
], - "pending": {
- "create": [
- {
- "queue_name": "string",
- "partitions": [
- 0
]
}
], - "drain": [
- {
- "queue_name": "string",
- "partitions": [
- 0
]
}
]
}
}
]
}