Micro service how to maintain transaction

I am planning to create micro service. I have following questions

1 should I use gin frame work for micro service or grpc
2 if I build micro service it will be deployed on multiple port
3 how to maintain single database transaction for multiple micro service

Gin is an extra layer (framework) and gRPC is a protocol. AFIAK you can use whatever protocol using whatever framework (or vanilla Go) you want. The most common protocols are REST and gRPC

One micro service per port.

A single database transaction (commit - rollback) across multiple micro services? May be a challenge. IDK.

I got first 2 answer.

3 is challenging. I have accounting application separately and sales and purchases seperately. I will create 2 micro serviceā€¦

Both should work inside single transaction

If you use a single database, you can create a database function /stored procedure that execute both queries in one step?

Or create a trigger that automatically update the table2 depending on the outcome of updating table1?

Thinking database - not micro services?

Thanks for your help

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.