Class: MessageBusClient::MessageHandler::SubscribedChannel

Inherits:
Struct
  • Object
show all
Defined in:
lib/message_bus_client/message_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(last_id) ⇒ SubscribedChannel

Returns a new instance of SubscribedChannel.



3
4
5
6
# File 'lib/message_bus_client/message_handler.rb', line 3

def initialize(last_id)
  self.callbacks = []
  self.last_id = last_id
end

Instance Attribute Details

#callbacksObject

Returns the value of attribute callbacks

Returns:

  • (Object)

    the current value of callbacks



2
3
4
# File 'lib/message_bus_client/message_handler.rb', line 2

def callbacks
  @callbacks
end

#last_idObject

Returns the value of attribute last_id

Returns:

  • (Object)

    the current value of last_id



2
3
4
# File 'lib/message_bus_client/message_handler.rb', line 2

def last_id
  @last_id
end

Instance Method Details

#callback(payload, message_id) ⇒ Object



8
9
10
11
12
# File 'lib/message_bus_client/message_handler.rb', line 8

def callback(payload, message_id)
  callbacks.each do |callback|
    callback.call(payload, message_id)
  end
end