lib/ruote/part/storage_participant.rb in ruote-2.1.7 vs lib/ruote/part/storage_participant.rb in ruote-2.1.8

- old
+ new

@@ -29,12 +29,29 @@ # # A participant that stores the workitem in the same storage used by the # engine and the worker(s). # - # Does not thread by default. + # part = engine.register_participant 'alfred', Ruote::StorageParticipant # + # # ... a bit later + # + # puts "workitems still open : " + # part.each do |workitem| + # puts "#{workitem.fei.wfid} - #{workitem.fields['params']['task']}" + # end + # + # # ... when done with a workitem + # + # part.reply(workitem) + # # this will remove the workitem from the storage and hand it back + # # to the engine + # + # Does not thread by default (the engine will not spawn a dedicated thread + # to handle the delivery to this participant, the workitem will get stored + # via the main engine thread and basta). + # class StorageParticipant include LocalParticipant include Enumerable @@ -42,9 +59,11 @@ def initialize (engine_or_options={}, options=nil) if engine_or_options.respond_to?(:context) @context = engine_or_options.context + elsif engine_or_options.is_a?(Ruote::Context) + @context = engine_or_options else options = engine_or_options end options ||= {}