fastify / fastify/help

Example for fastify-kafka

Open
#885 3 comments 3 reactions 0 assignees View on GitHub
help wanted
Dominant language
No language data
Stars
68
Forks
8
Avg merge
11h 2m
Merged PRs (30d)
2

Description

## 💬 Question here

I tried to setup fastify-kafka, but the documentation seems outdated. Finally I managed to produce messages, but consuming those is a big mystery. In the documentation (README) it shows the following example code:

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

However, the `on` methos is not available on the `kafka` object. It is on the return object of `subscribe()`, but that one only allows me to use things like`'data'` and not `'updates'`. I am using Typescript by the way.

Does anyone have a good example of how to implement fastify-kafka with the plugins and routes folders?

## Your Environment

- *node version*: 18
- *fastify version*: >=4.13.0
- *@fastify/kafka*: ">=2.2.1",
- *os*: docker.io/node:lts-alpine

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.