Class: Hivent::LifeCycleEventHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/hivent/life_cycle_event_handler.rb

Instance Method Summary collapse

Instance Method Details

#application_registered(client_id, events, partition_count) ⇒ Object

Invoked when a consumer worker starts and registers events and partion count.

parameters:

client_id: name of the application
events: array of hashes for the registered events ([{ name: "my:event", version: 1 }, ...])
partition_count: number of partitions registered for this application


12
13
14
# File 'lib/hivent/life_cycle_event_handler.rb', line 12

def application_registered(client_id, events, partition_count)
  # do nothing
end

#event_processing_failed(exception, payload, raw_payload, dead_letter_queue_name) ⇒ Object

Invoked when processing an event failed. Either the payload could not be parsed as JSON or the payload did not contain all required information or an application error happend while processing in one of the registered handlers.

parameters:

exception: the exception that occurred
payload: the parsed payload or nil if event payload was invalid JSON
raw_payload: the original unparsed payload (String)
dead_letter_queue_name: name of the dead letter queue this event has been sent to


35
36
37
# File 'lib/hivent/life_cycle_event_handler.rb', line 35

def event_processing_failed(exception, payload, raw_payload, dead_letter_queue_name)
  # do nothing
end

#event_processing_succeeded(event_name, event_version, payload) ⇒ Object

Invoked when an event has successfully been processed by all registered handlers

parameters:

event_name: name of the processed event
event_version: version of the processed event
payload: payload of the processed event


22
23
24
# File 'lib/hivent/life_cycle_event_handler.rb', line 22

def event_processing_succeeded(event_name, event_version, payload)
  # do nothing
end