feat(event-sourcing): Publish EventStored after successful SaveEvent #135
Reference in New Issue
Block a user
Delete Branch "issue-61-"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implement EventStored internal event publishing after successful SaveEvent. This allows observability components (metrics, projections, audit systems) to react to persisted events without coupling to application code.
Changes
Test Coverage
Acceptance Criteria Met
Closes #61
Co-Authored-By: Claude Code noreply@anthropic.com
Code Review: Changes Requested
Issues:
event.go:169- Duplicate blank line: empty line at 169 is unnecessary, creates inconsistent spacingstore/memory.go:75andstore/jetstream.go:231- publishEventStored() usestime.Now()instead of original event's timestamp. EventStored.Timestamp should preserve the original event timestamp for consistencystore/eventstored_test.go:48- MockEventBroadcaster.Subscribe() returns closed channel instead of nil or buffered channel. Will cause panic on receive during actual publishingstore/memory.go:66andstore/jetstream.go:222- Missing nil check for metrics before calling RecordPublish. Should guard with: if jes.metrics != nil { jes.metrics.RecordPublish() }Suggestions:
Fixed review feedback✓
Code Review: Approved ✓
All review feedback has been successfully addressed:
Fixes verified:
Test status:
Implementation is solid and ready to merge.
8c5ac500b6to464fed67ec