简体   繁体   中英

spring boot different instances of a microservice and data integrity

If several instance of a same microservice contain their own database,for scalability, how update all the databases when a create, update or delete operation is made ? which tool compatible with Eureka and Zuul spring propose for that ?

I would suggest you use an Event-based architecture where any service has done his work it produces the event and other services subscribe that event will also start his work.

you can use Kafka queue for same. also, read Distributed Sagas for Microservices

One more thing is that inter-communication use UDP instead of TCP.

Most of the databases offer replication these days with near 0 latency. Unless you use the other databases you can let the database do the synchronization for you.

I would suggest you to use RabbitMQ

The basic architecture of a message queue is simple, there are client applications called producers that create messages and deliver them to the broker (the message queue). Other applications, called consumers, connects to the queue and subscribes to the messages to be processed. A software can be a producer, or consumer, or both a consumer and a producer of messages. Messages placed onto the queue are stored until the consumer retrieves them.

Why to use this RabbitMQ?? https://www.cloudamqp.com/blog/2015-05-18-part1-rabbitmq-for-beginners-what-is-rabbitmq.html

Official document for rabbitMQ.... https://www.rabbitmq.com/

How to install rabbitMQ: https://www.journaldev.com/11655/spring-rabbitmq

Configuration in spring boot application:

https://spring.io/guides/gs/messaging-rabbitmq/

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