JHipster module, A JHipster module to generate Apache Kafka consumers and producers.
This is a JHipster module, that is meant to be used in a JHipster application.
As this is a JHipster module, we expect you have JHipster and its related tools already installed:
To install this module:
npm install -g generator-jhipster-kafka
To update this module:
npm update -g generator-jhipster-kafka
To install this module:
yarn global add generator-jhipster-kafka
To update this module:
yarn global upgrade generator-jhipster-kafka
This describes how to use basically this module with a JHipster generated project:
- Create a JHipster project in a new folder:
mkdir myproject && jhipster
- Choose
Asynchronous messages using Apache Kafka
in server side options when answering the following question : "Which other technologies would you like to use?" - Go to the
generator-jhipster-kafka
project folder and runnpm link
- Go back to your JHipster project and run
npm link generator-jhipster-kafka
- In the same folder, then run
yo jhipster-kafka
- You can choose to add a consumer and/or a producer for an given entity name (identified by its domain class name in the package
domain
of your JHipster application, where entities are generated byjhipster entity
or JDL Studio based file throughjhipster import-jdl file_name.jh
)
You can then use your entity producer (for instance: OrderProducer.java
) in other layers like controllers or even better service by instancing it and using its send
method.
Generated consumers should not be explicitly used in other classes as each of them is running in a thread listening to the incoming messages.
🚀 AKHQ (previously known as KafkaHQ) can be used following those steps in the root directory:
- Run
docker-compose -f src/main/docker/kafka.yml -f src/main/docker/akhq.yml up -d
to launch the ZooKeeper and Kafka services with AKHQ - Go to http://localhost:11817
- Start your application with
./mvnw
to manage your topics and more!
Apache-2.0 © François Delbrayelle