Class: Restate::SendHandle

Inherits:
Object
  • Object
show all
Defined in:
lib/restate/durable_future.rb

Overview

A handle for fire-and-forget send operations. Returned by ctx.service_send, ctx.object_send, ctx.workflow_send.

Instance Method Summary collapse

Constructor Details

#initialize(ctx, invocation_id_handle) ⇒ SendHandle

Returns a new instance of SendHandle.



84
85
86
87
88
89
# File 'lib/restate/durable_future.rb', line 84

def initialize(ctx, invocation_id_handle)
  @ctx = ctx
  @invocation_id_handle = invocation_id_handle
  @invocation_id_resolved = false
  @invocation_id_value = nil
end

Instance Method Details

#cancelObject

Cancel the remote invocation.



103
104
105
# File 'lib/restate/durable_future.rb', line 103

def cancel
  @ctx.cancel_invocation(invocation_id)
end

#invocation_idString

Returns the invocation ID of the sent call. Lazily resolved.

Returns:

  • (String)

    the invocation ID



94
95
96
97
98
99
100
# File 'lib/restate/durable_future.rb', line 94

def invocation_id
  unless @invocation_id_resolved
    @invocation_id_value = @ctx.resolve_handle(@invocation_id_handle)
    @invocation_id_resolved = true
  end
  @invocation_id_value
end