Class: ActiveMessaging::Worker

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/activemessaging/threaded_poller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(poller, options) ⇒ Worker

Returns a new instance of Worker.



189
190
191
192
# File 'lib/activemessaging/threaded_poller.rb', line 189

def initialize(poller, options)
  self.poller = poller
  self.options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



187
188
189
# File 'lib/activemessaging/threaded_poller.rb', line 187

def options
  @options
end

#pollerObject

Returns the value of attribute poller.



187
188
189
# File 'lib/activemessaging/threaded_poller.rb', line 187

def poller
  @poller
end

Instance Method Details

#execute(message) ⇒ Object



194
195
196
197
198
199
200
201
202
# File 'lib/activemessaging/threaded_poller.rb', line 194

def execute(message)
  begin
    ::ActiveMessaging::Gateway.dispatch(message)
  ensure
    ::ActiveRecord::Base.clear_active_connections! if defined?(::ActiveRecord)
  end

  poller.executed!(current_actor)
end

#loggerObject



204
# File 'lib/activemessaging/threaded_poller.rb', line 204

def logger; ::ActiveMessaging.logger; end