Service Options
The createService / Service constructor accepts either a version string or an options object as the first argument:
import { createService } from '@requence/service'
createService( { version: '1.0.0', prefetch: 10, connectionTimeout: 30000, silent: false, }, async (ctx) => { return 'processed' },)from requence.service import Service
def handler(ctx): return "processed"
Service( { "version": "1.0.0", "prefetch": 10, }, handler,)prefetch
Section titled “prefetch”Controls how many messages the service processes concurrently. Defaults to 1.
Set this higher if your service can safely handle parallel work (e.g., stateless HTTP calls or CPU-bound transformations with available cores).
createService( { version: '1.0.0', prefetch: 5 }, async (ctx) => { // Up to 5 messages processed in parallel },)Service( {"version": "1.0.0", "prefetch": 5}, handler,)connectionTimeout (TypeScript only)
Section titled “connectionTimeout (TypeScript only)”Time in milliseconds to wait for the connection before throwing. Useful in environments where the message broker takes time to become available.
silent (TypeScript only)
Section titled “silent (TypeScript only)”When true, suppresses connection and lifecycle logs.
TLS connection options via environment
Section titled “TLS connection options via environment”For amqps:// connections, TLS settings can be overridden with environment
variables. This is useful for supplying a private CA or relaxing verification
in a specific deployment without changing code.
| Variable | Effect |
|---|---|
CA |
Inline PEM certificate(s) to trust as the CA. |
CA_FILE |
Path to a PEM file to trust as the CA (CA wins when both are set). |
REJECT_UNAUTHORIZED |
Set to false/0/no to disable certificate verification. |
These variables are a fallback: a matching value supplied in code always
takes precedence — connectionOptions (ca, rejectUnauthorized) in
TypeScript, or ssl_context in Python.
CA_FILE=/etc/ssl/my-ca.pem REJECT_UNAUTHORIZED=false bun run index.tsCA_FILE=/etc/ssl/my-ca.pem REJECT_UNAUTHORIZED=false python main.py