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

1.28.1 • Public • Published

lambda-powertools-firehose-client

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

Main features:

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

  • direct replacement for AWS.Firehose client

Getting Started

Install from NPM: npm install @dazn/lambda-powertools-firehose-client

API

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

const Firehose = require('@dazn/lambda-powertools-firehose-client')

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

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

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

  await Firehose.putRecordBatch(putRecordBatchReq).promise()
}

Readme

Keywords

none

Package Sidebar

Install

npm i @dazn/lambda-powertools-firehose-client

Weekly Downloads

26

Version

1.28.1

License

MIT

Unpacked Size

16.8 kB

Total Files

7

Last publish

Collaborators

  • gideonparanoid
  • davidrv87
  • gabriela_nowicka
  • criveindazn
  • dazn.builder.frontend
  • automation-drone
  • m.bazalik
  • dazn.oss.lambda.powertools