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
> 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
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
> > 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
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.
> > 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
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,
> 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
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
As said, if you need ruote-amqp and want a version with a fix, just shout.
That's most certainly a bug.
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,
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
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
> 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
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,
Please note that RuoteAMQP::WorkitemListener and RuoteAMQP::LaunchitemListener should be considered 'deprecated' :
http://github.com/jmettraux/ruote-amqp/commit/0a7ec982322b585bfab3dbff63726e4f4dc86573
Cheers,
Thanks John, now it's working ok
Greets