Module: Clamour::Handler

Extended by:
ActiveSupport::Concern
Included in:
Message::Receive
Defined in:
lib/clamour/handler.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#on_message(message) ⇒ Object

This method is abstract.

You must use on_message method to act on a message.

Parameters:

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/clamour/handler.rb', line 36

def on_message(message)
  raise NotImplementedError.new('You must override "on_message" method to act on a message')
end

#perform(message_class_name, message_attributes) ⇒ Object

Like a usual Sidekiq job.

Parameters:

  • message_class_name (String)
  • message_attributes (Hash)


29
30
31
32
# File 'lib/clamour/handler.rb', line 29

def perform(message_class_name, message_attributes)
  message = restore_message(message_class_name, message_attributes)
  on_message(message)
end