pub trait Plugin: Sync + Send {
// Required methods
fn start(
&self,
pub_socket: Socket,
sub_socket: Socket,
) -> Result<(), EngineError>;
fn get_subscriptions(&self) -> Result<Vec<Box<dyn EventType>>, EngineError>;
fn get_id(&self) -> Uuid;
fn get_name(&self) -> String;
}Expand description
Public API for defining the internal plugins. Internal plugns are plugins that run within the main application process in a child thread. In particular, all internal plugins must be written in Rust.
Required Methods§
Sourcefn start(
&self,
pub_socket: Socket,
sub_socket: Socket,
) -> Result<(), EngineError>
fn start( &self, pub_socket: Socket, sub_socket: Socket, ) -> Result<(), EngineError>
The entry point for the plugin. The engine will start the plugin in its own thread and execute this function. the pub_socket is used by the plugin to publish new events. the sub_socket is used by the plugin to get events published by other plugins.
Sourcefn get_subscriptions(&self) -> Result<Vec<Box<dyn EventType>>, EngineError>
fn get_subscriptions(&self) -> Result<Vec<Box<dyn EventType>>, EngineError>
Return the event subscriptions, as a vector of strings, that this plugin is interested in.