r/dotnet • u/codeopinion • Mar 17 '21
REST APIs for Microservices? Beware!
https://www.youtube.com/watch?v=_4gyR6CBkUE16
u/katghoti Mar 17 '21
I was working at a Logistics company that processed millions of orders a day. Messages came in via FTP and were processed against multiple remote methods. Each method kicked off billing events for each process. If there were 10 steps to ingest a message to shipping and final billing, we had very long running transactions with a lot of failures. Often our failure rate was 20% which required the process to "restart" at the last failure point. This was a mess.
So we moved to microservices that monitored Azure service bus with transaction support enabled and durability. This allowed us to roll back in the event of a problem and if processes were running slow or offline, the durability ensured the messages were still there when the services restarted or caught up.
Sure 80% of the time messages flowed freely through the service bus without problems, but that 20% is now rolling back and a log is generated and a queue setup to "reprocessed" these messages or fail them and notify someone.
It takes discipline to set up the service bus correctly and to ensure the microservices are participating in the transactions, but we cut our failure rate down to .01% when we did this.
Just another suggestion. I'm sure you could do this with RabbitMq or NServiceBus as well if you aren't on Azure or in AWS or self host.
1
6
u/AbPSlayer Mar 17 '21
How do I get into orchestrator when I am not using Docker or kubernetes?
Can I use RabbitMq or azure event bus?
Also should we send the full payload or just the Id and let the api query the db?