Class: Temporalio::Client::ScheduleHandle

Inherits:
Object
  • Object
show all
Defined in:
lib/temporalio/client/schedule_handle.rb

Overview

Handle for interacting with a schedule. This is usually created via #create_schedule or #schedule_handle.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idString (readonly)

Returns ID of the schedule.

Returns:

  • (String)

    ID of the schedule.



12
13
14
# File 'lib/temporalio/client/schedule_handle.rb', line 12

def id
  @id
end

Instance Method Details

#backfill(*backfills, rpc_options: nil) ⇒ Object

Backfill the schedule by going through the specified time periods as if they passed right now.

Parameters:

Raises:



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/temporalio/client/schedule_handle.rb', line 26

def backfill(
  *backfills,
  rpc_options: nil
)
  raise ArgumentError, 'At least one backfill required' if backfills.empty?

  @client._impl.backfill_schedule(Interceptor::BackfillScheduleInput.new(
                                    id:,
                                    backfills:,
                                    rpc_options:
                                  ))
end

#delete(rpc_options: nil) ⇒ Object

Delete this schedule.

Parameters:

  • rpc_options (RPCOptions, nil) (defaults to: nil)

    Advanced RPC options.

Raises:



44
45
46
47
48
49
# File 'lib/temporalio/client/schedule_handle.rb', line 44

def delete(rpc_options: nil)
  @client._impl.delete_schedule(Interceptor::DeleteScheduleInput.new(
                                  id:,
                                  rpc_options:
                                ))
end

#describe(rpc_options: nil) ⇒ Schedule::Description

Fetch this schedule’s description.

Parameters:

  • rpc_options (RPCOptions, nil) (defaults to: nil)

    Advanced RPC options.

Returns:

Raises:



57
58
59
60
61
62
# File 'lib/temporalio/client/schedule_handle.rb', line 57

def describe(rpc_options: nil)
  @client._impl.describe_schedule(Interceptor::DescribeScheduleInput.new(
                                    id:,
                                    rpc_options:
                                  ))
end

#pause(note: 'Paused via Ruby SDK', rpc_options: nil) ⇒ Object

Pause the schedule and set a note.

Parameters:

  • note (String) (defaults to: 'Paused via Ruby SDK')

    Note to set on the schedule.

  • rpc_options (RPCOptions, nil) (defaults to: nil)

    Advanced RPC options.

Raises:



70
71
72
73
74
75
76
# File 'lib/temporalio/client/schedule_handle.rb', line 70

def pause(note: 'Paused via Ruby SDK', rpc_options: nil)
  @client._impl.pause_schedule(Interceptor::PauseScheduleInput.new(
                                 id:,
                                 note:,
                                 rpc_options:
                               ))
end

#trigger(overlap: nil, rpc_options: nil) ⇒ Object

Trigger an action on this schedule to happen immediately.

Parameters:

  • overlap (Schedule::OverlapPolicy, nil) (defaults to: nil)

    If set, overrides the schedule’s overlap policy.

  • rpc_options (RPCOptions, nil) (defaults to: nil)

    Advanced RPC options.

Raises:



84
85
86
87
88
89
90
# File 'lib/temporalio/client/schedule_handle.rb', line 84

def trigger(overlap: nil, rpc_options: nil)
  @client._impl.trigger_schedule(Interceptor::TriggerScheduleInput.new(
                                   id:,
                                   overlap:,
                                   rpc_options:
                                 ))
end

#unpause(note: 'Unpaused via Ruby SDK', rpc_options: nil) ⇒ Object

Unpause the schedule and set a note.

Parameters:

  • note (String) (defaults to: 'Unpaused via Ruby SDK')

    Note to set on the schedule.

  • rpc_options (RPCOptions, nil) (defaults to: nil)

    Advanced RPC options.

Raises:



98
99
100
101
102
103
104
# File 'lib/temporalio/client/schedule_handle.rb', line 98

def unpause(note: 'Unpaused via Ruby SDK', rpc_options: nil)
  @client._impl.unpause_schedule(Interceptor::UnpauseScheduleInput.new(
                                   id:,
                                   note:,
                                   rpc_options:
                                 ))
end

#update(rpc_options: nil) {|Parameter| ... } ⇒ Object

Update a schedule using a callback to build the update from the description.

NOTE: In future versions, the callback may be invoked multiple times in a conflict-resolution loop.

Parameters:

  • rpc_options (RPCOptions, nil) (defaults to: nil)

    Advanced RPC options.

Yields:

  • Block called to obtain the update.

Yield Parameters:

  • Parameter (Schedule::Update::Input)

    to the block that contains a description with the schedule to be updated.

Yield Returns:

  • (Schedule::Update, nil)

    The update to apply, or ‘nil` to not perform an update.

Raises:



117
118
119
120
121
122
123
# File 'lib/temporalio/client/schedule_handle.rb', line 117

def update(rpc_options: nil, &updater)
  @client._impl.update_schedule(Interceptor::UpdateScheduleInput.new(
                                  id:,
                                  updater:,
                                  rpc_options:
                                ))
end