On Wed, Apr 21, 2010 at 04:25:41AM -0700, Olle wrote:
> 
> Below is a simple example, which uses some questionable approach for
> that. It works, but I'm not sure - it feels not good for me. Tried on
> the ruote's "trunk".
> 
> ------ Participant
>    def consume( workitem )
>       #some external work returns an "id"
>       id = some_external_call()
> 
>       #now need to store received id for futher use in "cancel"
> without replying. Reply will be done by external service.
>       exp = fetch_flow_expression( workitem )
>       exp.h.applied_workitem[ 'received_id'] = id
>       exp.persist_or_raise
>     end
> 
>     def cancel(fei, flavour)
> 
>       wi = Ruote::Exp::FlowExpression.fetch(@context,
> fei.to_h).h.applied_workitem
>       cancel_prev_external_call( wi['received_id'] )
>     end
> --------------------

Hello Oleg,

may I suggest you store the mapping fei <-> 'external id' on the external side ?

---8<---
  def consume (workitem)
    some_external_call('consume', workitem.fei.to_storage_id)
  end

  def cancel (fei, flavour)
    some_external_call('cancel', fei.to_storage_id)
  end
--->8---

If not possible, let me add some method helpers to LocalParticipant in the 
expression, exactly like you did, but in an "blessed" way.

What do you think ?

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