Hypothetical scenario:
Let's say I have a Customer service. It has 1 million customers in its database. I then create a new service that depends on a specific projection of the customer entity.
I want to avoid coupling and synchronous communication, so the new service should get customer updates through asynchronous messages.
But how do I sync the existing 1 million customers to the new service?
I've read suggestions that the Customer service should simply emit messages for all the customer entities, but there are a couple of problems with that solution:
- The new service needs all the data from the start. Failure because a needed customer isn't synced yet it not acceptable.
- Consuming 1 million messages is slow. I admit that I might have a suboptimal implementation here, but having Azure Functions trigger on messages and write updates to Azure Sql Database will quickly consume connections and hit the limit, unless properly throttled. Throttling slows the sync down and exacerbates point 1.
Is there a better way?
I'm thinking some kind of tool that writes directly from database A to database B, while mapping the model from A to B.
General suggestions and suggestions specific for the Azure context are appreciated!
Edit: what if the new service needs to sync data from two or more services?