tamed-kafka
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Tamed Kafka

Build Status

A node kafka client tamed for everyday use

Features

  • wrap your message-handling logic in one big async function
  • automatic message-handling concurrency option
  • automatic message-handling retry option
  • 'recycle' option for messages that failed during handling

Usage

async function handle(msg) => {
    //DO HEAVY ASYNC STUFF HERE FOR EACH MESSAGE
};
 
async function recycle(msg) => {
    //YOUR PROCESS FAILED, THIS IS YOUR LAST CHANCE TO TRACK
    //YOUR FAILED MESSAGE. THE CONSUMER WILL CONTINUE TO PROCESS
    //OTHER MESSAGES EITHER WAY
}
 
await setupConsumer({
    zkHost: config.ZOOKEEPER_CONNECTION,
    topic: "interesting-events",
    groupId: "my-consumer-1"
    handler: handle,
    recycler: recycle,
    concurrency: 1
});
 
console.log("processing events!")

Readme

Keywords

none

Package Sidebar

Install

npm i tamed-kafka

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

35.2 kB

Total Files

16

Last publish

Collaborators

  • scarmuega