lib/openwfe/expool/expressionpool.rb in openwferu-0.9.10.653 vs lib/openwfe/expool/expressionpool.rb in openwferu-0.9.11

- old
+ new

@@ -45,10 +45,11 @@ require 'rexml/document' require 'openwfe/utils' require 'openwfe/service' require 'openwfe/logging' +require 'openwfe/omixins' require 'openwfe/rudefinitions' require 'openwfe/flowexpressionid' require 'openwfe/util/lru' require 'openwfe/util/safe' require 'openwfe/util/workqueue' @@ -130,11 +131,12 @@ include \ ServiceMixin, MonitorMixin, OwfeServiceLocator, Observable, - WorkqueueMixin + WorkqueueMixin, + FeiMixin SAFETY_LEVEL = 2 # # code loaded from a remote URI will get evaluated with # that security level @@ -153,11 +155,11 @@ start_workqueue end # - # Makes sure to call the do_stop() method of the Stoppable mixin + # Stops this expression pool (especially its workqueue). # def stop @stopped = true stop_workqueue onotify :stop @@ -184,10 +186,13 @@ # def prepare_raw_expression (launchitem) wfdurl = launchitem.workflow_definition_url + raise "launchitem.workflow_definition_url not set, cannot launch" \ + unless wfdurl + definition = if wfdurl.match "^field:" wfdfield = wfdurl[6..-1] launchitem.attributes.delete wfdfield else read_uri(wfdurl) @@ -715,13 +720,34 @@ list_workflows(false, wfid)[0] end protected + # + # This method is called by the workqueue when processing + # the atomic work operations. + # def do_process_workelement elt - message, fei, workitem = elt - send message, fei, workitem + begin + + message, fei, workitem = elt + send message, fei, workitem + + rescue Exception => e + + se = OpenWFE::exception_to_s(e) + + onotify :error, fei, message, workitem, se + + fei = extract_fei fei + + lwarn do + "#{self.service_name} " + + "operation :#{message.to_s} on #{fei.to_s} " + + "failed with\n" + se + end + end end # # The real apply work. #