Skip to content

pkgonan/kafka-listener

Repository files navigation

Runtime kafka listener

Purpose

  • Provides new topic listening at runtime.
  • Spring-kafka's @KafkaListener not provide new topic listening at runtime.
  • So, if we use Spring-kafka's @KafkaListener, we should change source code and restart application.
  • This project has no code change and no restart !

How to use ?

  • See KafkaListener.java

Try this !

  • Clone project

      git clone https://github.com/pkgonan/kafka-listener.git
    
  • Initialize

      docker-compose up -d
    
  • New topic listener registration at runtime

      curl -XPOST localhost:8080/consumers/order/register -H "Content-Type: application/json" -d '{ "topics" : ["Topic1", "Topic2"] }'
    
  • New topic listener de-registration at runtime

      curl -XPOST localhost:8080/consumers/order/de-register -H "Content-Type: application/json" -d '{ "topics" : ["Topic1"] }'
    
  • Topic listener stop at runtime

      curl -XPOST localhost:8080/consumers/order/stop -H "Content-Type: application/json"
    
  • Topic listener start at runtime

      curl -XPOST localhost:8080/consumers/order/start -H "Content-Type: application/json"
    

About

Kafka runtime listener

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages