@numaproj/numaflow-js - v0.0.0-alpha.4
    Preparing search index...

    Namespace batchmap

    BatchMap namespace for batch processing of messages.

    BatchMap processes multiple messages together in a batch, which can be more efficient than processing one at a time. Use cases include:

    • Bulk database operations
    • Batch API calls
    • Aggregating multiple inputs for ML inference
    import { batchmap } from '@numaproj/numaflow-js';

    const server = new batchmap.AsyncServer(async (datums) => {
    const responses: batchmap.Response[] = [];

    // Collect all messages
    const batch: batchmap.Datum[] = [];
    for await (const datum of datums) {
    batch.push(datum);
    }

    // Process batch and create responses
    for (const datum of batch) {
    const response = batchmap.Response.fromId(datum.id);
    response.append({ value: Buffer.from('processed'), keys: datum.keys });
    responses.push(response);
    }

    return responses;
    });

    server.start();

    Classes

    AsyncServer
    Response
    Responses

    Interfaces

    BatchMessageOptions
    Datum
    Message

    Type Aliases

    BatchMapCallback