The Customers Module
Explore how to implement command handling in the Customers module within an event-driven architecture using Golang. Understand defining protocol buffer messages, setting up command handlers for authorization, and registering command streams to keep microservices decoupled.
We'll cover the following...
We have only one command to define for the Customers module—a new protocol buffer message for AuthorizeCustomer:
message AuthorizeCustomer {string id = 1;}
Just like the events we have already defined, we will create a constant called AuthorizeCustomerCommand that will hold the unique name for the command that will be used in its Key() method so that we can register the type in the registry. Alongside the string constant for the command name, we also need to add a constant for the command channel for this module:
CommandChannel = "mallbots.customers.commands"
We will only need one ...