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.



237
238
239
240
241
242
# File 'lib/restate/durable_future.rb', line 237

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.



256
257
258
# File 'lib/restate/durable_future.rb', line 256

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



247
248
249
250
251
252
253
# File 'lib/restate/durable_future.rb', line 247

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