As part of our workflow, we talk to several third parties and the 
communication with the third parties is represented by a step in the 
workflow.  Based on what the third party returns to us, we may need to 
enter a support step where data is added/corrected then the workflow step 
to the third party is re-run.

Ideally, our workflow definition doesn't have a support workflow step like 
this where anything _support is a StorageParticipant:

> alpha
> alpha_support if "${support_needed}"
> bravo
> bravo_support if "${support_needed}"
> etc.
>


Looking around, we ran across the #listen functionality which seems like it 
would fit our needs, but we are not getting the results we expected.  

With the following example, I expected the workflow step sequence to be 
[alpha bravo support bravo charlie].  Instead, I get [alpha bravo charlie 
support bravo].

Is it possible to accomplish stopping on given support steps if they are 
needed without explicitly listing them?  Is listen totally incorrect for 
trying to accomplish this task? If so, can you suggest an alternative 
implementation?  I've played with changing sequence to a cursor and using 
jump :to instead of trying to go straight to the participant with a ref.

Here is the test & process definition.  Thanks for any feedback.

Doug

=== With a Sequence ====
 def test_listen_for_support
    @dashboard.register_participant :alpha do
      tracer << "alpha\n"
    end
    @dashboard.register_participant :bravo do |workitem|
      tracer << "bravo\n"
      if 'bravo' == workitem.fields['needs_support'] 
        workitem.fields['needs_support'] = nil
      else
        workitem.fields['needs_support'] = 'bravo'
      end
    end
    @dashboard.register_participant :charlie do
      tracer << "charlie\n"
    end
    @dashboard.register_participant :support do |workitem|
      tracer << "support\n"
    end

    pdef = Ruote.process_definition do
      concurrence do
        listen :to => "bravo", :upon => 'reply', :where => "'bravo' == 
${f:needs_support}" do
          set 'v:needs_support' => "${f:needs_support}"
          participant :ref => "support"
          participant '${v:needs_support}'
        end

        sequence do
          alpha
          bravo
          charlie
        end
      end
    end

    wfid = @dashboard.launch(pdef)
    wait_for(wfid)
    assert_equal %w[ alpha bravo support bravo charlie ], @tracer.to_a
  end


=======  WITH A CURSOR
def test_listen_for_support_cursor
    @dashboard.register_participant :alpha do
      tracer << "alpha\n"
    end
    @dashboard.register_participant :bravo do |workitem|
      tracer << "bravo\n"
      if 'bravo' == workitem.fields['needs_support'] 
        workitem.fields['needs_support'] = nil
      else
        workitem.fields['needs_support'] = 'bravo'
      end
    end
    @dashboard.register_participant :charlie do
      tracer << "charlie\n"
    end
    @dashboard.register_participant :support do |workitem|
      tracer << "support\n"
    end

    pdef = Ruote.process_definition do
      concurrence do
        listen :to => "bravo", :upon => 'reply', :where => "'bravo' == 
${f:needs_support}" do
          set 'v:needs_support' => "${f:needs_support}"
          participant :ref => "support"
          jump :to => '${v:needs_support}'
        end

        cursor do
          alpha
          bravo
          charlie
        end
      end
    end

    wfid = @dashboard.launch(pdef)
    wait_for(wfid)
    assert_equal %w[ alpha bravo support bravo charlie ], @tracer.to_a
  end  



  

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