Class: Textus::Produce::Events
- Inherits:
-
Object
- Object
- Textus::Produce::Events
- Defined in:
- lib/textus/produce/events.rb
Overview
Single home for the fetch lifecycle event vocabulary (ADR 0048 D5). Produce::Acquire::Intake (the ingest executor driven by reconcile + hook) emits through this seam so the event names and payload shapes live in one place with one derived hook context.
Class Method Summary collapse
Instance Method Summary collapse
- #failed(key, error) ⇒ Object
- #fetched(key, envelope, change) ⇒ Object
-
#initialize(events:, hook_context:) ⇒ Events
constructor
A new instance of Events.
- #started(key, mode: :sync) ⇒ Object
Constructor Details
#initialize(events:, hook_context:) ⇒ Events
Returns a new instance of Events.
15 16 17 18 |
# File 'lib/textus/produce/events.rb', line 15 def initialize(events:, hook_context:) @events = events @hook_context = hook_context end |
Class Method Details
Instance Method Details
#failed(key, error) ⇒ Object
24 25 26 27 |
# File 'lib/textus/produce/events.rb', line 24 def failed(key, error) @events.publish(:entry_fetch_failed, ctx: @hook_context, key: key, error_class: error.class.name, error_message: error.) end |
#fetched(key, envelope, change) ⇒ Object
29 30 31 32 33 |
# File 'lib/textus/produce/events.rb', line 29 def fetched(key, envelope, change) return if change == :unchanged @events.publish(:entry_fetched, ctx: @hook_context, key: key, envelope: envelope, change: change) end |
#started(key, mode: :sync) ⇒ Object
20 21 22 |
# File 'lib/textus/produce/events.rb', line 20 def started(key, mode: :sync) @events.publish(:entry_fetch_started, ctx: @hook_context, key: key, mode: mode) end |