Registry / devops / screwdriver-buildcluster-queue-worker

screwdriver-buildcluster-queue-worker

JSON →
library6.1.0jsnpmunverified

An AMQP connection manager and RabbitMQ consumer implementation for the Screwdriver build cluster. Version 6.1.0 is the current stable release. This package processes build start messages from RabbitMQ queues and manages pod lifecycle in Kubernetes with smart retry logic and progressive backoff. It is part of the Screwdriver CD ecosystem and is designed for internal usage within a Screwdriver cluster. The package is actively maintained by Yahoo and the Screwdriver community, with updates following the Screwdriver release cadence. It differentiates itself by providing a robust, Kubernetes-native build execution model with configurable prefetch, timeout, and retry limit settings.

npm install screwdriver-buildcluster-queue-worker
INSTALL
IMPORT
SIG · SCREWDRIVER-BUILDC
S
screwdriver-buildcluster-queue-worker
devopsjavascriptv6.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import QueueWorker from 'screwdriver-buildcluster-queue-worker';
const { QueueWorker } = require('screwdriver-buildcluster-queue-worker');
The package exports a single default class. Named import is incorrect.
QueueWorker
const QueueWorker = require('screwdriver-buildcluster-queue-worker');
const { QueueWorker } = require('screwdriver-buildcluster-queue-worker');
CommonJS require returns the default export directly, not a named export.
QueueWorker (ESM with default import)
import QueueWorker from 'screwdriver-buildcluster-queue-worker';
ESM default import is the modern recommended way. The package supports ESM and CJS.

Demonstrates creating a QueueWorker with RabbitMQ config, starting it, and handling shutdown signals.

import QueueWorker from 'screwdriver-buildcluster-queue-worker'; const queueConfig = { amqp: { host: process.env.RABBITMQ_HOST ?? 'localhost', port: Number(process.env.RABBITMQ_PORT) ?? 5672, username: process.env.RABBITMQ_USER ?? 'guest', password: process.env.RABBITMQ_PASS ?? 'guest' }, queue: 'build.start', prefetchCount: 20, initTimeout: 300000, messageReprocessLimit: 6 }; const worker = new QueueWorker(queueConfig); worker.start() .then(() => console.log('Worker started')) .catch(err => console.error('Worker failed', err)); // Graceful shutdown process.on('SIGTERM', async () => { await worker.shutdown(); process.exit(0); });
Debug
Known issues
breakingVersion 6.0.0 changed the config structure: `amqp.host` replaces deprecated `connection.host`.
fix
Update config to use `amqp` object with `host`, `port`, `username`, `password`.
affects: <6.0.0
breakingVersion 5.0.0 dropped Node.js 10 support. Requires Node.js >=12.
fix
Upgrade Node.js to version 12 or higher.
affects: <5.0.0
deprecatedThe `queue` option will be mandatory in v7. In v6 it defaults to 'build.start' but emits a deprecation warning if not provided.
fix
Explicitly set `queue` in config to the desired RabbitMQ queue name.
affects: >=6.0.0 <7.0.0
gotchaIf `prefetchCount` is set too high (>50), RabbitMQ may throttle connections. Default 20 is safe.
fix
Keep prefetchCount between 1 and 50 inclusive.
affects: >=0.0.0
gotchaThe package does not automatically reconnect if RabbitMQ connection drops. You must implement reconnection logic externally or use a process manager to restart the worker.
fix
Wrap worker.start() in a retry loop or use a supervisor system to restart on crash.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'replace')
Config object missing `queue` property; falls back to undefined causing error in message handling.
fix
Provide a valid non-empty string for `queue` in the configuration.
Error: Invalid prefetch count: -1
prefetchCount set to a negative number.
fix
Set prefetchCount to a positive integer between 1 and 50.
AMQP connection refused: Error: connect ECONNREFUSED 127.0.0.1:5672
RabbitMQ server not running or unreachable at configured host/port.
fix
Ensure RabbitMQ is running and the host/port config is correct.
Warning: queue option not provided, using default 'build.start'. This will be required in the next major version.
Config object missing `queue` property.
fix
Add `queue: 'your-queue-name'` to the configuration.
Upgrade
Version history
6.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
screwdriver-buildcluster-queue-worker — npm install screwdriver-buildcluster-queue-worker · libregistry