Chapter 9. Commands

 

This chapter covers

  • Understanding the role of commands in the unified log
  • Modeling commands
  • Using Apache Avro to define schemas for commands
  • Processing commands in our unified log

So far, we have concerned ourselves almost exclusively with events. Events, as we explained in chapter 1, are discrete occurrences that take place at a specific point in time. Throughout this book, we have created events, written them to our unified log, read them from our unified log, validated them, enriched them, and more. There is little that we have not done with events!

But we can represent another unit of work in our unified log: the command. A command is an order or instruction for a specific action to be performed in the future—each command, when executed, produces an event. In this chapter, we will show how representing commands explicitly as one or more streams within our unified log is a powerful processing pattern.

We will start with a simple definition for commands, before moving on to show how decision-making apps can operate on events in our unified log and express decisions in the form of commands. Modeling commands for maximum flexibility and utility is something of an art; we will cover this next before launching into the chapter’s applied example.

9.1. Commands and the unified log

 
 

9.2. Making decisions

 
 
 

9.3. Consuming our commands

 
 
 
 

9.4. Executing our commands

 
 
 

9.5. Scaling up commands

 
 
 
 

Summary

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage