Class: EventEngine::Event
- Inherits:
-
Struct
- Object
- Struct
- EventEngine::Event
- Defined in:
- lib/event_engine/event.rb
Overview
A non-persisted, in-memory representation of an emitted event with a symbol-keyed payload. Passed to subscribers’ #handle(event) at every in-process level (1-3), and returned by the emitter for levels 1 and 2.
Instance Attribute Summary collapse
-
#aggregate_id ⇒ Object
Returns the value of attribute aggregate_id.
-
#aggregate_type ⇒ Object
Returns the value of attribute aggregate_type.
-
#aggregate_version ⇒ Object
Returns the value of attribute aggregate_version.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#event_name ⇒ Object
Returns the value of attribute event_name.
-
#event_type ⇒ Object
Returns the value of attribute event_type.
-
#event_version ⇒ Object
Returns the value of attribute event_version.
-
#idempotency_key ⇒ Object
Returns the value of attribute idempotency_key.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#occurred_at ⇒ Object
Returns the value of attribute occurred_at.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#process_type ⇒ Object
Returns the value of attribute process_type.
-
#subject ⇒ Object
Returns the value of attribute subject.
Class Method Summary collapse
-
.from(record) ⇒ Event
Builds an Event from a record responding to the same members (e.g. an OutboxEvent), normalizing the payload to symbol keys.
Instance Attribute Details
#aggregate_id ⇒ Object
Returns the value of attribute aggregate_id
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def aggregate_id @aggregate_id end |
#aggregate_type ⇒ Object
Returns the value of attribute aggregate_type
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def aggregate_type @aggregate_type end |
#aggregate_version ⇒ Object
Returns the value of attribute aggregate_version
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def aggregate_version @aggregate_version end |
#domain ⇒ Object
Returns the value of attribute domain
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def domain @domain end |
#event_name ⇒ Object
Returns the value of attribute event_name
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def event_name @event_name end |
#event_type ⇒ Object
Returns the value of attribute event_type
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def event_type @event_type end |
#event_version ⇒ Object
Returns the value of attribute event_version
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def event_version @event_version end |
#idempotency_key ⇒ Object
Returns the value of attribute idempotency_key
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def idempotency_key @idempotency_key end |
#metadata ⇒ Object
Returns the value of attribute metadata
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def @metadata end |
#occurred_at ⇒ Object
Returns the value of attribute occurred_at
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def occurred_at @occurred_at end |
#payload ⇒ Object
Returns the value of attribute payload
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def payload @payload end |
#process_type ⇒ Object
Returns the value of attribute process_type
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def process_type @process_type end |
#subject ⇒ Object
Returns the value of attribute subject
5 6 7 |
# File 'lib/event_engine/event.rb', line 5 def subject @subject end |
Class Method Details
.from(record) ⇒ Event
Builds an Event from a record responding to the same members (e.g. an OutboxEvent), normalizing the payload to symbol keys.
26 27 28 29 30 |
# File 'lib/event_engine/event.rb', line 26 def self.from(record) attrs = members.to_h { |member| [member, record.public_send(member)] } attrs[:payload] = attrs[:payload].to_h.transform_keys(&:to_sym) new(**attrs) end |