Class: Textus::Infra::AuditSubscriber
- Inherits:
-
Object
- Object
- Textus::Infra::AuditSubscriber
- Defined in:
- lib/textus/infra/audit_subscriber.rb
Overview
Writes an “event_error” audit row when a user hook raises during Hooks::Dispatcher publish. Attached at Store boot.
Integration: uses Hooks::Dispatcher#on_error callback (chosen over a synthetic :hook_error event because the dispatcher already owns the rescue and the failure is a dispatcher-internal concern, not a domain event subscribers should be able to filter by key glob).
NOTE (0.16 scope): lifecycle audit rows for verb: “put” / “delete” / “rename” are still written directly by Store::Writer and Application::Writes::Mv. Moving those into this subscriber requires event payloads to carry etag_before/etag_after across many write paths; that is properly a 0.18 port-extraction concern.
Instance Method Summary collapse
- #attach(bus) ⇒ Object
-
#initialize(audit_log) ⇒ AuditSubscriber
constructor
A new instance of AuditSubscriber.
Constructor Details
#initialize(audit_log) ⇒ AuditSubscriber
Returns a new instance of AuditSubscriber.
19 20 21 |
# File 'lib/textus/infra/audit_subscriber.rb', line 19 def initialize(audit_log) @audit_log = audit_log end |
Instance Method Details
#attach(bus) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/textus/infra/audit_subscriber.rb', line 23 def attach(bus) bus.on_error do |event:, hook:, key:, kwargs:, error:| record_error(event: event, hook: hook, key: key, kwargs: kwargs, error: error) end self end |