Class: RedfishClient::EventListener
- Inherits:
-
Object
- Object
- RedfishClient::EventListener
- Defined in:
- lib/redfish_client/event_listener.rb
Overview
EventListener class can be used to stream events from Redfish service. It is a thin wrapper around SSE listener that does the dirty work of splitting each event into its EventRecords and reporting them as separate events.
Instance Method Summary collapse
-
#initialize(sse_client) ⇒ EventListener
constructor
Create new EventListener instance.
-
#listen ⇒ Object
Stream events from redfish service.
Constructor Details
#initialize(sse_client) ⇒ EventListener
Create new EventListener instance.
15 16 17 |
# File 'lib/redfish_client/event_listener.rb', line 15 def initialize(sse_client) @sse_client = sse_client end |
Instance Method Details
#listen ⇒ Object
Stream events from redfish service.
Events that this method yields are actually EventRecords, extracted from the actual Redfish Event.
23 24 25 26 27 |
# File 'lib/redfish_client/event_listener.rb', line 23 def listen @sse_client.listen do |event| split_event_into_records(event).each { |r| yield(r) } end end |