Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@osskit/dafka-producer-fetch-client

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@osskit/dafka-producer-fetch-client

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
403
increased by53.23%
Maintainers
1
Weekly downloads
 
Created
Source

GitHub Workflow Status License code style: prettier

typescript-fetch client wrapper for dafka-producer

Install

yarn add @osskit/dafka-producer-fetch-client

Usage

import { createProducer } from '@osskit/dafka-producer-fetch-client';

export const produce = createProducer<Message>({
    url: 'http://dafka-producer',
    topic: 'my-topic',
    keyExtractor: (record) => record.id,
    fetch: global.fetch,
});

await produce(records);

Extra headers

It is possible to add extra headers to the request

await produce(records, {
    'x-extra-header': 'value',
});

API

createProducer({ url, topic, keyExtractor, fetch })

url

Type: string

The URL of dafka-producer

topic

Type: string

The Kafka Topic name

keyExtractor

Type: (record: Record) => string

A function to extract the key from a record, defaults to a random UUID

fetch

Type: typeof global.fetch

The fetch function to use

returns

An instance of a function that receives <Record>(records: Record[], extraHeaders?: object) and returns Promise<void>

License

MIT License

FAQs

Package last updated on 27 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc