Lease a queue
Leases up to `max_messages` ready messages for the visibility timeout.
Leases up to max_messages ready messages for the visibility timeout.
- Path
POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/queues/queue:lease - Scope
events:write - Effect
write— a successful call changes state. - Collection queues
Request
| Field | Type | What it is |
|---|---|---|
name | string | The name of the queue. Required. |
max_messages | int32 | At most this many; default 1, at most 100. |
visibility_timeout | duration | Override the Queue's visibility timeout for this lease. |
wait | duration | Wait up to this long (at most 20s) for a message when none is ready. |
Response
| Field | Type | What it is |
|---|---|---|
messages | LeasedMessage[] | The leased messages. |
LeasedMessage
| Field | Type | What it is |
|---|---|---|
message_id | string | The message id, stable across deliveries. Output only. |
event | CloudEvent | The event. Output only. |
lease | MessageLease | The lease to ack or nack with. Output only. |
delivery_count | int32 | This delivery's number, from 1. Output only. |
lease_expire_time | timestamp | When the lease expires and the message is ready again. Output only. |
CloudEvent
| Field | Type | What it is |
|---|---|---|
id | string | Unique per source; with source it is the dedupe key. Required. |
source | string | The producer's URI-reference. Required. |
type | string | The event type, for example com.example.order.created. Required. |
subject | string | The subject within the source. |
event_time | timestamp | When the occurrence happened. |
data_content_type | string | The payload media type; default application/json. |
data_schema | string | The payload schema URI. |
data | value | The payload. |
extensions | map<string, string> | Extension attributes, at most 64. |
MessageLease
| Field | Type | What it is |
|---|---|---|
message_id | string | The message id. Required. |
lease_generation | int64 | The lease fence: the lease generation this holder was granted. Required. |
Errors
UNAUTHENTICATED— No valid key or token was presented.PERMISSION_DENIED— The key lacks the method's permission.RESOURCE_NOT_FOUND— The named Resource does not exist or is not visible.INVALID_FIELD— A field failed validation.RATE_LIMITED— The rate limit is reached; see Retry-After.
Every error arrives in the body Errors describes.
Examples
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/queues/queue:lease" \
-H "Authorization: Bearer $SYLPHX_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'