Designing a MOM Solution

You are going to arrange a number of services in a way to emulate a small business that has three departments

  • Sales

  • Accounts

  • Resources

The Sales department generates a message on the resources topic, it is a record of a sale so that the resourcing team can keep stock of what has been sold.

The resources department will display the number of times a product has been sold.

The accounts department needs to know what sales have occurred so that ledgers can be correctly administered. They receive messages on the accounts topic.

Navigate into C:\work

Clone the project https://bitbucket.org/stream2stream/retail_admin_service-kafka/src/main/
Build the project using mvn package

The application has the following modes of running

# -t <topic name> # -k <key id> # -v <payload data as a string> # -c <behave as a consumer>, -c -p will cause -c to assume the role # -p <behave as a producer>, -p -c will cause -p to assume the role # -f <forward topic> forward messages from <watched topic> specied with -t <watched topic> to <forward topic>, if <forward topic> does not exist, it will be created

You will need to consumers, one listening on the resources topic, and the other listening on the accounts topic.

The generate a sale we will the swagger UI to a web application

Navigate into C:\work

Clone the application https://bitbucket.org/stream2stream/retail_service-kafka/src/main/

Build it using mvn package

Run the application using java -jar .\target\retail_admin_service.jar

Once the application has started and finished initialising

image-20240709-131957.png

In your browser navigate to http://localhost:8080/swagger-ui/index.html

image-20240709-132123.png

The swagger UI will allow you to create the required data for the ReSTful enpoint in the retail_service_kafka app.

Expand the retail-service-controller tab and select the Try it out button

When you select Try it out, you will see

As shown in the diagram above you edit the data and then press the Execute button