Skip to content

Latest commit

 

History

History
 
 

micronaut-pizza-gen

Random Pizza Generator

Description

This demo consists of the following Micronaut projects:

  • pizza-generator is a standard Micronaut app with the Kafka feature.

  • sauce-service is Micronaut Messaging app with Kafka.

  • cheese-service is Micronaut Messaging app with Kafka.

  • meat-service is Micronaut Messaging app with Kafka.

  • veggie-service is Micronaut Messaging app with Kafka.

The demo was built using Confluent Cloud, the Cloud-native service for Apache Kafka. If you don’t have an account on Confluent Cloud, you can set that up [here](https://www.confluent.io/confluent-cloud).

Building the demo

Each of the five projects contain the Gradle Wrapper. To build from the root directory of a project run ./gradlew build. To execute the application run ./gradlew run.

Running the demo

Before running this demo, you will need to update the src/main/resources/application.yml file in each project. Replace all the fields marked with {{ }} using values from your Confluent Cloud cluster and schema registry. Also, you will need to create 5 topics in Confluent Cloud. They can each have 1 partion (or more if you so desire): pizza, pizza-with-sauce, pizza-with-cheese, pizza-with-meat, and pizza-with-veggies.

Once all five services are up and running, you can issue the following curl command to send an order for 3 random pizzas. curl -H "Content-Type: application/json" --request POST -d '{"count":5}' http://localhost:8080/order

This will trigger a series of events which will result in a completed pizza order with the requested pizzas, and it will return a UUID of that pizza order.

To see your pizzas in all their hot, delicious glory, run the following curl command using the UUID returned from the first call.

Note: jq is optional, but very helpful. More info at https://stedolan.github.io/jq/

Adding an additional service

There is now a sixth service in this repo that represents an additional feature added to our system after it is up and running. The cheese-reporter service is an analytics app that will consume from the pizza-with-cheese topic and produce a report of the most populuar cheeses. The goal of this service is to show how new applications can be added to our system without affecting any of the existing applications. This one also demonstrates complete runtime decoupling in that it can do its work regardless of the state of the other applications.

This application will require the same configuration info as the others to get it running.

When you are done working with this demo project, you can delete these topics to avoid additional charges.

Feature http-client documentation

Feature kafka documentation