Class: Yes::Core::CommandHandling::EventPublisher
- Inherits:
-
Object
- Object
- Yes::Core::CommandHandling::EventPublisher
- Includes:
- OpenTelemetry::Trackable
- Defined in:
- lib/yes/core/command_handling/event_publisher.rb
Overview
Handles publishing events with revision checks
Defined Under Namespace
Classes: AggregateEventPublicationData
Instance Method Summary collapse
-
#call ⇒ PgEventstore::Event
Publishes the event after verifying revisions.
-
#initialize(command:, aggregate_data:, accessed_external_aggregates:, event_name: nil) ⇒ EventPublisher
constructor
A new instance of EventPublisher.
Constructor Details
#initialize(command:, aggregate_data:, accessed_external_aggregates:, event_name: nil) ⇒ EventPublisher
Returns a new instance of EventPublisher.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/yes/core/command_handling/event_publisher.rb', line 39 def initialize(command:, aggregate_data:, accessed_external_aggregates:, event_name: nil) @command = command @aggregate_data = aggregate_data @accessed_external_aggregates = accessed_external_aggregates @event_name = event_name @command_utilities = Utils::CommandUtils.new( context: aggregate_data.context, aggregate: aggregate_data.name, aggregate_id: aggregate_data.id ) end |
Instance Method Details
#call ⇒ PgEventstore::Event
Publishes the event after verifying revisions
55 56 57 58 |
# File 'lib/yes/core/command_handling/event_publisher.rb', line 55 def call verify_external_revisions! publish_event end |