Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @ovotech/laminar-kafkajs

Index

Other Type aliases

EachBatchConsumer<TValue, TKey, TContext>: (payload: DecodedEachBatchPayload<TValue, TKey> & TContext) => Promise<void>

Type parameters

  • TValue

    The decodeed type of the the kafka message value

  • TKey

  • TContext: Empty = Empty

    The context that this consumer requires to exeecute

Type declaration

EachBatchMiddleware: AbstractMiddleware<DecodedEachBatchPayload<unknown, unknown>, void>

Middleware for EachBatchConsumer

EachMessageConsumer<TValue, TKey, TContext>: (payload: DecodedEachMessagePayload<TValue, TKey> & TContext) => Promise<void>

Type parameters

  • TValue

    The decodeed type of the the kafka message value

  • TKey

  • TContext: Empty = Empty

    The context that this consumer requires to exeecute

Type declaration

EachMessageeMiddleware: AbstractMiddleware<DecodedEachMessagePayload<unknown, unknown>, void>

Middleware for EachMessageConsumer

Produce<TValue, TKey>: (producer: KafkaProducerService, messages: EncodedMessage<TValue, TKey>[]) => Promise<RecordMetadata[]>

Type parameters

  • TValue

    The type of the the kafka message value, before its encoded

  • TKey

Type declaration

kafka Type aliases

RegisterSchemas: (schemaRegistry: SchemaRegistry) => Promise<Map<string, number>>

Type declaration

    • (schemaRegistry: SchemaRegistry): Promise<Map<string, number>>
    • A function to be called with the schema registry that will pre-register all schemas you'll be producing.

      Parameters

      • schemaRegistry: SchemaRegistry

      Returns Promise<Map<string, number>>

Functions

  • Chunk a batch messages consume. Each size it will call the consumer function, then fire the heartbeat and commit the offsets.

    You can use it like a middleware:

    const inBatches = chunkBatchMiddleware({ size: 500 });

    new KafkaConsumer(kafka, schemaRegistry, {
    topic: '...',
    eachBatch: inBatches({ size: 500 })(myBatchConsumer),
    });

    Parameters

    • __namedParameters: Object

    Returns EachBatchMiddleware

  • kafkaLogCreator(logger: LoggerLike): logCreator
  • produce<TValue, TKey>(config: { keySchema?: ConfluentSchema; schema: ConfluentSchema; topic: string }): Produce<TValue, TKey>
  • A helper to create a producer function, with "baked in" topic and schema names

    const mySend = produce({ topic: 'my-topic', schema: mySchema });
    await mySend(producer, [{ value: { ... }, partition: 1 }]);

    Type parameters

    • TValue

      The type of the the kafka message value, before its encoded

    • TKey = null | string | Buffer

    Parameters

    • config: { keySchema?: ConfluentSchema; schema: ConfluentSchema; topic: string }
      • Optional keySchema?: ConfluentSchema
      • schema: ConfluentSchema
      • topic: string

    Returns Produce<TValue, TKey>

  • toProducerRecord<TValue, TKey>(__namedParameters: ToProducerRecordConfig<TValue, TKey>): Promise<ProducerRecord>

Generated using TypeDoc