Sha256: e97bca0643619f323fca1ef2cc83e66023ee78cef1fd16b6d62453e5a45e5b72
Contents?: true
Size: 1.09 KB
Versions: 8
Compression:
Stored size: 1.09 KB
Contents
module Concurrent module Actor module Behaviour # Collects returning value and sets the CompletableFuture in the {Envelope} or error on failure. class SetResults < Abstract attr_reader :error_strategy def initialize(core, subsequent, core_options, error_strategy) super core, subsequent, core_options @error_strategy = Match! error_strategy, :just_log, :terminate!, :pause! end def on_envelope(envelope) result = pass envelope if result != MESSAGE_PROCESSED && !envelope.future.nil? envelope.future.success result log DEBUG, "finished processing of #{envelope.message.inspect}" end nil rescue => error log ERROR, error case error_strategy when :terminate! terminate! when :pause! behaviour!(Pausing).pause!(error) when :just_log # nothing else raise end envelope.future.fail error unless envelope.future.nil? end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems