Struct ockam_node::Context [−][src]
pub struct Context { /* fields omitted */ }
Expand description
Context contains Node state and references to the runtime.
Implementations
Return all addresses of this worker
Create a new context without spawning a full worker
pub async fn start_worker<NM, NW, S>(
&self,
address: S,
worker: NW
) -> Result<()> where
S: Into<AddressSet>,
NM: Message + Send + 'static,
NW: Worker<Context = Context, Message = NM>,
pub async fn start_worker<NM, NW, S>(
&self,
address: S,
worker: NW
) -> Result<()> where
S: Into<AddressSet>,
NM: Message + Send + 'static,
NW: Worker<Context = Context, Message = NM>,
Start a new worker handle at Address
Shut down a worker by its primary address
Send a message via a fully qualified route
Routes can be constructed from a set of Address
es, or via
the RouteBuilder
type. Routes can contain middleware
router addresses, which will re-address messages that need to
be handled by specific domain workers.
Send a message via a fully qualified route using specific Worker address
Routes can be constructed from a set of Address
es, or via
the RouteBuilder
type. Routes can contain middleware
router addresses, which will re-address messages that need to
be handled by specific domain workers.
Forward a transport message to its next routing destination
Similar to [Context::send_message
], but taking a
TransportMessage
, which contains the full destination
route, and calculated return route for this hop.
Note: you most likely want to use
[Context::send_message
] instead, unless you are writing an
external router implementation for ockam node.
Receive a message without a timeout
Block the current worker to wait for a typed message
This function may return a Err(FailedLoadData)
if the
underlying worker was shut down, or Err(Timeout)
if the call
was waiting for longer than the default timeout
. Use
receive_timeout
to adjust the
timeout period.
Will return None
if the corresponding worker has been
stopped, or the underlying Node has shut down.
Block to wait for a typed message, with explicit timeout
Block the current worker to wait for a message satisfying a conditional
Will return Err
if the corresponding worker has been
stopped, or the underlying node has shut down. This operation
has a default timeout.
Internally this function calls receive
and .cancel()
in a
loop until a matching message is found.
Return a list of all available worker addresses on a node