58
CHAPTER 3 | Architecting container and microservice-based applications
service-bus features on top of lower-level technologies like RabbitMQ and Docker. But that plumbing
work might cost too much for a custom enterprise application.
Resiliently publishing to the event bus
A challenge when implementing an event-driven architecture across multiple microservices is how to
atomically update state in the original microservice while resiliently publishing its related integration
event into the event bus, somehow based on transactions. The following are a
few ways to accomplish
this functionality, although there could be additional approaches as well.
•
Using a transactional (DTC-based) queue like MSMQ. (However, this is a legacy approach.)
•
Using transaction log mining.
•
Using full
Event Sourcing
pattern.
•
Using the
Outbox pattern
: a transactional database table as a message queue that will be the
base for an event-creator component that would create the event and publish it.
For a more complete description of the challenges
in this space, including how messages with
potentially incorrect data can end up being published, see
Data platform for mission-critical
workloads on Azure: Every message must be processed
.
Additional topics to consider when using asynchronous communication are message idempotence
and message deduplication. These topics are covered in the sectio">n
">Implementing event-based
">communication between microservices (integration events)
"> later in this guide.
Dostları ilə paylaş: