bug in ruote-amqp?

0 views
Skip to first unread message

Asier

unread,
Jun 15, 2010, 1:23:47 PM6/15/10
to openwfe...@googlegroups.com
Hi

First, sorry for the previous multipost... gmail was a bit crazy.

I register a participant (ruote-kit) in config.ru as:

> - - - - - - - - - - - - - - - - - - - - - - - - -
config.register do
participant :copper, RuoteAMQP::Participant,
:reply_by_default => true,
:default_queue => 'ruote'
catchall
end
> - - - - - - - - - - - - - - - - - - - - - - - - -

Launch this workflow:

> - - - - - - - - - - - - - - - - - - - - - - - - -
<process-definition name="secuencia simple" revision="1_0">
<sequence>
<participant ref="copper" task="almacenamiento" queue="ruote"
reply_anyway="true"/>
<participant ref="alice" task="aprobacion"/>
</sequence>
</process-definition>
> - - - - - - - - - - - - - - - - - - - - - - - - -

But it looks like parameters aren't being passed correctly. To determine if
the workitem must reply to the engine, file lib/ruote-amqp/participant.rb
makes this test (line 160)

> - - - - - - - - - - - - - - - - - - - - - - - - -
if @options[:reply_by_default] || workitem.fields['params']['reply_anyway'] ==
true
reply_to_engine( workitem )
end
> - - - - - - - - - - - - - - - - - - - - - - - - -

But if I put this:
> - - - - - - - - - - - - - - - - - - - - - - - - -
p @options,workitem.fields['params']['reply_anyway']
> - - - - - - - - - - - - - - - - - - - - - - - - -
just before the 'if' I get

{:reply_by_default=>false, :default_queue=>nil}
'true'

So the 'if' always is false!

Am I doing something wrong?

Thanks

Asier

unread,
Jun 15, 2010, 1:25:35 PM6/15/10
to openwfe...@googlegroups.com
El 15/06/2010 19:23, Asier escribió:

> I register a participant (ruote-kit) in config.ru as:
>
> > - - - - - - - - - - - - - - - - - - - - - - - - -
> config.register do
> participant :copper, RuoteAMQP::Participant,
> :reply_by_default => true,
> :default_queue => 'ruote'
> catchall
> end
> > - - - - - - - - - - - - - - - - - - - - - - - - -

Forgot the require statement:

config.register do

require 'ruote-amqp/participant'


participant :copper, RuoteAMQP::Participant,
:reply_by_default => true,
:default_queue => 'ruote'

catchall
end

Thanks

John Mettraux

unread,
Jun 15, 2010, 8:15:05 PM6/15/10
to openwfe...@googlegroups.com

Hello Asier,

given

p [ @options, workitem.fields['params']['reply_anyway'] ]
# => [ {:reply_by_default=>false, :default_queue=>nil}, 'true' ]

the 'if' should resolve successively to

if @options[:reply_by_default] || workitem.fields['params']['reply_anyway'] == true

if false || workitem.fields['params']['reply_anyway'] == true
if false || true == true
if false || true
if true

I don't understand how you end up with false.


Best regards,

--
John Mettraux - http://jmettraux.wordpress.com

Asier

unread,
Jun 16, 2010, 1:20:57 AM6/16/10
to openwfe...@googlegroups.com
On Miércoles, 16 de Junio de 2010 02:15:05 John Mettraux escribió:

> > Am I doing something wrong?
>
> Hello Asier,
>
> given
>
> p [ @options, workitem.fields['params']['reply_anyway'] ]
> # => [ {:reply_by_default=>false, :default_queue=>nil}, 'true' ]
>
> the 'if' should resolve successively to
>
> if @options[:reply_by_default] ||
> workitem.fields['params']['reply_anyway'] == true if false ||
> workitem.fields['params']['reply_anyway'] == true
> if false || true == true
> if false || true
> if true
>
> I don't understand how you end up with false.

p workitem.fields['params']['reply_anyway']

'true'

It's a string, but it gets compared to a boolean true, so returns always
false.

If I change to == 'true' it works ok

Perhaps the problem is in the process xml definition?

Thanks

John Mettraux

unread,
Jun 16, 2010, 1:22:54 AM6/16/10
to openwfe...@googlegroups.com

On Wed, Jun 16, 2010 at 07:20:57AM +0200, Asier wrote:
> On Mi�rcoles, 16 de Junio de 2010 02:15:05 John Mettraux escribi�:

Ah sorry, now I get it.

ruote-amqp should be OK with both true and 'true' (the rest is false).

In my opinion, it's an XML process definition but a ruote-amqp issue.

Asier

unread,
Jun 16, 2010, 1:31:52 AM6/16/10
to openwfe...@googlegroups.com
On Miércoles, 16 de Junio de 2010 02:15:05 John Mettraux escribió:

> > config.register do
> >
> > participant :copper, RuoteAMQP::Participant,
> > :reply_by_default => true,
> > :default_queue => 'ruote'
> >
> > catchall
> >
> > end

[ ... ]

> > But if I put this:
> > > - - - - - - - - - - - - - - - - - - - - - - - - -
> >
> > p @options,workitem.fields['params']['reply_anyway']
> >
> > > - - - - - - - - - - - - - - - - - - - - - - - - -
> >
> > just before the 'if' I get
> >
> > {:reply_by_default=>false, :default_queue=>nil}
> > 'true'

And one more question: participant instantiation initialization variables
reply_by_default => true and default_queue => 'ruote' algo get lost

The output of the p @options ... doesn't honor it's instantiation.

(I'm posting it here because Kenneth sometimes is around this group)

Thanks

John Mettraux

unread,
Jun 16, 2010, 1:40:18 AM6/16/10
to openwfe...@googlegroups.com

On Wed, Jun 16, 2010 at 07:31:52AM +0200, Asier wrote:
> On Mi�rcoles, 16 de Junio de 2010 02:15:05 John Mettraux escribi�:

>
> > > config.register do
> > >
> > > participant :copper, RuoteAMQP::Participant,
> > > :reply_by_default => true,
> > > :default_queue => 'ruote'
> > >
> > > catchall
> > >
> > > end
>
> [ ... ]
>
> > > But if I put this:
> > > > - - - - - - - - - - - - - - - - - - - - - - - - -
> > >
> > > p @options,workitem.fields['params']['reply_anyway']
> > >
> > > > - - - - - - - - - - - - - - - - - - - - - - - - -
> > >
> > > just before the 'if' I get
> > >
> > > {:reply_by_default=>false, :default_queue=>nil}
> > > 'true'
>
> And one more question: participant instantiation initialization variables
> reply_by_default => true and default_queue => 'ruote' algo get lost
>
> The output of the p @options ... doesn't honor its instantiation.

>
> (I'm posting it here because Kenneth sometimes is around this group)

Hello Asier,

Kenneth is living in South Africa, so right now, he's deaf. It's probably the worst time to ask him any help about open source projects ;-)

please try with

---8<---


config.register do

participant :copper, RuoteAMQP::Participant,
'reply_by_default' => true,
'default_queue' => 'ruote'
catchall
end

--->8---

though your initial version should work.

Maybe you should fork ruote-amqp on Github and then go on with your modifications are then send a pull request to Kenneth.

I'm here to help as well.

BTW, what do you mean by :

> The output of the p @options ... doesn't honor its instantiation.


As you wish,

Asier

unread,
Jun 16, 2010, 1:52:57 AM6/16/10
to openwfe...@googlegroups.com
On Miércoles, 16 de Junio de 2010 07:40:18 John Mettraux escribió:

> BTW, what do you mean by :
> > The output of the p @options ... doesn't honor its instantiation.
>
> As you wish,

If I declare

| participant :copper, RuoteAMQP::Participant,
| :reply_by_default => true,
| :default_queue => 'ruote'

Then the output of the participant options now is:

| p @options
| {:reply_by_default=>false, :default_queue=>nil}

I think it should honor initialization options and return something like

| p @options
| {:reply_by_default=>true, :default_queue=>'ruote'}

Thanks

Asier

unread,
Jun 16, 2010, 4:51:19 AM6/16/10
to openwfe...@googlegroups.com
El 16/06/2010 7:40, John Mettraux escribi�:

> though your initial version should work.
>
> Maybe you should fork ruote-amqp on Github and then go on with your modifications are then send a pull request to Kenneth.
>
> I'm here to help as well.
>
> BTW, what do you mean by :
>
>> The output of the p @options ... doesn't honor its instantiation.

If I register the participant like:

| participant :copper, RuoteAMQP::Participant.new(
| :reply_by_default => true,
| :default_queue => 'ruote')

Parameters get passed ok, but this kind of registration is "stateful" or
by-instance, and I've readed that ruote 2.1 needs stateless participant, like in:

| participant :copper, RuoteAMQP::Participant

I'll take a look at ruote-jig and beanstalk and share experiences here

Thanks

John Mettraux

unread,
Jun 16, 2010, 4:54:21 AM6/16/10
to openwfe...@googlegroups.com

As said, if you need ruote-amqp and want a version with a fix, just shout.

That's most certainly a bug.

John Mettraux

unread,
Jun 17, 2010, 9:27:10 AM6/17/10
to openwfe...@googlegroups.com

Hello Asier,

please have a look at this 2.1.10 version of ruote-amqp

http://github.com/jmettraux/ruote-amqp

I built it because of this thread here and that conversation :

http://groups.google.com/group/openwferu-users/browse_frm/thread/ae522bb42d0c1367


Feel free to build a gem from that repository or to point your Gemfile to it.


Feedback is welcome, cheers,

threetee

unread,
Jun 17, 2010, 10:51:01 AM6/17/10
to ruote
On Jun 16, 1:51 am, Asier <avsg...@gmail.com> wrote:
> If I register the participant like:
>
> | participant :copper, RuoteAMQP::Participant.new(
> |       :reply_by_default => true,
> |       :default_queue => 'ruote')
>
> Parameters get passed ok, but this kind of registration is "stateful" or
> by-instance, and I've readed that ruote 2.1 needs stateless participant, like in:
>
> | participant :copper, RuoteAMQP::Participant

I ran into a similar issue, and you are correct about
RuoteAMQP::Participant needing to be stateless in ruote 2.1. I posted
some code that worked for me in:
http://groups.google.com/group/openwferu-users/browse_thread/thread/5c620ef874f4de19#

Hope this helps!

Asier

unread,
Jun 17, 2010, 11:49:45 AM6/17/10
to openwfe...@googlegroups.com
El 17/06/2010 16:51, threetee escribi�:

Yes, I've readed that thread, but your participants are stateless and binded
to the default queue. I prefer to work with more than one queue. Also I'm
having problems with java client but I suppose is lack of knowledge.

I've also tryed beanstalkd and is't by far more easy to setup and work with
that ruote amqp, but it lags user athentification and the server-side only
runs on unix-kind machines (linux).

Greets

Asier

unread,
Jun 17, 2010, 12:28:34 PM6/17/10
to openwfe...@googlegroups.com
El 17/06/2010 15:27, John Mettraux escribi�:

> Hello Asier,
>
> please have a look at this 2.1.10 version of ruote-amqp
>
> http://github.com/jmettraux/ruote-amqp
>
> I built it because of this thread here and that conversation :
>
> http://groups.google.com/group/openwferu-users/browse_frm/thread/ae522bb42d0c1367
>
>
> Feel free to build a gem from that repository or to point your Gemfile to it.

I've builded and substituted kenneth't gem with yours and... don't work

The offending command is in ruote-amqp\participant.rb, line 97

| class Participant
|
| include Ruote::LocalParticipant
|
| # Accepts an options hash with the following keys:
| #
| # * :reply_by_default => (bool) false by default
| # * :default_queue => (string) nil by default
| def initialize( options )
|
| RuoteAMQP.start!

start! method doesn't exist. Here is the error log:

{"type":"errors",
"_id":"err_0_0_0!!20100617-kizeboru",
"message":"#<NoMethodError: undefined method `start!' for
RuoteAMQP:Module>","trace":"C:/global/tomcat/6.0.26/webapps/ROOT/WEB-INF/gems/gems/ruote-amqp-2.1.10/lib/ruote-amqp/participant.rb:97:in
`initialize'\nC:/global/tomcat/6.0.26/webapps/ROOT/WEB-INF/gems/gems/ruote-

[ ... ]

Greets

Asier

unread,
Jun 17, 2010, 12:31:33 PM6/17/10
to openwfe...@googlegroups.com
El 17/06/2010 18:28, Asier escribi�:

> I've builded and substituted kenneth't gem with yours and... don't work
>
> The offending command is in ruote-amqp\participant.rb, line 97

I forgot!

The participant is registered as this:

| require 'ruote-amqp/participant'
| participant :copper, RuoteAMQP::Participant,

| :default_queue => 'ruote',
| :reply_by_default => true


Greets

John Mettraux

unread,
Jun 17, 2010, 7:44:53 PM6/17/10
to openwfe...@googlegroups.com

On Thu, Jun 17, 2010 at 06:31:33PM +0200, Asier wrote:
> El 17/06/2010 18:28, Asier escribi�:
>
> >I've builded and substituted kenneth't gem with yours and... don't work
> >
> >The offending command is in ruote-amqp\participant.rb, line 97

Hello Asier,

the start! method does exist :

http://github.com/jmettraux/ruote-amqp/blob/ruote2.1/lib/ruote-amqp.rb#L34-47

It's not documented, but ruote-amqp as to be required via

require 'ruote-amqp'

> I forgot!
>
> The participant is registered as this:
>
> | require 'ruote-amqp/participant'

replace with

require 'ruote-amqp'

which triggers

http://github.com/jmettraux/ruote-amqp/blob/ruote2.1/lib/ruote-amqp.rb#L20-22


I will enhance the doc in my ruote-amqp fork an maybe add a require 'ruote-amqp' to participant and receiver so that this require thing won't affect anyone anymore.


Best regards,

John Mettraux

unread,
Jun 17, 2010, 9:37:12 PM6/17/10
to openwfe...@googlegroups.com

On Fri, Jun 18, 2010 at 08:44:53AM +0900, John Mettraux wrote:
>
> I will enhance the doc in my ruote-amqp fork an maybe add a require 'ruote-amqp' to participant and receiver so that this require thing won't affect anyone anymore.

Please note that RuoteAMQP::WorkitemListener and RuoteAMQP::LaunchitemListener should be considered 'deprecated' :

http://github.com/jmettraux/ruote-amqp/commit/0a7ec982322b585bfab3dbff63726e4f4dc86573


Cheers,

Asier

unread,
Jun 18, 2010, 5:26:37 AM6/18/10
to openwfe...@googlegroups.com
El 18/06/2010 3:37, John Mettraux escribi�:

>
> On Fri, Jun 18, 2010 at 08:44:53AM +0900, John Mettraux wrote:
>>
>> I will enhance the doc in my ruote-amqp fork an maybe add a require 'ruote-amqp' to participant and receiver so that this require thing won't affect anyone anymore.
>
> Please note that RuoteAMQP::WorkitemListener and RuoteAMQP::LaunchitemListener should be considered 'deprecated' :
>
> http://github.com/jmettraux/ruote-amqp/commit/0a7ec982322b585bfab3dbff63726e4f4dc86573

Thanks John, now it's working ok

Greets

Reply all
Reply to author
Forward
0 new messages