@halcyon-agile/adonis-kafka
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

A Kafka provider for AdonisJS

Adonis Kafka provides an easy way to start using Kafka.

npm-image license-image synk-image

API is based on https://github.com/Frubana/adonis-kafka and depends on kafkajs

Getting Started

Let's start by installing the package in our project.

Yarn:

yarn add @halcyon-agile/adonis-kafka

NPM:

npm install @halcyon-agile/adonis-kafka

Setup

You can configure the project by running the following command:

node ace invoke @halcyon-agile/adonis-kafka

Adding Topics

node ace make:prldfile kafka
// start/kafka.ts
import Kafka from '@ioc:Kafka'

// Callback function
Kafka.on('topic_name', async (data, commit) => {
  commit() // For successful transaction
  commit(false) // For failed transaction
})

// Multiple topics
Kafka.on('topic_name_1,topic_name_2,topic_name_3', async (data, commit) => {
  commit() // For successful transaction
  commit(false) // For failed transaction
})

Readme

Keywords

Package Sidebar

Install

npm i @halcyon-agile/adonis-kafka

Weekly Downloads

45

Version

0.3.3

License

MIT

Unpacked Size

16.9 kB

Total Files

19

Last publish

Collaborators

  • jericopulvera