Class: Karafka::Core::Monitoring::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/core/monitoring/event.rb

Overview

Single notification event wrapping payload with id

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, payload) ⇒ Event

Returns a new instance of Event.

Parameters:

  • id (String, Symbol)

    id of the event

  • payload (Hash)

    event payload



12
13
14
15
# File 'lib/karafka/core/monitoring/event.rb', line 12

def initialize(id, payload)
  @id = id
  @payload = payload
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/karafka/core/monitoring/event.rb', line 8

def id
  @id
end

#payloadObject (readonly)

Returns the value of attribute payload.



8
9
10
# File 'lib/karafka/core/monitoring/event.rb', line 8

def payload
  @payload
end

Instance Method Details

#[](name) ⇒ Object

Hash access to the payload data (if present)

Parameters:

  • name (String, Symbol)


20
21
22
# File 'lib/karafka/core/monitoring/event.rb', line 20

def [](name)
  @payload.fetch(name)
end