feat(hris): EmployeeOnboarded broadcast / fan-out (Phase 5b)#32
Closed
intech wants to merge 1 commit into
Closed
Conversation
Add the multi-subscriber face of the EventBus, completing the hris example's three-mechanism story. The onboarding saga's terminal step now broadcasts `EmployeeOnboarded` ONCE, and three INDEPENDENT reactors consume it — welcome (welcome email), audit (onboarding record), headcount (per-department tally). - The publish-only bus uses the 1.1.0 `publishes: [OnboardingEventHandlers]` option, so the topic `onboarding.employee-onboarded` is resolved from the proto option with no raw topic hand-passed (a route-less publisher otherwise falls back to the message typeName). - Fan-out is four buses, not one: each reactor runs on its own bus with a DISTINCT consumer group (the per-bus duplicate-topic guard forces this), so on a broker every reactor gets every event. Reactors are idempotent (dedupe by employeeId — broker broadcast is at-least-once). Each runs as its own process (`node src/reactor.ts`, role by REACTOR), mirroring the RPC roles / worker. - The broadcast is fire-and-forget: it runs OUTSIDE the saga's compensation scope and a publish failure is logged, never rolled back — a lost broadcast must never undo a completed onboarding. The worker owns the publish bus lifecycle and injects it into the activities via setPublisherBus. Verified dockerless against the 1.1.0-shape (pkg.pr.new @165): typecheck clean, 37/37 tests — the broadcast fan-out (one publish → three reactors with the full message shape), topic-from-proto-option, idempotency, and the new broadcast-failure-tolerance workflow test. The LeaveApproved e2e is unchanged. Requires @connectum/events >= 1.1.0 (publishes/broadcast); the committed ^1.0.0 range resolves 1.1.0 once published. DRAFT until 1.1.0 is on npm. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MdeH7fExPmiRHRirGuvGk3
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the multi-subscriber face of the EventBus, completing the hris example's three-mechanism story (
ctx.call· EventBus · Temporal saga). The onboarding saga's terminal step broadcastsEmployeeOnboardedONCE, and three independent reactors consume it:publishes(1.1.0): the publish-only bus listsOnboardingEventHandlersinpublishes, so the topiconboarding.employee-onboardedresolves from the proto option with no raw topic hand-passed (a route-less publisher otherwise falls back to the messagetypeName).employeeId— broker broadcast is at-least-once). Each runs as its own process (node src/reactor.ts, role byREACTOR).setPublisherBus.Scope of verification (honest)
COMPLETED, no compensation).@connectum/*deps stay^1.0.0(no pkg.pr.new URLs); the verification override was local-only and is not in this diff.docker-compose.yml(the three reactor services + worker NATS wiring) is config-validated, not run.Gating
publishes/ the broadcast wiring ship in 1.1.0;^1.0.0resolves it once on npm. This mirrors the car-sharing Phase 3 broadcast draft (feat(car-sharing): EventBus broadcast / fan-out on trip completion (Phase 3) #29).🤖 Generated with Claude Code
https://claude.ai/code/session_01MdeH7fExPmiRHRirGuvGk3