All Projects → fastify → fastify-kafka

fastify / fastify-kafka

Licence: MIT License
Fastify plugin to interact with Apache Kafka.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to fastify-kafka

Kledex
.NET Standard framework to create simple and clean design. Advanced features for DDD, CQRS and Event Sourcing.
Stars: ✭ 502 (+1256.76%)
Mutual labels:  events, event-sourcing
Goes
Go Event Sourcing made easy
Stars: ✭ 144 (+289.19%)
Mutual labels:  events, event-sourcing
Laravel Event Projector
Event sourcing for Artisans 📽
Stars: ✭ 650 (+1656.76%)
Mutual labels:  events, event-sourcing
Eventsourcing
Event Sourcing Library for Rust
Stars: ✭ 71 (+91.89%)
Mutual labels:  events, event-sourcing
EventEmitter
Simple EventEmitter with multiple listeners
Stars: ✭ 19 (-48.65%)
Mutual labels:  events, event-sourcing
Event Sourcing Cqrs Examples
Event Sourcing and CQRS in practice.
Stars: ✭ 265 (+616.22%)
Mutual labels:  events, event-sourcing
CQELight
CQELight is an entreprise grade extensible and customisable framework for creating software with CQRS, DDD & Event Sourcing patterns
Stars: ✭ 21 (-43.24%)
Mutual labels:  events, event-sourcing
OpenCQRS
.NET Standard framework to create simple and clean design. Advanced features for DDD, CQRS and Event Sourcing.
Stars: ✭ 546 (+1375.68%)
Mutual labels:  events, event-sourcing
tardis
Event sourcing toolkit
Stars: ✭ 35 (-5.41%)
Mutual labels:  events, event-sourcing
Watermill
Building event-driven applications the easy way in Go.
Stars: ✭ 3,504 (+9370.27%)
Mutual labels:  events, event-sourcing
Event Driven Spring Boot
Example Application to demo various flavours of handling domain events in Spring Boot
Stars: ✭ 194 (+424.32%)
Mutual labels:  events, event-sourcing
node-cqrs-saga
Node-cqrs-saga is a node.js module that helps to implement the sagas in cqrs. It can be very useful as domain component if you work with (d)ddd, cqrs, eventdenormalizer, host, etc.
Stars: ✭ 59 (+59.46%)
Mutual labels:  events, event-sourcing
muon-java
Muon Core for the JVM. APIs and Microservices taken to the next level
Stars: ✭ 18 (-51.35%)
Mutual labels:  events, event-sourcing
fs2-es
Event sourcing utilities for FS2
Stars: ✭ 75 (+102.7%)
Mutual labels:  events, event-sourcing
sentinel
Watch for changes in the status of Kubernetes resources and publish them to other systems for processing.
Stars: ✭ 15 (-59.46%)
Mutual labels:  events
networkdays
Networkdays functions ... including `networkdays` excel like function with no dependencies (no NumPy)
Stars: ✭ 22 (-40.54%)
Mutual labels:  events
fastify-angular-universal
Angular Universal integration to Fastify for rendering Angular apps on the server
Stars: ✭ 20 (-45.95%)
Mutual labels:  fastify
fastify-gateway
A Node.js API gateway that just works!
Stars: ✭ 88 (+137.84%)
Mutual labels:  fastify
reacted
Actor based reactive java framework for microservices in local and distributed environment
Stars: ✭ 17 (-54.05%)
Mutual labels:  event-sourcing
icicle
Icicle Streaming Query Language
Stars: ✭ 16 (-56.76%)
Mutual labels:  event-sourcing

@fastify/kafka

CI NPM version Known Vulnerabilities js-standard-style

Fastify plugin to interact with Apache Kafka. Supports Kafka producer and consumer.
To achieve the best performance, the plugin uses node-rdkafka.

Install

npm i @fastify/kafka --save

Usage

const crypto = require('crypto')
const fastify = require('fastify')()
const group = crypto.randomBytes(20).toString('hex')

fastify
  .register(require('@fastify/kafka'), {
    producer: {
      'metadata.broker.list': '127.0.0.1:9092',
      'group.id': group,
      'fetch.wait.max.ms': 10,
      'fetch.error.backoff.ms': 50,
      'dr_cb': true
    },
    consumer: {
      'metadata.broker.list': '127.0.0.1:9092',
      'group.id': group,
      'fetch.wait.max.ms': 10,
      'fetch.error.backoff.ms': 50,
      'auto.offset.reset': 'earliest'
    }
  })

fastify.post('/data', (req, reply) => {
  fastify.kafka.push({
    topic: 'updates',
    payload: req.body,
    key: 'dataKey'
  })
})

fastify.kafka.subscribe('updates')
fastify.kafka.on('updates', (msg, commit) => {
  console.log(msg.value.toString())
  commit()
})

fastify.listen(3000, err => {
  if (err) throw err
  console.log(`server listening on ${fastify.server.address().port}`)
})

For more examples on how to use this plugin you can take a look at the examples directory.

API

This module exposes the following APIs:

Producer
  • fastify.kafka.producer: the producer instance
  • fastify.kafka.push: utility to produce a new message
Consumer
  • fastify.kafka.consumer: the consumer instance
  • fastify.kafka.consume: utility to start the message consuming
  • fastify.kafka.subscribe: utility to start the subscribe to one or more topics
  • fastify.kafka.on: topic listener

Acknowledgements

This project is kindly sponsored by:

License

Licensed under MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].