Class: CommandTower::Messaging::Accept::Coordinator
- Inherits:
-
Object
- Object
- CommandTower::Messaging::Accept::Coordinator
- Defined in:
- app/services/command_tower/messaging/accept/coordinator.rb
Overview
Domain orchestrator under Produce: validate → idempotency → plan → persist → schedule handoff. Not an ApplicationWorkflow (nested AW under Produce/host workflows is forbidden).
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(recipient_id:, notification_type_key:, host_event_identity:, title:, body:, metadata: nil, preference_state: nil, platform_enabled_channels:, message_overrides: nil) ⇒ Coordinator
constructor
A new instance of Coordinator.
Constructor Details
#initialize(recipient_id:, notification_type_key:, host_event_identity:, title:, body:, metadata: nil, preference_state: nil, platform_enabled_channels:, message_overrides: nil) ⇒ Coordinator
Returns a new instance of Coordinator.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/services/command_tower/messaging/accept/coordinator.rb', line 13 def initialize( recipient_id:, notification_type_key:, host_event_identity:, title:, body:, metadata: nil, preference_state: nil, platform_enabled_channels:, message_overrides: nil ) @recipient_id = recipient_id @notification_type_key = notification_type_key @host_event_identity = host_event_identity @title = title @body = body @metadata = @preference_state = preference_state @platform_enabled_channels = platform_enabled_channels @message_overrides = end |
Class Method Details
.call(**kwargs) ⇒ Object
9 10 11 |
# File 'app/services/command_tower/messaging/accept/coordinator.rb', line 9 def self.call(**kwargs) new(**kwargs).call end |
Instance Method Details
#call ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/services/command_tower/messaging/accept/coordinator.rb', line 35 def call request = { recipient_id: @recipient_id, notification_type_key: @notification_type_key, host_event_identity: @host_event_identity, title: @title, body: @body, metadata: @metadata, preference_state: @preference_state, platform_enabled_channels: @platform_enabled_channels, message_overrides: @message_overrides, } OperationLogger.around(request:) do validate_request! fingerprint = RequestNormalizer.fingerprint( title: @title, body: @body, metadata: @metadata, preference_state: @preference_state, platform_enabled_channels: @platform_enabled_channels, message_overrides: @message_overrides, ) existing = find_by_namespace if existing return resolve_existing(existing, fingerprint) end plan = plan! persist_new!(request:, plan:, fingerprint:) end end |