Sha256: a805445c9d5f8a6922fa626a8dbab0112c3aae916a3dc926f7c86e53d6f9b896

Contents?: true

Size: 413 Bytes

Versions: 2

Compression:

Stored size: 413 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), '..', "lib" )
require 'gearman'

# String reverse worker 

servers = ['127.0.0.1:4730']

t = nil
jobnum = 0

w = Gearman::Worker.new(servers)
w.add_ability('reverse_string') do |data,job|
   result = data.reverse
   puts "Job: #{job.inspect} Data: #{data.inspect} Reverse: #{result} "
   puts "Completed job ##{jobnum}"
   jobnum += 1
   result
end

loop { w.work }


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gearman-ruby-4.0.3 examples/worker_reverse_string.rb
gearman-ruby-4.0.2 examples/worker_reverse_string.rb