Module: ActiveJob::Notificare::StepDSL

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_job/notificare/step_dsl.rb

Overview

Wraps ActiveJob::Continuation#step with Notificare-specific kwargs.

‘notify:` declares a state-machine event tied to the step’s successful completion. The value is stashed on the job instance keyed by step name; the projection reads it off ‘event.payload` at `step_completed.active_job` time. Actual Notification row writes land in ticket 06.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#notificare_step_notify_for(step_name) ⇒ Object

Read by Projection’s ‘step_completed.active_job` handler.



36
37
38
39
# File 'lib/active_job/notificare/step_dsl.rb', line 36

def notificare_step_notify_for(step_name)
  return nil unless defined?(@_notificare_step_notify) && @_notificare_step_notify
  @_notificare_step_notify[step_name.to_sym]
end

#step(name, *args, notify: nil, **opts, &block) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/active_job/notificare/step_dsl.rb', line 26

def step(name, *args, notify: nil, **opts, &block)
  if notify
    self.class.instance_variable_set(:@_has_step_notifications, true)
    @_notificare_step_notify ||= {}
    @_notificare_step_notify[name.to_sym] = notify
  end
  super(name, *args, **opts, &block)
end