Forq API (0.0.1)

Download OpenAPI specification:

Forq API

Admin

Endpoints for admin users like health checks and metrics

Check application health

Check if the application is healthy. Ideally, this endpoint should not be exposed to the public.

Please, note that it is not protected by any authentication mechanism.

Responses

Get application metrics

Get application metrics in Prometheus format. This endpoint is available only if the metrics were enabled at startup via the FORQ_METRICS_ENABLED env var.

Ideally, this endpoint should not be exposed to the public.

The endpoint is protected by the ApiKey authentication mechanism. The auth secret must be provided via the FORQ_METRICS_AUTH_SECRET env var at startup. Each request should pass it via the X-API-Key header as ApiKey <FORQ_METRICS_AUTH_SECRET>.

Authorizations:
ApiKeyAuth

Responses

Producer

Endpoints for producers

Produce a message to a queue

Produce a message to the queue by submitting a JSON payload to the endpoint. The message will be added to the end of the queue.

The endpoint is protected by the ApiKey authentication mechanism. The auth secret must be provided via the FORQ_AUTH_SECRET env var at startup. Each request should pass it via the X-API-Key header as ApiKey <FORQ_AUTH_SECRET>.

Authorizations:
ApiKeyAuth
path Parameters
queue
required
string
Example: my-queue

The name of the queue

header Parameters
X-API-Key
required
string
Example: my-secret

API Key authentication. Each request should pass it via the X-API-Key header as <AUTH_SECRET> where <AUTH_SECRET> is the secret set via the corresponding env var at startup.

Request Body schema: application/json
required

Message to produce

content
required
string

The content/payload of the message. Must not exceed 256 KB in size.

processAfter
integer <int64>

Unix timestamp in milliseconds indicating when the message should be processed. If not provided, the message will be available for processing immediately.

Must not be in the past, or more than 366 days in the future.

Responses

Request samples

Content type
application/json
{
  • "content": "I am going on an adventure!",
  • "processAfter": 1700000000000
}

Response samples

Content type
application/json
{
  • "code": "bad_request.body.content.exceeds_limit"
}

Consumer

Endpoints for consumers

Fetch a message from a queue for processing

Fetch a message from the queue for processing. If there is no message available just yet, the HTTP long-polling will be used to wait for a message to arrive for up to 30 seconds. If no message arrives within that time, a 204 No Content response will be returned.

Once a message is fetched, it becomes invisible to other consumers for up to 5 minutes while it is being processed, or until it is unacknowledged. If the message is not acknowledged within that time, it becomes visible to other consumers again.

It is important to explicitly acknowledge or unacknowledge the message after processing it!

The endpoint is protected by the ApiKey authentication mechanism. The auth secret must be provided via the FORQ_AUTH_SECRET env var at startup Each request should pass it via the X-API-Key header as ApiKey <FORQ_AUTH_SECRET>.

Authorizations:
ApiKeyAuth
path Parameters
queue
required
string
Example: my-queue

The name of the queue

header Parameters
X-API-Key
required
string
Example: my-secret

API Key authentication. Each request should pass it via the X-API-Key header as <AUTH_SECRET> where <AUTH_SECRET> is the secret set via the corresponding env var at startup.

Responses

Response samples

Content type
application/json
{
  • "id": "0199164b-4dea-78d9-9b4c-c699d5037962",
  • "content": "I am going on an adventure!"
}

Acknowledge a message after successful processing

Acknowledge a message after successful processing to remove it from the queue permanently. If the message is not found in the DB, it is treated as already acknowledged, and a 204 No Content response is returned, as for the regular successful acknowledgment. This is to ensure idempotency of the acknowledgment operation.

The endpoint is protected by the ApiKey authentication mechanism. The auth secret must be provided via the FORQ_AUTH_SECRET env var at startup. Each request should pass it via the X-API-Key header as ApiKey <FORQ_AUTH_SECRET>.

Authorizations:
ApiKeyAuth
path Parameters
queue
required
string
Example: my-queue

The name of the queue

messageId
required
string <uuid>
Example: 0199164b-4dea-78d9-9b4c-c699d5037962

The unique identifier of the message in the UUID v7 format

header Parameters
X-API-Key
required
string
Example: my-secret

API Key authentication. Each request should pass it via the X-API-Key header as <AUTH_SECRET> where <AUTH_SECRET> is the secret set via the corresponding env var at startup.

Responses

Response samples

Content type
application/json
{
  • "code": "bad_request.body.content.exceeds_limit"
}

Unacknowledge a message after failed processing

Unacknowledge a message after failed processing to make it visible to other consumers after the backoff interval (depends on the number of previous attempts). If the max number of attempts is reached, the message is moved to the dead-letter queue (DLQ), and should be either consumed from there, or processed manually via the Admin UI.

If the message is not found in the DB, a 404 Not Found response is returned.

The endpoint is protected by the ApiKey authentication mechanism. The auth secret must be provided via the FORQ_AUTH_SECRET env var at startup. Each request should pass it via the X-API-Key header as ApiKey <FORQ_AUTH_SECRET>.

Authorizations:
ApiKeyAuth
path Parameters
queue
required
string
Example: my-queue

The name of the queue

messageId
required
string <uuid>
Example: 0199164b-4dea-78d9-9b4c-c699d5037962

The unique identifier of the message in the UUID v7 format

header Parameters
X-API-Key
required
string
Example: my-secret

API Key authentication. Each request should pass it via the X-API-Key header as <AUTH_SECRET> where <AUTH_SECRET> is the secret set via the corresponding env var at startup.

Responses

Response samples

Content type
application/json
{
  • "code": "bad_request.body.content.exceeds_limit"
}