question

BalanjaneyuluKantu-8342 avatar image
1 Vote"
BalanjaneyuluKantu-8342 asked ·

How to handle events in service fabric

Hi Team,

I am working on migrating the database tables to service fabric microservices. As part of publishing the services, the existing data also migrated from the Database to Service fabric service.

In the initial phase, I don't want to replace the entire database with microservices and would like to maintain both databases and microservices. In order to maintain data integrity between microservices and databases, we have tried two approaches.

Approach 1 a separate database service and EventGird messaging system.

Below is the flow to maintain data integrity between microservices and database:

Migrate data from database to service fabric ( As part of service publishing).

Create a record in service fabric

Publish an event to EventGird based on EventType(Create, Update, Delete, DeletePermanent)

The API endpoints (Webhooks) will listen to EventGrid and perform the respective action based on the eventType a. CreateRecord --> Create a record in database b. UpdateRecord --> Updates the record in database c. DeleteRecord --> Deletes the record in database. DeleterecordPermanent --> Deletes the record permanently from the database

The above approach is working without any issues.

Approach 2 We implemented a new service EventHandler Service similar to EventGrid.

Below is the flow to maintain data integrity between microservices and database:

Migrate data from database to service fabric ( As part of service publishing).

Create a record in service fabric

Publish an event to EventHandler based on EventType(Create, Update, Delete, DeletePermanent)

The API endpoints (Webhooks) will listen to EventHandler and perform the respective action based on the eventType a. CreateRecord --> Create a record in database b. UpdateRecord --> Updates the record in database c. DeleteRecord --> Deletes the record in database. DeleterecordPermanent --> Deletes the record permanently from the database

The two approaches are working without any issues. However, I am looking for one of the optimal\ best ways to publish events and process them.

Any suggestions or inputs?

service-fabric-standaloneazure-service-fabricazure-service-fabric-mesh
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MicahMcKittrick-MSFT , Do you have any comments on the above post?

0 Votes 0 ·
mimckitt avatar image mimckitt BalanjaneyuluKantu-8342 ·

Sorry for the delay, I was out of office for the holiday weekend. Both approaches appear feasible and worth while in my opinion. If you are in the process of migrating the data bases, I would go with whatever approach you feel more comfortable with until you completely migrate to SF. Personally, I like the setup you have on approach 2 over approach one. However we can see if others in the community also agree

0 Votes 0 ·

0 Answers