On Tue, May 29, 2012 at 05:38:19AM -0700, Josh Adams wrote:
> Hi everyone,

Hello Josh,

welcome to ruote's mailing list.

> So I'm brand new to ruote.  I've built ad-hoc workflow-lite systems for my
> projects in the past (essentially state machines, implicit workflow spread
> across multiple models, and background workers pushing state).  Obviously
> this is sub-optimal, and declarative workflow seems much nicer.

Nice description, I'll steal it one day ;-)

Those systems are robust, declarative workflows may be a bit brittle. We have
to learn all the tools.

> Ruote.process_definition :name => 'if_example', :revision => '0.1' do
>   sequence do
>     requestor :task => 'request_business_trip_application_form'
>     participant 'hr'
>     participant 'ceo', :if => '${f:amount} > 25000'
>   end
> end
>
> I'm using ruote-on-rails to play around with the pdefs, and so I plug that
> sucker in and add a form for the task that has an 'amount' field.  I fill
> it in with 30000.  When the 'hr' participant picks it up, the workitem
> looks like this:
>
> {"fields":{"amount":"30000"},"params":{"hr":null},"dispatched_at":"2012-05-29
> 12:36:52.202034 UTC"}
>
> However, when I advance the workflow it's just done - the CEO doesn't get
> handed the workitem.  I've done about five different variants of this, and
> I'm sure it's something dumb I'm doing, but I can't seem to get past the
> most basic example here.
>
> I've also tried modifying the workitem to make the amount be an integer
> rather than a string, and that failed as well.

I have the impression that you're using ruote 2.2.0.

I've played with

https://gist.github.com/2830509

---8<---
require 'ruote'

$dboard = Ruote::Dashboard.new(Ruote::Worker.new(Ruote::HashStorage.new))
$dboard.noisy = true

pdef = Ruote.define do
  requestor :task => 'request_business_trip_application_form'
  participant 'hr'
  participant 'ceo', :if => '${f:amount} > 25000'
end

class MyParticipant
  include Ruote::LocalParticipant
  def on_workitem
    puts "+++ #{workitem.participant_name} +++"
    reply
  end
end

$dboard.register do
  catchall MyParticipant
end

print 'amount? '
amount = gets.strip

wfid = $dboard.launch(pdef, 'amount' => amount)
$dboard.wait_for(wfid)
--->8---

with ruote 2.3.0 and it worked. 2.3.0 (master branch pulled in via Bundler)
features improved condition evulation. I guess you're on 2.2.0 and the :if
gets poorly evaluated.


I hope this will help, cheers,

--
John Mettraux - http://lambda.io/jmettraux

-- 
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

Reply via email to