Module: ActiveJob::Temporal::Schedulable::ClassMethods

Defined in:
lib/activejob/temporal/schedulable.rb

Instance Method Summary collapse

Instance Method Details

#create_temporal_schedule(options = nil, **kwargs) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
27
28
29
30
31
# File 'lib/activejob/temporal/schedulable.rb', line 22

def create_temporal_schedule(options = nil, **kwargs)
  if options || kwargs.any?
    schedule_options = merged_schedule_options(normalize_schedule_options(options, kwargs))
    return ActiveJob::Temporal::Schedule.new(self, schedule_options).create
  end

  raise ArgumentError, "No schedule defined for #{name}" unless temporal_schedule

  temporal_schedule.create
end

#schedule(options = nil, **kwargs) ⇒ Object



13
14
15
16
# File 'lib/activejob/temporal/schedulable.rb', line 13

def schedule(options = nil, **kwargs)
  schedule_options = normalize_schedule_options(options, kwargs)
  @temporal_schedule = ActiveJob::Temporal::Schedule.new(self, schedule_options)
end

#temporal_scheduleObject



18
19
20
# File 'lib/activejob/temporal/schedulable.rb', line 18

def temporal_schedule
  @temporal_schedule
end

#temporal_schedule_handle(id: nil, client: ActiveJob::Temporal.client) ⇒ Object



33
34
35
# File 'lib/activejob/temporal/schedulable.rb', line 33

def temporal_schedule_handle(id: nil, client: ActiveJob::Temporal.client)
  client.schedule_handle(id || temporal_schedule&.id || "ajsch:#{name}")
end