Class: CommandTower::Services::Messaging::Communications::ProduceMany
- Inherits:
-
ApplicationService
- Object
- CommandTower::ServiceBase
- ApplicationService
- CommandTower::Services::Messaging::Communications::ProduceMany
- Defined in:
- app/services/command_tower/services/messaging/communications/produce_many.rb
Overview
Reusable multi-recipient fan-out: host supplies stable user ids; CT reloads User and calls single-user Produce per recipient. No audience queries here.
Constant Summary collapse
- SYNC_MAX =
25- FAILURE_DETAIL_CAP =
25- EXECUTION_MODES =
%i[async sync].freeze
Constants inherited from CommandTower::ServiceBase
CommandTower::ServiceBase::ON_ARGUMENT_VALIDATION
Instance Method Summary collapse
Methods inherited from ApplicationService
Methods included from Transactional
#fail_transaction!, #transaction
Methods inherited from CommandTower::ServiceBase
#command_tower_lifecycle, inherited, #internal_validate, #service_lifecycle_error_codes, #service_lifecycle_log_level, #validate!
Methods included from Logging::LifecycleDeclaration
Methods included from Execution::ContextAccess
#audit, #execution_context, #log_debug, #log_error, #log_info, #log_warn, #publish_event
Methods included from ArgumentValidation
Methods included from CommandTower::ServiceLogging
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/services/command_tower/services/messaging/communications/produce_many.rb', line 23 def call ids = normalize_user_ids mode = normalized_execution_mode if mode == :sync && ids.size > SYNC_MAX context.fail!( application_error: CommandTower::Errors::ValidationError.new( details: { execution_mode: "sync mode allows at most #{SYNC_MAX} recipients (got #{ids.size})", } ) ) return end if mode == :async schedule_async(ids) else produce_sync(ids) end end |