简体   繁体   中英

Eventual consistency data orchestration in microservices RabbitMq broker

I have the following flow in microservices:

  1. New data is created in Service "A".
  2. Service "A" creates event message to inform other services about changes.
  3. Services "B" and "C" that subscribe to the created event message (from service "A") updates their replicated data.

Same data across multiple services is eventually consistent. I'm using RabbitMq as message broker between services (using another broker is highly undesirable).

Lets say my services had been running for a while, data between them is consistent, all new changes are replicated and eventually consistent. All of a sudden I have a requirement to add new service (lets call it "D").

Newly introduced Service "D" also needs to replicate data coming from service "A". Service "D" needs all historic data, since other services ware already running for a while, and service "A" only broadcasts new changes.

Problem: My current solution creates event messages only for new data changes.

What would be the correct solution to populate newly added service with historic data?

Ended up choosing streams .

All of the events are persisted in stream. Each clients tracks its progress of messages read. Newly introduced clients read from the start of the stream thus allowing them to access all historic data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM