-
Notifications
You must be signed in to change notification settings - Fork 19
Add tenant/org eventing, per-entity Kafka topics, broadcastEvent API #835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
kafka event for tenant
WalkthroughAdds tenant and organization eventing across env config, DTOs, utils, Kafka helpers, broadcaster, and services. Introduces broadcastEvent API replacing broadcastUserEvent, per-entity Kafka topics/endpoints, change-diff utilities, and emits structured create/update events for users, tenants, and organizations. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller as Service/Helper
participant EB as eventBroadcasterMain.broadcastEvent
participant ENV as Env flags
participant HTTP as Listener API (per group)
participant K as Kafka helpers
Caller->>EB: broadcastEvent(eventGroup, {requestBody, headers, isInternal})
EB->>ENV: isEventEnabled(eventGroup)?
alt events disabled
EB-->>Caller: no-op / log
else events enabled
EB->>ENV: getEndpoints(eventGroup)
alt endpoints exist
EB->>HTTP: POST requestBody (per endpoint)
HTTP-->>EB: 2xx/4xx
else no endpoints
EB->>K: route by group<br/>org→pushOrganizationEventsToKafka<br/>user→pushUserEventsToKafka<br/>tenant→pushTenantEventsToKafka
K-->>EB: ack/error
end
EB-->>Caller: result/log
end
sequenceDiagram
autonumber
participant Svc as Org/Tenant Service
participant Utils as extractUpdatedValues
participant DTO as *.eventBodyDTO
participant EB as broadcastEvent
Svc->>Utils: compute changedValues(old, new, updateData)
Utils-->>Svc: [{fieldName, oldValue, newValue}, ...]
Svc->>DTO: eventBodyDTO({entity, eventType, entityId, changedValues, args})
DTO-->>Svc: eventBody payload
Svc->>EB: broadcastEvent(group, {requestBody: payload, isInternal: true})
EB-->>Svc: completion/log
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (13)
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
Summary by CodeRabbit