Code Monkey home page Code Monkey logo

ack-nestjs-boilerplate-kafka's Introduction

NestJs Boilerplate Ack Kafka

NestJs Hybrid Http and NestJs Kafka Microservice.

Fork from ack-nestjs-boilerplate


Instructions

Before run, you must to create the topics with kafka-topics cli. Or you can run yarn kafka:create-topics. (Point 9 at Behaviour)

Behaviour

  1. Producer and consumer will use nestjs/microservice
  2. Producer will always imported as global module
  3. Message not commit offset in error
  4. Optional commit offset in first running
  5. Default kafka will create topic with 3 partition and 3 replication factor
  6. For guarantee sequential
    • Create topic with 1 partition and 1 replication factor
    • Set maxInFlightRequests to 1 in consumer config
    • Use producerSendSequential or produceEmitSequential
  7. emit means that whether or not you explicitly subscribe to the observable, the proxy will immediately try to deliver the event.
  8. send means that you have to explicitly subscribe to it before the message will be sent.
  9. acks will depends on kafka setting. Unfortunately, nestjs can not set acks when produce some message.
  10. Topics in ./src/kafka/constants/kafka.topic.constant.ts must created before running.
  11. All kafka request will validate with class-validation if you set the dto class.
  12. Put KafkaController into ./src/kafka/router/kafka.router.module.ts, so you can use env.KAFKA_CONSUMER_ENABLE for on/off

Next

  • Kafka Transaction

ack-nestjs-boilerplate-kafka's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.