Three services that are composed together to simulate a really bad ticketing website. There are two modes that the demo can be run in:
- a typical request/response system
- an EDA configuration that uses either RabbitMQ or Azure ServiceBus Topics.
Note: there are opportunities for improvement here via automation
Using this demo solution with Azure requires that you have configured the appropriate resources.
- you must have an Azure Subscription
- create a Resource Group to contain the ServiceBus Namespace
- create a Service Bus Namespace
- the Premium tier or higher is required
- create a Topic within the namespace
- create a Shared Access Policy (SAP) with the Send and Listen claims, at a minimum.
- you will need to supply one of the generated connection strings as shown below.
- create three subscriptions against the topic. these subscriptions are named after the
service that will make use of them.
- order-processor
- reservation-processor
- payment-processor
the environment variable 'active_profile' needs to be set to either 'rabbitmq' to use RabbitMQ or 'azure-topic' for Azure ServiceBus Topic
the environment variable 'azure_topic_connectstring' should be set to one of the connection strings that were generated when you created the SAP above. I am using a single connection string for all the services for simplicity. a better practice would be for each service to have it's own access policy
mvn clean package
export active_profile=azure-topic
export azure_topic_connectstring=...
docker-compose build --no-cache
docker-compose up
submit an order using the request/response sync configuration
POST http://localhost:8080/orders/sync
content-type: application/json
accept: application/json
{
"showId":"456765",
"status":"pending",
"seats":["1A","1B","1C"]
}
retrieve the status of an order
GET http://localhost:8080/orders/00001
accept: application/json
submit an order using the event-driven configuration
POST http://localhost:8080/orders
content-type: application/json
accept: application/json
{
"showId":"456765",
"status":"pending",
"seats":["1A","1B","1C"]
}
The above request will result in a 201 with the location header set to the URL of the order.
The included script run-gatling-container.sh will build and and launch a container with an instance of Gatling. There are two scripts. One will exercise the request/response path and the other will challenge the eventing path
on Windows
winpty bash ./run-gatling-container.sh
Netflix's Chaos Monkey has been integrated thanks to Chaos Monkey for Spring Book by CodeCentric. It can be activated by setting the environment variable chaos_monkey_enabled to true prior to spinning up the containers.
export chaos_monkey_enabled=true
deleting the Azure Resource Group is a quick and easy way to release all of the resources that were created within Azure.
an easy way to remove all of the EDA images
docker rmi $(docker images --filter=reference="eda*" -q)