Trait chekov::Application

source ·
pub trait Application: Unpin + 'static + Send + Default {
    type Storage: Storage;

    // Provided methods
    fn with_default() -> ApplicationBuilder<Self> { ... }
    fn get_name() -> &'static str { ... }
}
Expand description

Application are high order logical seperator.

A chekov application is a simple entity that will represent a single and unique domain application.

It is used to separate and allow multiple chekov application on a single runtime.

It’s also used to define the typology of the application, like which storage will be used or how to resolve the eventbus’s event

The Application isn’t instanciate at all and it’s useless to define fields on it. It just act as a type holder for the entier system.

#[derive(Default)]
struct DefaultApp {}

impl chekov::Application for DefaultApp {
    // Define that this application will use a PostgresStorage as event_store
    type Storage = event_store::prelude::PostgresStorage;
}

Required Associated Types§

source

type Storage: Storage

The type of storage used by the application

Provided Methods§

source

fn with_default() -> ApplicationBuilder<Self>

Used to initiate the launch of the application

It will just return an ApplicationBuilder which will take care of everything.

source

fn get_name() -> &'static str

Returns the logical name of the application Mostly used for logs and debugging.

You can configure it or use the default value which is the struct full qualified name.

Implementors§