On Wed, Apr 21, 2010 at 06:34:38AM -0700, Olle wrote:
> 
> > If not possible, let me add some method helpers to LocalParticipant in the 
> > expression, exactly like you did, but in an "blessed" way.
> >
> 
> Best choice for me. But here you are the final judge. If you decided
> to don't do it, I'll use the first approach.

Hello Oleg,

it's in :

  
http://github.com/jmettraux/ruote/commit/366f958de05e5d4b109acac680d200f765b06777

Here is the test case, I hope it shows how it works :

---8<---
  BLACKBOARD = {}

  class StashingParticipant
    include Ruote::LocalParticipant
    def initialize (opts)
    end
    def consume (workitem)
      put(workitem.fei, 'token' => workitem.params['token'])
    end
    def cancel (fei, flavour)
      BLACKBOARD['token'] = get(fei, 'token')
    end
  end

  def test_stash

    BLACKBOARD.clear

    pdef = Ruote.process_definition do
      alpha :token => 'of esteem'
    end

    @engine.register_participant :alpha, StashingParticipant

    #noisy

    wfid = @engine.launch(pdef)
    wait_for(:alpha)

    ps = @engine.process(wfid)
    fexp = ps.expressions.find { |e| e.fei.expid == '0_0' }

    assert_equal({ 'token' => 'of esteem' }, fexp.h.stash)

    @engine.cancel_process(wfid)
    wait_for(wfid)

    assert_equal 'of esteem', BLACKBOARD['token']
  end
--->8---

The blackboard thing is only here for me to test.

You can see the communication between the consume and the cancel phases.

As of now 'put' can only get called once, since it can set multiples keys at 
once, it's OK. Maybe I will fix that later.

I hope it helps.


Best regards, thanks for all,

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

Reply via email to