Skip to content

Commit 5d2b717

Browse files
Docs
1 parent 7a02929 commit 5d2b717

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

packages/restate-sdk/src/context.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,40 @@ export interface Context extends RestateContext {
591591
*/
592592
genericSend<REQ = Uint8Array>(call: Send<REQ>): InvocationHandle;
593593

594+
/**
595+
* Make a request/response RPC to the specified target service.
596+
*
597+
* The RPC goes through Restate and is guaranteed to be reliably delivered. The RPC is also
598+
* journaled for durable execution and will thus not be duplicated when the handler is re-invoked
599+
* for retries or after suspending.
600+
*
601+
* This call will return the result produced by the target handler, or the TerminalError, if the target
602+
* handler finishes with a Terminal Error.
603+
*
604+
* This call is a suspension point: The handler might suspend while awaiting the response and
605+
* resume once the response is available.
606+
*
607+
* @param call send target and options
608+
*/
594609
call<REQ, RES>(call: Call<REQ, RES>): InvocationPromise<RES>;
595610

596-
send<REQ>(call: Send<REQ>): InvocationHandle;
611+
/**
612+
* Send a request to the specified target service. This method effectively behaves
613+
* like enqueuing the message in a message queue.
614+
*
615+
* The message goes through Restate and is guaranteed to be reliably delivered. The RPC is also
616+
* journaled for durable execution and will thus not be duplicated when the handler is re-invoked
617+
* for retries or after suspending.
618+
*
619+
* This returns immediately; the message sending happens asynchronously in the background.
620+
* Despite that, the message is guaranteed to be sent, because the completion of the invocation that
621+
* triggers the send (calls this function) happens logically after the sending. That means that any
622+
* failure where the message does not reach Restate also cannot complete this invocation, and will
623+
* hence recover this handler and (through the durable execution) recover the message to be sent.
624+
*
625+
* @param send send target and options
626+
*/
627+
send<REQ>(send: Send<REQ>): InvocationHandle;
597628

598629
/**
599630
* Returns the raw request that triggered that handler.

0 commit comments

Comments
 (0)