This repository demonstrates Observability in springboot microservices using Azure Application Insights Java SDK.
- Order Creation Microservice (Producer Service)- Springboot microservice responsible for creating new orders and pushing events to RabbitMQ.
- Postgres SQL for persistence.
- Rabbit MQ - Message Broker to enable asynchronous communication.
- Order Logging Service (consumer service) - Springboot microservice which reacts on the events published by Order creation service and logs the information to console.
- Create an application insights resource and obtain the instrumentation key. You can follow this tutorial for details.
- modify the application.properties for OrderCreationService and OrderLoggingService and add update the property
azure.application-insights.instrumentation-key=<your-ikey>
with your instrumentation key.
mvnw clean build
This command will build all the microservices.
Prerequisites:
- Make sure you have docker installed and running locally. You can install docker by following the steps on docker's official website.
run the command docker-compose up
. This will deploy all the microservices including RabbitMQ message broker on a common
docker network.
curl -d '{"productId" : "car123", "productName" : "car"}' -H "Content-Type: application/json" -X POST http://localhost:18080/orders
This would create a new order message and publish it to RabbitMQ. The consumer service reacts on this message, and logs the information on console.