@michaelfecher/lambda-powertools-kinesis-client
TypeScript icon, indicating that this package has built-in type declarations

1.28.1 • Public • Published

lambda-powertools-kinesis-client

Kinesis client wrapper that knows how to forward correlation IDs (captured via @michaelfecher/lambda-powertools-correlation-ids).

Main features:

  • auto-injects correlation IDs into Kinesis records when you call putRecord or putRecords (only JSON payloads are supported currently)

  • direct replacement for AWS.Kinesis client

Getting Started

Install from NPM: npm install @michaelfecher/lambda-powertools-kinesis-client

API

It's exactly the same as the Kinesis client from the AWS SDK.

const Kinesis = require('@michaelfecher/lambda-powertools-kinesis-client')

const publishEvent = async () => {
  const putRecordReq = {
    StreamName: 'lambda-powertools-demo',
    PartitionKey: uuid(),
    Data: JSON.stringify({ message: 'hello kinesis' })
  }

  await Kinesis.putRecord(putRecordReq).promise()
}

const publishEvents = async () => {
  const putRecordsReq = {
    StreamName: 'lambda-powertools-demo',
    Records: [
      {
        PartitionKey: uuid(),
        Data: JSON.stringify({ message: 'hello kinesis' })
      },
      {
        PartitionKey: uuid(),
        Data: JSON.stringify({ message: 'hello lambda-powertools' })
      }
    ]
  }

  await Kinesis.putRecords(putRecordsReq).promise()
}

/@michaelfecher/lambda-powertools-kinesis-client/

    Package Sidebar

    Install

    npm i @michaelfecher/lambda-powertools-kinesis-client

    Weekly Downloads

    0

    Version

    1.28.1

    License

    MIT

    Unpacked Size

    18.6 kB

    Total Files

    7

    Last publish

    Collaborators

    • michaelfecher