Sha256: 655506b09ed5368798a325cc9ef785330ca72df52509d664dcb51840ad9204d8

Contents?: true

Size: 453 Bytes

Versions: 7

Compression:

Stored size: 453 Bytes

Contents

require 'rubygems'
#require 'gearman'
require '../lib/gearman'

servers = ['localhost:4730']
w = Gearman::Worker.new(servers)

# Add a handler for a "sleep" function that takes a single argument, the
# number of seconds to sleep before reporting success.
w.add_ability('reverse_to_file') do |data,job|
  puts "Data: #{data.inspect}"
 word, file = data.split("\0")
 puts "Word: #{word}"
 puts "File: #{file}"
 # Report success.
 true
end
loop { w.work }

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gearman-ruby-3.0.8 examples/worker_reverse_to_file.rb
gearman-ruby-3.0.7 examples/worker_reverse_to_file.rb
gearman-ruby-3.0.6 examples/worker_reverse_to_file.rb
gearman-ruby-3.0.4 examples/worker_reverse_to_file.rb
gearman-ruby-3.0.3 examples/worker_reverse_to_file.rb
gearman-ruby-3.0.2 examples/worker_reverse_to_file.rb
gearman-ruby-3.0.1 examples/worker_reverse_to_file.rb