lib/openwfe/participants/participant.rb in openwferu-0.9.2 vs lib/openwfe/participants/participant.rb in openwferu-0.9.3

- old
+ new

@@ -48,27 +48,38 @@ # # The 'participant' concept is displayed as a module, so that # other pieces of code may easily 'mix it in'. # module Participant - include Contextual # # A participant will be receiving workitems via this method. # It may also receive cancelitems via this method. # If the participant provides a cancel(cancelitem) method, cancel # items will be fed to this cancel() and not to consume(). # def consume (workitem) + + raise NotImplementedError.new( + "implementation for method consume() "+ + "is missing in class '#{self.class}'") end # # (optional) # #def cancel (cancelitem) #end + end + # + # Local participants provide handy methods like reply_to_engine() to + # further implementations of the Participant concept. + # + module LocalParticipant + include Participant, Contextual, Logging, OwfeServiceLocator + # # Returns the FlowExpression instance that triggered this # participant. # A ParticipantExpression instance will most likely be returned. # @@ -76,9 +87,18 @@ return nil if not @application_context @application_context[S_EXPRESSION_POOL]\ .fetch_expression(workitem.flow_expression_id) + end + + # + # Participants use this method to reply to their engine when + # their job is done. + # + def reply_to_engine (workitem) + + get_engine.reply(workitem) end end end