Skip to content

mnebus/micronaut-kafka-rest-app

Repository files navigation

Playing with Micronaut, Kafka, and REST

This is an example Micronaut microservice application built as a POC/exercise for me to get to know the framework. It features:


Running the application

For development with hot reloading

  1. start the required services in the background
docker-compose up -d zookeeper kafka-cluster kafka-ui
  1. run the application
./mvnw mn:run

To run the application in a docker container:

  1. build/install the local docker image
./mvnw clean package -Dpackaging=docker
  1. Run with docker-compose
docker-compose up

Building and running "native images" with GraalVM and docker

Prerequisite: Install the GraalVM. The easiest way to do this is with sdkman.

sdk install java 21.0.0.r11-grl
gu install native-image

Running the native image locally

  1. Build the native image
./mvnw clean package -Dpackaging=native-image
  1. Start the docker dependencies
docker-compose up -d zookeeper kafka-cluster kafka-ui
  1. Run the native binary
target/kafka-rest-app

Running a native image in a docker container

  1. Build the native docker container
./mvnw clean package -Dpackaging=docker-native
  1. Run with docker-compose
docker-compose up

External dependencies

  • Java 11 (optional -> GraalVM)
  • Docker

Micronaut 2.4.2 Documentation

Feature openapi documentation

Feature kafka documentation

Feature Micrometer (Prometheus)

About

Playing with Micronaut, Kafka, and REST

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published