Sha256: 5f25831d945b40eb4c573025c936aebc75df573dc5d9697a9e7fdabd8e7d5117

Contents?: true

Size: 649 Bytes

Versions: 7

Compression:

Stored size: 649 Bytes

Contents

# frozen_string_literal: true

module BusinessFlow
  # Fire ActiveSupport events for every step that's run and on errors
  class InstrumentedStepExecutor < InstrumentedExecutor
    protected

    def execute_step(step)
      i_name = event_name(step)
      i_payload = { flow: flow, step: step }
      ActiveSupport::Notifications.instrument(i_name, i_payload) do |payload|
        payload[:step_result] = super
      end
      notify_errors(i_name, i_payload)
    end

    def step_event_name(step)
      "#{flow_name}.#{step.to_s.underscore}"
    end

    def event_name(step)
      "business_flow.step.#{step_event_name(step)}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
business_flow-0.19.4 lib/business_flow/instrumented_step_executor.rb
business_flow-0.19.3 lib/business_flow/instrumented_step_executor.rb
business_flow-0.19.2 lib/business_flow/instrumented_step_executor.rb
business_flow-0.19.1 lib/business_flow/instrumented_step_executor.rb
business_flow-0.19.0 lib/business_flow/instrumented_step_executor.rb
business_flow-0.18.1 lib/business_flow/instrumented_step_executor.rb
business_flow-0.18.0 lib/business_flow/instrumented_step_executor.rb