Skip to content

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'
},
)

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
},
)

Time in milliseconds to wait for the connection before throwing. Useful in environments where the message broker takes time to become available.

When true, suppresses connection and lifecycle logs.