Module: Tasker::Registry::EventPublisher
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/tasker/registry/event_publisher.rb
Overview
Event publishing capabilities for registry systems
Provides standardized event publishing for registration, unregistration, and validation events across all registries.
Instance Method Summary collapse
-
#publish_registration_event(entity_type, entity_id, entity_class, options = {}) ⇒ Object
Publish registration event.
-
#publish_registry_stats_event(stats) ⇒ Object
Publish registry statistics collection event.
-
#publish_unregistration_event(entity_type, entity_id, entity_class) ⇒ Object
Publish unregistration event.
-
#publish_validation_failed_event(entity_type, entity_class, error) ⇒ Object
Publish validation failure event.
Instance Method Details
#publish_registration_event(entity_type, entity_id, entity_class, options = {}) ⇒ Object
Publish registration event
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tasker/registry/event_publisher.rb', line 25 def publish_registration_event(entity_type, entity_id, entity_class, = {}) event_name = "#{entity_type}.registered" class_name = entity_class.is_a?(Class) ? entity_class.name : entity_class.to_s publish_event(event_name, { registry_name: @registry_name, entity_type: entity_type, entity_id: entity_id, entity_class: class_name, options: , registered_at: Time.current, correlation_id: correlation_id }) end |
#publish_registry_stats_event(stats) ⇒ Object
Publish registry statistics collection event
81 82 83 84 85 86 87 88 |
# File 'lib/tasker/registry/event_publisher.rb', line 81 def publish_registry_stats_event(stats) publish_event('registry.stats_collected', { registry_name: @registry_name, stats: stats, collected_at: Time.current, correlation_id: correlation_id }) end |
#publish_unregistration_event(entity_type, entity_id, entity_class) ⇒ Object
Publish unregistration event
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/tasker/registry/event_publisher.rb', line 45 def publish_unregistration_event(entity_type, entity_id, entity_class) event_name = "#{entity_type}.unregistered" class_name = entity_class.is_a?(Class) ? entity_class.name : entity_class.to_s publish_event(event_name, { registry_name: @registry_name, entity_type: entity_type, entity_id: entity_id, entity_class: class_name, unregistered_at: Time.current, correlation_id: correlation_id }) end |
#publish_validation_failed_event(entity_type, entity_class, error) ⇒ Object
Publish validation failure event
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/tasker/registry/event_publisher.rb', line 64 def publish_validation_failed_event(entity_type, entity_class, error) event_name = "#{entity_type}.validation_failed" class_name = entity_class.is_a?(Class) ? entity_class.name : entity_class.to_s publish_event(event_name, { registry_name: @registry_name, entity_type: entity_type, entity_class: class_name, validation_error: error., failed_at: Time.current, correlation_id: correlation_id }) end |