module Nagare::Listener::ClassMethods

Class methods that automatically get added to inheriting classes

Public Instance Methods

stream(name) click to toggle source

Defines the name of the stream this listener listens to.

This method causes the listener to register itself with the listener pool, creating automatically a consumer group if none exists for the stream, and the stream itself if not initialized.

Defining a stream is required for every listener, failing to do so will cause the listener never to be invoked.

@param name [String] name of the stream the listener should listen to.

# File lib/nagare/listener.rb, line 29
def stream(name)
  class_variable_set(:@@stream_name, name)

  # Force consumer group creation
  Nagare::ListenerPool.listener_pool
  name
end
stream_name() click to toggle source
# File lib/nagare/listener.rb, line 37
def stream_name
  class_variable_get(:@@stream_name)
end