npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@specialblend/kafka-pipe

v0.0.9

Published

A functional/fluent utility for kafka

Downloads

3

Readme

kafka-pipe

A functional/fluent utility for kafka, built on top of kafka-node.

Install

npm install @specialblend/kafka-pipe

Classes

Constants

PipeConsumer

Callable kafka Consumer with pipe and error helper methods

Kind: global class

pipeConsumer.pipe(handler) ⇒ PipeConsumer

Pipe incoming messages to provided handler

Kind: instance method of PipeConsumer
Returns: PipeConsumer - self

| Param | Type | Description | | --- | --- | --- | | handler | function | message handler function |

pipeConsumer.error(handler) ⇒ PipeConsumer

Alias for this.on('error')

Kind: instance method of PipeConsumer
Returns: PipeConsumer - self

| Param | Type | Description | | --- | --- | --- | | handler | function | error handler function |

pipeConsumer.__call__(handler) ⇒ PipeConsumer

Make instance callable alias of this.pipe

Kind: instance method of PipeConsumer
Returns: PipeConsumer - self

| Param | Type | Description | | --- | --- | --- | | handler | function | message handler function |

PipeProducer

Callable kafka Producer when instance is called directly, acts like PipeProducer.send

Kind: global class

new PipeProducer(client, options)

Create

| Param | Type | Description | | --- | --- | --- | | client | Client | kafka client | | options | Object | opyions |

pipeProducer.send(payload) ⇒ Promise.<*>

Send a payload

Kind: instance method of PipeProducer
Returns: Promise.<*> - result

| Param | Type | Description | | --- | --- | --- | | payload | Array.<String> | payload |

pipeProducer.__call__(payload) ⇒ Promise.<*>

Make instance callable alias of this.send

Kind: instance method of PipeProducer
Returns: Promise.<*> - result

| Param | Type | Description | | --- | --- | --- | | payload | Array.<String> | payload |

PipeSender

Callable kafka PipeProducer which allows presetting a destination topic and options

Kind: global class

new PipeSender(client, topic, payloadOptions, producerOptions)

Curry topic and payload options

| Param | Type | Description | | --- | --- | --- | | client | Client | kafka client | | topic | String | kafka topic name | | payloadOptions | Object | options to include with outgoing payloads | | producerOptions | Object | producer options |

pipeSender.send(messages) ⇒ Promise.<*>

Send messages to preset topic, with preset options

Kind: instance method of PipeSender
Returns: Promise.<*> - returned Promise

| Param | Type | Description | | --- | --- | --- | | messages | Array.<String> | an array of messages to send |

pipeSender.__call__(payload) ⇒ Promise.<*>

Make instance callable alias of this.send

Kind: instance method of PipeSender
Returns: Promise.<*> - result

| Param | Type | Description | | --- | --- | --- | | payload | Array.<String> | payload |

PipeTransformer

Consumer/producer mixin that pipes messages from sourceTopic into transformer function, and sends result to destinationTopic, or deadLetterTopic on error

Kind: global class

new PipeTransformer(transformer, client, sourceTopic, destinationTopic, deadLetterTopic)

create a PipeTransformer

| Param | Type | Description | | --- | --- | --- | | transformer | function | the transformer function | | client | Client | kafka Client | | sourceTopic | String | name of topic to read from | | destinationTopic | String | name of topic to send to | | deadLetterTopic | String | name of topic to send failed payloads |

Client

Kafka Client

Kind: global class

new Client(kafkaHost, options)

Create a kafka Client

| Param | Type | Description | | --- | --- | --- | | kafkaHost | String | kafka host | | options | Object | options |

createConsumer ⇒ PipeConsumer

Curried factory of PipeConsumer

Kind: global constant

createProducer ⇒ PipeProducer

Curried factory of PipeProducer

Kind: global constant

createSender ⇒ PipeSender

Curried factory of PipeProducer

Kind: global constant

createTransformer ⇒ PipeTransformer

Curried factory of PipeTransformer

Kind: global constant