[][src]Crate organix

Organix, organic application

Organix provides an opinionated way to build application with multiple services independent from each other but still require communication channels.

With Organix it is possible to design the different components of your application in isolation from each others. It allows to build runtimes for your applications.

Minimal configuration

The core component of Organix is the Watchdog. In order to build the Watchdog you need to define an Organix object which defines your app and its services.

use organix::{Organix, WatchdogBuilder};

struct App;

let watchdog = WatchdogBuilder::<App>::new().build();

defining a service

Now defining a new service:

use organix::{Organix, IntercomMsg, ServiceState, Service, ServiceIdentifier, service};
use async_trait::async_trait;

struct HeartBeat(ServiceState<Self>);

impl Service for HeartBeat {
   const SERVICE_IDENTIFIER: ServiceIdentifier = "heart-beat";
   type IntercomMsg = service::NoIntercom;

   fn prepare(state: ServiceState<Self>) -> Self {
       // initialize the state of the service
   async fn start(mut self) {
       // where you do the work

Now from there you can start the service by adding it in the App:

use organix::{Organix, ServiceManager};

struct App {
  heart_beat: service::ServiceManager<HeartBeat>,

See the examples for more complete details on how to build services with the provided interface.

Configuring the runtime

It is possible to configure the runtime of the different serviced.

on the Organix app type

  • #[runtime(shared)]: will make all the services to use a shared runtime by default. Otherwise the default is for every service to run an individual runtime.

On the field of the Organix app type

  • #[runtime(shared)]: will make the associated service to use a shared runtime with the other shared labeled services. This shared runtime has io and time drivers already enabled.
  • #[runtime(io)]: enable the io driver;
  • #[runtime(time)]: enable the time driver;
  • #[runtime(skip)]: ignore the field.


pub use service::Service;
pub use service::ServiceIdentifier;
pub use service::ServiceManager;
pub use service::ServiceState;





special access to the watchdog direct handle





trait to define the different core services and their associated metadata

Derive Macros