Skip to content

Kafka microservice can process only one message by topic at the moment #12703

Closed
@Klutrem

Description

@Klutrem

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When sending any message on the topic by kafka, application getting stuck and doesn't process other messages until processing on the previous version will be finished

Minimum reproduction code

https://github.com/Klutrem/kafka-issue

Steps to reproduce

  • pull repository
  • run npm i
  • run kafka and specify port and host in envs, if it's not localhost:9092
  • run npm run start
  • send message to kafka topic test

Expected behavior

It was working on the previous versions:

{
    "name": "kafka-issue",
    "version": "1.0.0",
    "private": true,
    "license": "UNLICENSED",
    "scripts": {
      "build": "nest build",
      "start": "nest start",
      "start:dev": "nest start --watch",
      "start:prod": "node dist/main"
    },
    "dependencies": {
      "@nestjs/common": "^7.6.18",
      "@nestjs/config": "^1.0.0",
      "@nestjs/core": "^7.6.15",
      "@nestjs/mapped-types": "^1.2.2",
      "@nestjs/microservices": "^7.6.18",
      "kafkajs": "^1.15.0"
    },
    "devDependencies": {
      "@nestjs/cli": "^10.1.11",
      "@nestjs/schematics": "^7.3.0",
      "@nestjs/testing": "^7.6.18",
      "@swc/cli": "^0.1.62",
      "@swc/core": "1.3.75",
      "@types/node": "^14.17.5",
      "typescript": "^4.7.4",
      "unplugin-swc": "^1.3.2",
      "vitest": "^0.34.1"
    }
  }

With that package.json, application can process any number of messages at the same time, it doesn't stuck

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

10.2.7

Packages versions

{
    "name": "kafka-issue",
    "version": "1.0.0",
    "private": true,
    "license": "UNLICENSED",
    "scripts": {
      "build": "nest build",
      "start": "nest start",
      "start:dev": "nest start --watch",
      "start:prod": "node dist/main"
    },
    "dependencies": {
      "@nestjs/common": "^10.2.7",
      "@nestjs/config": "^3.1.1",
      "@nestjs/core": "^10.2.7",
      "@nestjs/mapped-types": "^2.0.2",
      "@nestjs/microservices": "^10.2.7",
      "kafkajs": "^2.2.4"
    },
    "devDependencies": {
      "@nestjs/cli": "^10.2.1",
      "@nestjs/schematics": "^10.0.3",
      "@nestjs/testing": "^10.2.7",
      "@swc/cli": "^0.1.62",
      "@swc/core": "1.3.95",
      "@types/node": "^20.8.10",
      "typescript": "^5.2.2",
      "unplugin-swc": "^1.4.3",
      "vitest": "^0.34.6"
    }
  }

Node.js version

18.16.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions