On Mon, Dec 12, 2011 at 09:07:45AM -0800, Reed Law wrote: > > Thanks for the welcome but I've posted here before (as R Law).
This post was moderated so I quickly assumed you were new. > You understood me correctly for the most part. The problem with the > cursor is that each participant would only receive one workitem at a > time, but I wanted to hand off several (one for each step in the > checklist). Your interface could aggregate those distinct workitems, their feis (#fei) being quite close (same wfid, same expid root). > Your suggestion works and I'll probably go with something like that. > Quarderno looks nice but we've already got UI elements for checklists. > A question that came up as I looked into this was: how do you > implement a participant that replies immediately if some condition is > met? I know I could use the if expression in the process definition, > but it seems like that is only suitable for testing equality. With the upcoming ruote 2.2.1, it can do better than testing equality. https://github.com/jmettraux/ruote/blob/master/test/unit/ut_6_condition.rb > I want to check if some data is present in an external service. If the > information is present I want to copy it over (#1); if not, the > coauthor needs to complete a form (#2). So the participant > implementation will first attempt #1, and if it's successfully, simply > reply to the workitem (proceed). If #1 fails, the participant should > work as a normal storage participant for #2. Is this possible? What about making those steps explicit in the process definition ? ---8<--- sequence do copy_info_over human :unless => '${info}' end --->8--- If you really want to pack that into one participant you could do something like: ---8<--- class Acme::StorageParticipant < Ruote::StorageParticipant # Returns false so that the on_workitem operations are performed in # a new thread, not blocking the worker. # def do_not_thread false end def on_workitem workitem.fields['copying'] = true super info = ExternalService.copy_info_over wi = by_fei(fei) # re-fetch return unless wi # # workitem gone, probably cancelled, work over. if info # # information was fetched successfully, let's proceed # wi.fields['info'] = info proceed(wi) else # # re-put with updated info # # this will fail silently if the workitem is gone, not much to do # anyway # wi.fields['copying'] = false @context.storage.put(doc) end end # no need to override #on_cancel end --->8--- I hope it helps. Best regards, -- John Mettraux - http://lambda.io/processi -- 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
