Open ryan-mars opened 3 years ago
Policy
signature:
const MyPolicy = new Policy(
{
__filename,
events: [],
commands: []
},
async (event, commands) => {
}
)
ReadModel
signature
const MyReadModel = new ByKeyReadModel(
{
__filename,
events: [],
shape: ...,
key: "flightNo"
},
(events, status) => {
return { ...status, ... }
}
);
Proposed EventHandler
signature
const MyEventHandler = new EventHandler(
{
__filename,
events: [],
},
async (event) => {
}
)
Furthermore, I wonder if it makes sense to create a base MessageHandler
component for Query
and Command
.
With MessageHandler
and EventHandler
my gut says if we're missing something at a conceptual level these two components could cover a lot of behavior.
@sam-goodwin Can we consider this done?
ReadModel (projections) and Policy are the only "event handler" components we have right now. It is conceivable that developers will want to respond to events in ways we have not yet conceived. It would be nice if there was a base class
EventHandler
they could use or extend to suit their needs.