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.