GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — quarkus-quickstarts/kafka-panache-reactive-quickstart at main · JavaGreenHands/quarkus-quickstarts

Expand file tree

/

kafka-panache-reactive-quickstart

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

kafka-panache-reactive-quickstart

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
.mvn/wrapper
.mvn/wrapper
 
 
src
src
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
docker-compose.yaml
docker-compose.yaml
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Quarkus Kafka/Panache Reactive Quickstart

This project illustrates how you can interact with Apache Kafka using MicroProfile Reactive Messaging and Hibernate with Panache. The project uses:

  • RESTEasy Reactive
  • Reactive Messaging and its connector for Kafka
  • Hibernate Reactive with Panache

NOTE: The kafka-panache-quickstart provides the same example but using classic Hibernate.

Start the application

Start the application in dev mode with:

mvn quarkus:dev

NOTE: Quarkus Dev Services starts the database and Kafka broker automatically.

Then, open your browser to http://localhost:8080/prices, and you should get the set of prices written in the database. Every 5 seconds, a new price is generated, sent to a Kafka topic, received by a Kafka consumer, and written to the database. Refresh the page to see more prices.

Anatomy

  • PriceGenerator - a bean generating random price. They are sent to a Kafka topic.
  • PriceStorage - on the consuming side, the PriceStorage receives the Kafka message and write it into the database using Hibernate with Panache
  • PriceResource - the PriceResource retrieves the prices from the database and send them into the HTTP response

Running in native

You can compile the application into a native binary using:

mvn clean install -Pnative

As you are not in dev or test mode, you need to start a PostgreSQL instance and a Kafka broker. To start them, just run docker-compose up -d.

Then, run the application with:

./target/kafka-panache-reactive-quickstart-1.0.0-SNAPSHOT-runner

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.