Class: Qwirk::Adapter::InMemory::WorkerConfig

Inherits:
Base::ExpandingWorkerConfig show all
Defined in:
lib/qwirk/adapter/in_memory/worker_config.rb

Instance Attribute Summary

Attributes inherited from Base::WorkerConfig

#adapter_factory, #default_options, #manager, #marshal_sym, #marshaler, #name, #options, #queue_name, #queue_options, #response_options, #topic_name, #worker_class

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base::ExpandingWorkerConfig

#count, #join, #max_count=, #min_count=, #periodic_call, #worker_stopped

Methods inherited from Base::WorkerConfig

#bean_attributes_changed, #initialize, #join, #marshal_response, #periodic_call, #stopped?, #to_s, #unmarshal_response, #worker_stopped

Constructor Details

This class inherits a constructor from Qwirk::Adapter::Base::WorkerConfig

Class Method Details

.default_marshal_symObject



11
12
13
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 11

def self.default_marshal_sym
  :none
end

.in_process?(config) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 19

def self.in_process?(config)
  true
end

.initial_default_configObject



15
16
17
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 15

def self.initial_default_config
  super.merge(:queue_max_size => 100)
end

Instance Method Details

#create_workerObject



28
29
30
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 28

def create_worker
  Worker.new(self.name, self.marshaler, @queue)
end

#initObject



23
24
25
26
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 23

def init
  super
  @queue = Factory.get_worker_queue(self.name, self.queue_name, self.topic_name, @queue_max_size)
end

#queue_max_sizeObject



43
44
45
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 43

def queue_max_size
  @queue_max_size
end

#queue_max_size=(max_size) ⇒ Object



47
48
49
50
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 47

def queue_max_size=(max_size)
  @queue_max_size = max_size
  @queue.max_size = max_size if @queue
end

#queue_sizeObject



38
39
40
41
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 38

def queue_size
  return 0 unless @queue
  @queue.size
end

#stopObject



32
33
34
35
36
# File 'lib/qwirk/adapter/in_memory/worker_config.rb', line 32

def stop
  Qwirk.logger.debug { "Stopping #{self}" }
  @queue.stop
  super
end