chagantivamsi87
New member
- Joined
- Dec 24, 2021
- Messages
- 3
- Programming Experience
- 10+
Publishing of EventGridEvent and storing the same in the Azure Storage table should be part of one operation method(**tightly coupled**) or segregated further(Loosely coupled)
which one is the right scenario ?
Apricated if you could share some sample scenario or code snippets.
Note: Our requirement is we should store the event data before it is **publishing** to EventGrid. In case of any issues we should able to **Rollback** it from the table storage.
*Sample code snippet*
Approach -1
OR
Approach -2
The approach should be more generic way so that other Projects can consume it.
which one is the right scenario ?
Apricated if you could share some sample scenario or code snippets.
Note: Our requirement is we should store the event data before it is **publishing** to EventGrid. In case of any issues we should able to **Rollback** it from the table storage.
*Sample code snippet*
Approach -1
C#:
CleanArchitecture -> Infrastructurelayer -->MessageBroker
publishEvent(EventData)
{
--- Store events in DB
---- Publish event
if(publish failed )
{
Rollback from DB
}
}
Approach -2
C#:
CleanArchitecture -> CommandHandler
CommnadHandler(EventData)
{
InfraStrcuture.Storage.EventStoreInsert
InfraStrcuture.MessageBroker.Publish
if Publish failed
{
InfraStrcuture.Storage.EventStoreRollback
}
}
Last edited by a moderator: