Sha256: 6568047a9d22cadf7363a3945dd25c6ee726935a2f90cee50e5ed607c2fe87b8
Contents?: true
Size: 1.1 KB
Versions: 8
Compression:
Stored size: 1.1 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