Struct riker::system::ActorSystem
source · pub struct ActorSystem<Msg: Message> {
pub proto: Arc<ProtoSystem>,
pub kernel: Option<KernelRef<Msg>>,
pub event_store: Option<ActorRef<Msg>>,
pub sys_channels: Option<SysChannels<Msg>>,
/* private fields */
}
Expand description
The actor runtime and common services coordinator
The ActorSystem
provides a runtime on which actors are executed.
It also provides common services such as channels, persistence
and scheduling. The ActorSystem
is the heart of a Riker application,
starting serveral threads when it is created. Create only one instance
of ActorSystem
per application.
Fields§
§proto: Arc<ProtoSystem>
§kernel: Option<KernelRef<Msg>>
§event_store: Option<ActorRef<Msg>>
§sys_channels: Option<SysChannels<Msg>>
Implementations§
source§impl<Msg: Message> ActorSystem<Msg>
impl<Msg: Message> ActorSystem<Msg>
sourcepub fn new<Mdl>(model: &Mdl) -> Result<ActorSystem<Msg>, SystemError>where
Mdl: Model<Msg = Msg>,
pub fn new<Mdl>(model: &Mdl) -> Result<ActorSystem<Msg>, SystemError>where
Mdl: Model<Msg = Msg>,
Create a new ActorSystem
instance
Requires a type that implements the Model
trait.
sourcepub fn with_name<Mdl>(
model: &Mdl,
name: &str
) -> Result<ActorSystem<Msg>, SystemError>where
Mdl: Model<Msg = Msg>,
pub fn with_name<Mdl>(
model: &Mdl,
name: &str
) -> Result<ActorSystem<Msg>, SystemError>where
Mdl: Model<Msg = Msg>,
Create a new ActorSystem
instance with provided name
Requires a type that implements the Model
trait.
sourcepub fn with_config<Mdl>(
model: &Mdl,
name: &str,
cfg: Config
) -> Result<ActorSystem<Msg>, SystemError>where
Mdl: Model<Msg = Msg>,
pub fn with_config<Mdl>(
model: &Mdl,
name: &str,
cfg: Config
) -> Result<ActorSystem<Msg>, SystemError>where
Mdl: Model<Msg = Msg>,
Create a new ActorSystem
instance bypassing default config behavior
Requires a type that implements the Model
trait.
sourcepub fn shutdown(&self) -> Shutdown
pub fn shutdown(&self) -> Shutdown
Shutdown the actor system
Attempts a graceful shutdown of the system and all actors.
Actors will receive a stop message, executing actor.post_stop
.
Does not block. Returns a future which is completed when all actors have successfully stopped.
sourcepub fn start_date(&self) -> &DateTime<Utc>
pub fn start_date(&self) -> &DateTime<Utc>
Returns the system start date
sourcepub fn host(&self) -> Arc<String>
pub fn host(&self) -> Arc<String>
Returns the hostname used when the system started
The host is used in actor addressing.
Currently not used, but will be once system clustering is introduced.
pub fn print_tree(&self)
sourcepub fn system_root(&self) -> &ActorRef<Msg>
pub fn system_root(&self) -> &ActorRef<Msg>
Returns the system root actor reference
sourcepub fn default_stream(&self) -> &ActorRef<Msg>
pub fn default_stream(&self) -> &ActorRef<Msg>
Returns a reference to the default stream channel
sourcepub fn event_stream(&self) -> &ActorRef<Msg>
pub fn event_stream(&self) -> &ActorRef<Msg>
Returns a reference to the event stream channel
sourcepub fn dead_letters(&self) -> &ActorRef<Msg>
pub fn dead_letters(&self) -> &ActorRef<Msg>
Returns a reference to the dead letters channel
sourcepub fn io_manager(&self) -> &ActorRef<Msg>
pub fn io_manager(&self) -> &ActorRef<Msg>
Returns a reference to the IO Manager
sourcepub fn sys_actor_of(
&self,
props: BoxActorProd<Msg>,
name: &str
) -> Result<ActorRef<Msg>, CreateError>
pub fn sys_actor_of(
&self,
props: BoxActorProd<Msg>,
name: &str
) -> Result<ActorRef<Msg>, CreateError>
Create an actor under the system root
Trait Implementations§
source§impl<Msg> ActorRefFactory for ActorSystem<Msg>where
Msg: Message,
impl<Msg> ActorRefFactory for ActorSystem<Msg>where
Msg: Message,
source§impl<Msg> ActorSelectionFactory for ActorSystem<Msg>where
Msg: Message,
impl<Msg> ActorSelectionFactory for ActorSystem<Msg>where
Msg: Message,
source§impl<Msg: Clone + Message> Clone for ActorSystem<Msg>
impl<Msg: Clone + Message> Clone for ActorSystem<Msg>
source§fn clone(&self) -> ActorSystem<Msg>
fn clone(&self) -> ActorSystem<Msg>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more