liveBook · Manning

Command/reply-based messaging

As explained in Microservices Patterns, Second Edition

An interaction style in which one party sends a command and another party returns a reply describing the result.

Command/reply messaging lets a service send a command and receive a reply describing the result. It provides an asynchronous request/response style through producer and handler APIs. section 8.3.10 section 8.4

CommandProducer commandProducer = ...;

Map<String, String> extraMessageHeaders = Collections.emptyMap();

String commandId = commandProducer.send("CustomerCommandChannel",
        new DoSomethingCommand(),
        "ReplyToChannel",
        extraMessageHeaders);

A command producer sends a command to a channel and specifies a reply channel. section 8.3.10

Command handler

A customer command handler processes a ReserveCreditCommand and returns a ReserveCreditResult. section 8.3.10

How Microservices Patterns, Second Edition covers it

How deep it goes
Names producer and handler roles and shows command submission, but does not develop the interaction beyond API examples.
Examples
Shows a command sent to a reply channel and a credit-reservation handler returning a result.
What you can do after
Apply it via Eventuate's CommandProducer and command-handler APIs to send commands and process results.
How it connects
Connects asynchronous request/response with domain event publishing and transactional messaging.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.