Hi John,
I'm sorry because I missed so many details... Well here they are:
I'm using:
- JRuby. jruby 1.5.2 (ruby 1.8.7 patchlevel 249) (2010-08-20 1c5e29d)
(Java HotSpot(TM) Client VM 1.6.0_21) [i386-java]
- ruote-kit (latest)
- ruote-amqp (latest)
- amqp broker: RabbitMQ (vhost, user and pass already set)
In order to know how to launch workitems from amqp, I read the
ruote-amqp spec "receiver_spec.rb". Then I wrote the following tiny
script to launch workitems (with a process definition inside):
--8--
require 'rubygems'
require 'mq'
require 'json'
json = {
"definition" => "Ruote.process_definition :name => 'test' do
sequence do
echo '${f:foo}'
end
end",
"fields" => {
"foo" => "bar"
}
}.to_json
AMQP.start(:host => 'localhost', :vhost => 'ruote', :user => 'ruote',
:pass => 'ruote') do
amq = MQ.new
EM.add_periodic_timer(5){
p 'publish!'
amq.queue('ruote_workitems', :durable => true).publish(json)
}
end
--8--
Now, in config.ru I set the receiver with the following code:
--8--
#listen to the 'ruote_workitems' queue
receiver = RuoteAMQP::Receiver.new(
RuoteKit.engine,
# the receiver accepts workitems and launchitems
:launchitems => true
)
--8--
Now I think everything is set to work. I start ruote-kit and no
problems. I check current connections to amqp broker and it show one
connection to vhost ruote from localhost. It seems that ruote receiver
is connected. Now I start the little script that publishes a workitem
every 5 s. to the ruote_workitems queue. But messages are not
processed by ruote receiver. The all get stored in the queue... :(
It's a bit weird. If I add the following code to the little script...
--8--
amq = MQ.new
amq.queue('ruote_workitems', :durable => true).subscribe{ |msg|
p 'received!'
p msg
}
--8--
...it starts printing the workitems as soon as they are published. And
this code is pretty similar to the one found in
"lib/ruote-amqp/receiver.rb" except for the logic to process the
content of the workitem.
I also checked the properties of the queue (durable = true). Both the
receiver and publisher are using the same queue with the same
attribute.
Do you see anything wrong with the code or settings?
Thanks a lot for your help.
Best regards,
Gonzalo.
On Tue, Oct 5, 2010 at 1:44 AM, John Mettraux <[email protected]> wrote:
>
> On Mon, Oct 04, 2010 at 06:21:32AM -0700, Gonzalo wrote:
>>
>> I would like to use amqp participants within ruote-kit. Right now I'm
>> just trying to start workflows remotely with a RuoteAMQP::Receiver.
>>
>> So I added the following lines to config.ru:
>>
>> --8--
>> require 'ruote-amqp'
>>
>> # AMQP magic worked here
>> AMQP.settings[:host] = 'localhost'
>> AMQP.settings[:vhost] = 'ruote'
>> AMQP.settings[:user] = 'ruote'
>> AMQP.settings[:pass] = 'ruote'
>>
>> # listen to the 'ruote_workitems' queue
>> receiver = RuoteAMQP::Receiver.new(
>> RuoteKit.engine,
>> # the receiver accepts workitems and launchitems
>> :launchitems => true
>> )
>> --8--
>>
>> Then I send some messages (with process definitions) to the queue
>> "ruote_workitems". The command "rabbitmqctl list_queues -p ruote"
>> shows:
>>
>> Listing queues ...
>> ruote_workitems 4
>> ...done.
>>
>> Here is the problem. The receiver isn't grabbing the messages from
>> "ruote_workitems" queue. Do you know what is wrong? Am I missing
>> something?
>
> Hello Gonzalo,
>
> what version of Ruby, ruote, ruote-kit, ruote-amqp ?
>
> What do your workitems look like ? Maybe they are malformed. They won't get
> hanled if they are not hashes (JSON objects).
>
>
> Best regards,
>
> --
> John Mettraux - http://jmettraux.wordpress.com
>
> --
> you received this message because you are subscribed to the "ruote users"
> group.
> to post : send email to [email protected]
> to unsubscribe : send email to [email protected]
> more options : http://groups.google.com/group/openwferu-users?hl=en
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en