Microservices Workshop - debug the exercises (For understanding the flows)


(Eran Gadasi) #1

Hi,
I would like to dive into the code using the debuger, do you have any recommendations are welcomed.
I finished with exercise 2, and wanted to see how the Pub-Sub flow works while debuging.

Thanks…


(Mauro Servienti) #2

Hi,

Everything starts in the Order Controller, in the front end application.
When the HTTP POST request is handled by Sales a command is sent to the Sales backend that handles it creating the order.
Order creation is completed by Sales publishing an event.

The published OrderSubmitted event is handled by Finance that kicks off the payment process. The payment process is handled locally by Finance itself. It uses a message sent to itself to decouple the transactional operation required to calculate the order total and the non transactional operation used by the payment process. Once the payment process is completed an event is raised.

OrderSubmitted is handled by Customers too, in order to keep track of the customers/orders relation.

Finally both te OrderSubmitted event and the PaymentSucceeded one are handled by Shipping that in exercise 2 does nothing.

By putting breakpoints I at the linked code location you should be able to track the entire flow.

Another option will be to visualize the messages flow using ServiceInsight, it’s discussed in the advanced section of exercise 4.

Hope this helps.
.m