On Wed, Nov 07, 2012 at 08:10:27AM +0100, Mario Camou wrote:
>
> (...)
>
> The problem is that the front-end app needs to know the FEI of the
> wait_for_save so that it can do the PUT. After thinking a bit more I am
> thinking that wait_for_save can search for the human_action workitem
> (probably using the WFID and the username) and then add its FEI to the
> workitem and perhaps send the URI to the front-end via XMPP. It would then
> return without doing a reply_to_engine. When the front-end PUTs the
> workitem with proceeded:true, an on_reply would take care of saving the
> work.

Yes, the wait_for_save could search for the human_action workitem.


>  The problem I see here is a possible race condition, could the
> wait_for_save participant be executed before the human_action workitem is
> actually created and persisted?

Yes, it is a very likely scenario.

Why not try to simplify the whole scenario with

---8<---
Ruote.process_definition :name => 'bm_form_multi', :revision => '0.1' do
  cursor do
    wait_for_edit
    human_action
    wait_for_save
    rewind :if => 'xyz...'
  end
end # process_definition
--->8---

? It sounds possible from your description. Aggressively trying to simplify
the thing.

Human action would be terminated upon entering wait_for_save...


> Any other ideas?

Like I said in my previous email, I think a unique participant for the step
would be valuable...
Well, more like a pair participant/receiver.

---8<---
class AbstraCC::XmppFormParticipant < Ruote::Participant
  def on_workitem
    XMPP.publish(encode_workitem(workitem))
    # do not reply to ruote,
    # answer will come back via the HttpReceiver
  end
end

$ruote.register_participant 'xmpp_form', AbstraCC::XmppFormParticipant

# ...

class AbstraCC::HttpReceiver < Ruote::Receiver
  def receive(http_request)
    super(decode_workitem(http_request)
  end
end

$http_receiver = AbstraCC::HttpReceiver.new($ruote)

# ...

require 'sinatra'

post '/workitems' do

  $http_receiver.receive(request)

  [ 200, {}, 'ok' ]
end
--->8---

A single participant, a single fei.

Sorry if I'm wasting your time with those suggestions.


Best regards,

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