Class: BunnyCarrot::BusinessActor

Inherits:
LoggingActor
  • Object
show all
Defined in:
lib/bunny_carrot/business_actor.rb

Instance Method Summary collapse

Methods inherited from LoggingActor

#on_error

Methods included from Logger

included, #logger

Constructor Details

#initializeBusinessActor

Returns a new instance of BusinessActor.



4
5
6
7
# File 'lib/bunny_carrot/business_actor.rb', line 4

def initialize
  super()
  logger.info 'Business actor initialized'
end

Instance Method Details

#act(message_hash) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/bunny_carrot/business_actor.rb', line 9

def act(message_hash)
  payload = message_hash.fetch(:payload)
  worker  = message_hash.fetch(:worker)
  headers = message_hash.fetch(:message_headers)
  logger.info "Business #{self.object_id} is acting: #{payload.inspect}"
  worker.run(payload, headers)
  true
end