Expand description
Foundational system components for Relay’s services.
Relay’s system is based on [tokio
]. To use any of these components, ensure a tokio runtime is
available.
§Services
The basic building block in Relay are asynchronous Service
s. Each service implements an
Interface
, which consists of one or many messages that can be sent to the service using its
Addr
. See the docs of these types for more information on how to implement and use them.
§Shutdown
The static Controller
service can listen for process signals and initiate a graceful
shutdown. Note that services must check a ShutdownHandle
to receive these signals. See the
struct level documentation for more information.
Macros§
- Spawns an instrumented task with an automatically generated
TaskId
.
Structs§
- The address of a
Service
. - Message response resulting in an asynchronous
Request
. - A channel that broadcasts values to attached senders.
- The request when sending an asynchronous message to a service.
- Variation of
AsyncResponse
that efficiently broadcasts responses to many requests. - Sends a message response from a service back to the waiting
BroadcastRequest
. - Configures a Relay
Runtime
. - Service to start and gracefully stop the system runtime.
- Message response for fire-and-forget messages with no output.
- Inbound channel for messages sent through an
Addr
. - An address to a
Service
implementing any interface that takes a given message. - The request when sending an asynchronous message to a service.
- A Relay async runtime.
- Handle to the
Runtime
’s metrics. - An error when sending a message to a service fails.
- Sends a message response from a service back to the waiting
Request
. - Keeps track of running services.
- Shutdown request message sent by the
Controller
to subscribed services. - Notifies a service about an upcoming shutdown.
- An identifier for tasks spawned by
spawn()
, used to log metrics.
Enums§
- Determines how to shut down the Relay system.
Traits§
- Declares a message as part of an
Interface
. - A message interface for services.
- Response behavior of an
Interface
message. - An asynchronous unit responding to messages.
Functions§
- Creates an unbounded channel for communicating with a
Service
. - Spawns a new asynchronous task, returning a [
JoinHandle
] for it.