Skip to content

Instantly share code, notes, and snippets.

@lgalabru

lgalabru/gist:5200379

Last active Dec 15, 2015
Embed
What would you like to do?
require 'redis'
require 'amqp'
require 'rufus-json/automatic'
require 'ruote'
require 'ruote-amqp'
require 'ruote-redis'
{ :host => 'localhost',
:vhost => 'ruote',
:user => 'guest',
:pass => 'guest'
}.each { |k,v|
AMQP.settings[k]=v
}
@em = Thread.new { EM.run {} }
storage= Ruote::Redis::Storage.new(::Redis.new(:thread_safe => true), {})
worker= Ruote::Worker.new(storage)
@dashboard = Ruote::Dashboard.new(worker)
@dashboard.register(
:toto,
Ruote::Amqp::Participant,
:exchange => [ 'direct', '' ],
:routing_key => 'work1',
:forget => true)
wi = nil
@queue = AMQP::Channel.new.queue('work1')
@queue.subscribe { |headers, payload| wi = Rufus::Json.decode(payload) }
sleep 0.1
pdef = Ruote.define do
toto
end
wfid = @dashboard.launch(pdef)
r = @dashboard.wait_for(wfid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.