pkieltyka (owner)

Revisions

gist: 233246 Download_button fork
public
Public Clone URL: git://gist.github.com/233246.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'eventmachine'
require 'em-jack'
 
EM.run {
@queue = EMJack::Connection.new
 
# Each job will make an event to reserve and wait for a new job to come in
@queue.each_job do |job|
puts "Got job #{job.jobid}"
 
if process(job)
@queue.delete(job)
else
# failed to process...
@queue.release(job) # puts the job back on the queue to be worked on again
end
end
 
def process(job)
puts "yea...."
end
}