ExternalPlugin

Trait ExternalPlugin 

Source
pub trait ExternalPlugin: Send + Sync {
    // Required methods
    fn get_tcp_port(&self) -> i32;
    fn get_subscriptions(&self) -> Result<Vec<Box<dyn EventType>>, EngineError>;
    fn get_id(&self) -> Uuid;
    fn get_name(&self) -> String;

    // Provided method
    fn start(
        &self,
        pub_socket: Socket,
        sub_socket: Socket,
        external_socket: Socket,
    ) -> Result<(), EngineError> { ... }
}
Expand description

Public API for defining external plugins. External plugins are plugins that will run in a separate process from the main application process. In particular, all plugins written in languages other than Rust will be external plugins. These external plugins still need to be registered on the main application.

Required Methods§

Source

fn get_tcp_port(&self) -> i32

the tcp port on which the external plugin will retrieve and publish events.

Source

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.

Source

fn get_id(&self) -> Uuid

Returns the unique id for this plugin

Source

fn get_name(&self) -> String

Returns the name for the plugin

Provided Methods§

Source

fn start( &self, pub_socket: Socket, sub_socket: Socket, external_socket: Socket, ) -> Result<(), EngineError>

A Rust start function for external plugins. This function provides an API for the external plugin process to retrieve events and publish new events. It also supports commands, such as “quit” which will allow it to shut down. This API is exposed on a zmq REP socket.

Implementors§