Class | Beetle::Handler |
In: |
lib/beetle/handler.rb
|
Parent: | Object |
message | [R] | the Message instance which caused the handler to be created |
called when a message should be processed. if the message was caused by an RPC, the return value will be sent back to the caller. calls the initialized processor proc if a processor proc was specified when creating the Handler instance. calls method process if no proc was given. make sure to call super if you override this method in a subclass.
# File lib/beetle/handler.rb, line 36 36: def call(message) 37: @message = message 38: if @processor 39: @processor.call(message) 40: else 41: process 42: end 43: end
called when message processing has finally failed (i.e., the number of allowed handler execution attempts or the number of allowed exceptions has been reached) and no failure callback was specified when this handler instance was created.
# File lib/beetle/handler.rb, line 82 82: def failure(result) 83: logger.error "Beetle: handler has finally failed" 84: end
called for message processing if no processor was specfied when the handler instance was created
# File lib/beetle/handler.rb, line 47 47: def process 48: logger.info "Beetle: received message #{message.inspect}" 49: end