Skip to content

QueueEventSource

Source: src/AWS/SQS/QueueEventSource.ts

Event source connecting an SQS Queue to the hosting compute (Lambda function or ServerHost process).

The contract is a Binding.Service; the host-specific implementation layers are Lambda.QueueEventSource (event-source mapping + runtime dispatch) and Server.SQSQueueEventSource (long-poll receive loop). Consume it through the consumeQueueMessages helper.

export default WorkerFunction.make(
{ main: import.meta.url },
Effect.gen(function* () {
const queue = yield* SQS.Queue("Jobs");
// registers the event-source mapping and the runtime dispatcher
yield* SQS.consumeQueueMessages(queue, { batchSize: 10 }, (records) =>
records.pipe(
Stream.runForEach((record) => Effect.log(record.body)),
),
);
}).pipe(Effect.provide(Lambda.QueueEventSource)),
);