Skip to content

pgflow 0.6.1: Worker Configuration in Handler Context

pgflow 0.6.1 worker config in handler context cover image

pgflow 0.6.1 adds workerConfig to the handler execution context, enabling intelligent decision-making based on worker configuration.

Handlers now have access to the complete worker configuration through context.workerConfig (#200). This enables smarter handlers that can adapt their behavior based on retry limits, concurrency settings, timeouts, and other worker parameters.

async function sendEmail(input, context) {
const isLastAttempt = context.rawMessage.read_ct >= context.workerConfig.retry.limit;
if (isLastAttempt) {
// Use fallback email service on final attempt
return await sendWithFallbackProvider(input.to, input.subject, input.body);
}
// Use primary email service for regular attempts
return await sendWithPrimaryProvider(input.to, input.subject, input.body);
}

See the context documentation for complete details on available configuration properties and additional examples.

This release also fixes retry strategy validation to only enforce the 50-limit cap for exponential retry strategy, allowing higher limits for fixed strategy when needed (#199).

Follow our update guide for step-by-step upgrade instructions.