Class: Plugin::ResqueQueue
- Inherits:
-
LanGrove::Plugin::Enqueuer
- Object
- LanGrove::Plugin::Enqueuer
- Plugin::ResqueQueue
- Defined in:
- lib/plugin/resque_queue.rb
Instance Method Summary collapse
Instance Method Details
#enqueue_capsule(handler) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/plugin/resque_queue.rb', line 88 def enqueue_capsule( handler ) # # Enqueue job with the handler.capsule # return enqueue( queue_header( :load_capsule, handler ), handler.capsule ) end |
#enqueue_key(handler) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/plugin/resque_queue.rb', line 72 def enqueue_key( handler ) # # Enqueue job with the handler.key # return enqueue( queue_header( :get_capsule, handler ), handler.key ) end |
#validate_config ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/plugin/resque_queue.rb', line 17 def validate_config super config_exception( "#{self.class} requires :queue: defined" ) if @config[:queue].nil? or @config[:queue] == '' queue = @config[:queue] # # Dynamically define job class # # - Resque wants a class with @queue # defined # - Make one to give # @job_class = Object.const_set( @job, Class.new do self.instance_variable_set( :@queue, queue ) end ) @hostname = @config[:hostname].nil? ? 'localhost' : @config[:hostname] @port = @config[:port].nil? ? 6379 : @config[:port] Resque.redis = Redis.new( :host => @hostname, :port => @port ) end |