lib/asir/transport/resque.rb in asir-1.0.6 vs lib/asir/transport/resque.rb in asir-1.0.7
- old
+ new
@@ -49,11 +49,13 @@
def _send_message message, message_payload
stream.with_stream! do | io | # Force connect
queue = message[:resque_queue] || self.queue
$stderr.puts " #{$$} #{self} _send_message #{message_payload.inspect} to queue=#{queue.inspect} as #{self.class} :process_job" if @verbose >= 2
- ::Resque.enqueue_to(queue, self.class, message_payload)
+ # Invokes Transport::Resque.perform(metadata, payload)
+ metadata = message[:resque_metadata] || message.description
+ ::Resque.enqueue_to(queue, self.class, metadata, message_payload)
end
end
def queues
@queues ||=
@@ -116,10 +118,11 @@
ensure
Thread.current[:asir_transport_resque_instance] = save
end
# Class method entry point from Resque::Job.perform.
- def self.perform payload
+ def self.perform metadata, payload = nil
+ payload ||= metadata # old calling signature (just payload).
# $stderr.puts " #{self} process_job payload=#{payload.inspect}"
t = Thread.current[:asir_transport_resque_instance]
# Pass payload as in_stream; _receive_message will return it.
t.serve_message! payload, nil
end