Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Design Document

A C T I V E MQ
D A T E : 16 T H A U G U S T 2022
V E R S I O N : 1 .0
AUTHOR: LALIT KHANNA

Confidential
Table of Contents
1.1. ............................................................................................................................................... ActiveMQ 3
1.2. ..................................................................................................................................................Purpose 3
1.3. ..................................................................................................................................................... Scope 3
Flow Chart: ................................................................................................................................................. 3
Sequence Diagram: .................................................................................................................................... 5
Flow Description: ....................................................................................................................................... 5
Entity Model Diagram: ............................................................................................................................... 7
Entity framework: ...................................................................................................................................... 8
Rule Engine: ............................................................................................................................................. 20
Services: ................................................................................................................................................... 21
Application Flow Diagram: ....................................................................................................................... 22
Application Flow Description: .................................................................................................................. 24

Confidential
1.1. ACTIVEMQ
1.2. PURPOSE

This document will help us to understand the implementation of ActiveMQ. When using
asynchronous communication for Microservices, it is common to use a message broker.
A broker ensures communication between different microservices is reliable and
stable, that the messages are managed and monitored within the system and that
messages don't get lost.

1.3. SCOPE
• Implementation of ActiveMQ
• Communication between the services/API
• Use Queue/Topic to send & receive the message
• Use Pub-Sub model

Confidential
Architecture

Confidential
SEQUENCE DIAGRAM :

FLOW DESCRIPTION:

1. A user/customer request to create an order through customer’s API


2. Once the order is created then API will send a message to Topic(that “Order has
created”) with required details.
3. Topic will pass the message to associate Queues.
4. Once associate Queue(I.e Customer) will get updated for order, immediately a
subscriber will dequeue the message from the respective queue & call the AuditLog Api.
5. AuditLog will log the given message.

Confidential
PUB SUB MODEL

HIGH LEVEL DESIGN OF ACTIVEMQ PROJECT


As we understand now that there is a publisher, and there are consumers, in our case as of now
Customer API is publisher & AuditLog is consumer.

Please find below diagram.

Please find below details to achieve this.

1. Add new references in Customer API Project (MassTransit)

Confidential
2. We’ve to add code for Publisher in startup.cs (This will connect to ActiveMQ)

Confidential
3. Add a new class for Publisher

This method is sending data in Virtual Queue

4. Once the Topic gets data, it will update the respective queues which associates with this Topic.

5. Following will be structure of consumer

Confidential
As we’re using MassTransit so we’ve to take the following references

6. Structure in Consumer

7. Startup.cs

Confidential
8. Actual implementation of Consumer

From this method we will call AuditLog API

Confidential

You might also like