Function recordProcessorAdapter

recordProcessorAdapter - adapts a single record processor effect to a batch processor effect

you can control the concurrency of the batch processing by setting the concurrency outside of this function, with the default being unbounded.

import { Console, Effect, Either } from 'effect';
import { SQSRecord, SQSEventHandler, recordProcessorAdapter } from '@effect-lambda';
// Define an effect that processes a single SQS record
const processRecord = SQSRecord.pipe(
Effect.tap((record) => Console.log(record.body))
);

// Adapt the single record processor effect to handle a batch of records and use it with an SQSEventHandler
export const handler = processRecord.pipe(
recordProcessorAdapter,
Effect.withConcurrency(1), // optional if want sequential processing
SQSEventHandler,
);
  • Type Parameters

    • E

    Parameters

    • effect: Effect<void, E, HandlerContext | SQSEvent | SQSRecord>

      Effect.Effect<void, E, SQSRecord> - an effect handling a single SQS record

    Returns Effect<undefined | BatchResponse, never, HandlerContext | SQSEvent>

    A handler effect compatible with SQSEventHandler