-
Notifications
You must be signed in to change notification settings - Fork 3
Implement a reflection-based aggregate system. #63
Conversation
Codecov Report
@@ Coverage Diff @@
## master #63 +/- ##
=======================================
Coverage 46.06% 46.06%
=======================================
Files 39 39
Lines 1396 1396
=======================================
Hits 643 643
Misses 743 743
Partials 10 10 Continue to review full report at Codecov.
|
I should probably add a check in the "recorder" that panics if you try to record an event that you haven't defined a handler for. |
FYI guys I've also attempted a basic banking transfer workflow example in the transfer-workflow. That branch is based on this one, so it uses the reflect-based API for the aggregates, and a hand-rolled saga to implement the workflow. |
src/ax/aggregate/handlerset.go
Outdated
return ax.MessageType{}, false | ||
} | ||
|
||
// isCommandHandler returns the message that is handled by rt, if it is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be isEventHandler.
// isCommandHandler returns the
Also the line below should be event handlers instead of command handlers.
src/ax/aggregate/saga.go
Outdated
// It is called when a "trigger" message is received and there is no | ||
// existing saga instance. env contains the "trigger" message. | ||
// | ||
// If err is nil, id must be a valid InstanceID, and d must be non-nil. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no d
?
src/internal/reflectx/dispatcher.go
Outdated
// fn is a pointer to a function variable that describes the signature to match. | ||
// It is assigned the generated function. | ||
// | ||
// It returns the types that that are supported by the generated type-switch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that that
This is a bit quick and dirty, but I think it addresses everything important in #10.