This participant was born out of a suggestion from Jan Topiński in
This participant is a gateway to code placed in a directory.
engine.register do toto, Ruote::RevParticipant, :dir => 'participants/toto/' end
Then in the participants/toto/ dir :/my_workflow__0.1__toto_0.6.rb
- participant toto, workflow ‘my_workflow’ with revision ‘0.1’
- participant toto, workflow ‘my_workflow’ any revision
- participant toto with rev ‘0.6’, any workflow
- participant toto, any rev, any workflow
The scheme goes like :/wf-name__wf-revision__participant-name__p-revision.rb
The files themselves look like :
def consume(workitem) workitem.fields['kilroy'] = 'was here' reply_to_engine(workitem) end
The file directly contains the classical participant methods defined at the
top level. #cancel, #accept?, #on_reply and of course #consume are OK.
Maybe, look at the tests for more clues :
Note : It’s probably not the best participant in a distributed context, it
grabs the code to execute from a directory. If you use it in a distributed
context, you’ll have to make sure to synchronize the directory to each host
running a worker.
Warning : this participant trusts the code it deals with, there is no