Core message patterns: one message/two services (continued)

 

1/2: Winner-take-all

If the message is asynchronous, then no immediate reply is expected. The sending microservice simply does not care what happens after the message is emitted. In this case, the message is consumed, meaning that it is delivered to at most one listening microservice. A work queue can be used as the message transport mechanism to implement this pattern.

Example: Resizing images with a set of workhorse machines.

1/2: Fire-and-forget

The purest microservice communication model. Senders emit messages into the void, and receivers accept any and all messages, but act only on those they care about. The messages are necessarily asynchronous, as replies do not make sense, and are observed by multiple recipients. In practice, a message routing layer ensures efficient distribution and routing of message data over the network.

Example: e-commerce checkout triggering multiple follow-on workflows (confirmation, invoicing, delivery, and so on)