Why this event published twice to RabbitMQ
Hello dear friends,
I'm working on this project (https://github.com/MbarkT3STO/ExpenovaApp)
I'm implemented this project using a complex approach that uses
DDD
, VSA
and Microservices
with CQRS
of course, the databases are implemented in PostgreSQL
using EF Core
, and as a message broker RabbitMQ
is used here by using MassTransit
.
In a service called ExpenseService
I have this CQRS
Command that updates a Category
(https://github.com/MbarkT3STO/ExpenovaApp/blob/main/Source/ExpenseService/ExpenseService.Application/Category/Commands/UpdateCategoryCommand.cs)
As you will notice that at the end of the Update operation I have published an Update Event
, publishing this event (in its handler) will publishing a message to RabbitMQ
, that message holds the data about the Category
that has been Updated,
Inside another service called EventSourcererService
(This service has created to manage the event-sourcing for data of other services), I have a MessageConsumer
called ExpenseServiceCategoryUpdatedMessageConsumer
this message consumer will recieve the message/data from RabbitMQ
's queue and he should create a new event-source for the Category
that updated in a table that used to store the events-sources related to Category
.
(https://github.com/MbarkT3STO/ExpenovaApp/blob/main/Source/EventSourcererService/MessageConsumers/ExpenseService/Category/ExpenseServiceCategoryUpdatedMessageConsumer.cs)
The issue:
The issue is that everything is working fine, but the event-source of an update operation every time inserted two times into the event-sources table.
Please take a look at the attached video to understand.
I hope someone to help getting a solution and massive thanks in advance <30 Replies