Durable Object Stub
Description
The DurableObjectStub
interface is a client used to invoke methods on a remote Durable Object. The type of DurableObjectStub
is generic to allow for RPC methods to be invoked on the stub.
Durable Objects implement E-order semantics, a concept deriving from the E distributed programming language ↗. When you make multiple calls to the same Durable Object, it is guaranteed that the calls will be delivered to the remote Durable Object in the order in which you made them. E-order semantics makes many distributed programming problems easier. E-order is implemented by the Cap’n Proto ↗ distributed object-capability RPC protocol, which Cloudflare Workers uses for internal communications.
If an exception is thrown by a Durable Object stub all in-flight calls and future calls will fail with exceptions. To continue invoking methods on a remote Durable Object a Worker must recreate the stub. There are no ordering guarantees between different stubs.
Properties
id
id
is a property of the DurableObjectStub
corresponding to the DurableObjectId
used to create the stub.
name
name
is an optional property of a DurableObjectStub
, which returns the name that was used to create the DurableObjectId
via DurableObjectNamespace::idFromName
which was then used to create the DurableObjectStub
. This value is undefined if the DurableObjectId
used to create the DurableObjectStub
was constructed using DurableObjectNamespace::newUniqueId
.