Class: Omnes::Execution

Inherits:
Object
  • Object
show all
Defined in:
lib/omnes/execution.rb

Overview

Execution of an Subscription

When an event is published, it executes all matching subscriptions. Every single execution is represented as an instance of this class. It contains the result value of the subscriptions along with helpful metadata as the time of the execution or a benchmark for it.

You'll most likely interact with this class for debugging or logging purposes through a Publication returned on Bus#publish.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subscription:, result:, benchmark:, time: Time.now.utc) ⇒ Execution

Returns a new instance of Execution.



35
36
37
38
39
40
# File 'lib/omnes/execution.rb', line 35

def initialize(subscription:, result:, benchmark:, time: Time.now.utc)
  @subscription = subscription
  @result = result
  @benchmark = benchmark
  @time = time
end

Instance Attribute Details

#benchmarkBenchmark::Tms (readonly)

Benchmark for the #subscription's callback

Returns:

  • (Benchmark::Tms)


27
28
29
# File 'lib/omnes/execution.rb', line 27

def benchmark
  @benchmark
end

#resultAny (readonly)

The value returned by the #subscription's callback

Returns:

  • (Any)


22
23
24
# File 'lib/omnes/execution.rb', line 22

def result
  @result
end

#subscriptionOmnes::Subscription (readonly)

The subscription to which the execution belongs

Returns:



17
18
19
# File 'lib/omnes/execution.rb', line 17

def subscription
  @subscription
end

#timeTime (readonly)

Time of execution

Returns:

  • (Time)


32
33
34
# File 'lib/omnes/execution.rb', line 32

def time
  @time
end