pub trait Service {
// Required methods
fn on_ready(&mut self, endpoint: &EndpointHandle);
fn on_waiting_for_configuration(&mut self, endpoint: &EndpointHandle);
fn on_configuration(
&mut self,
endpoint: &EndpointHandle,
message: Box<Delivery>,
) -> Result<bool, Error>;
fn on_event(
&mut self,
endpoint: &EndpointHandle,
message: Box<Delivery>,
) -> Result<(), Error>;
fn on_command(
&mut self,
endpoint: &EndpointHandle,
message: Box<Delivery>,
) -> Result<(), Error>;
fn on_result(
&mut self,
endpoint: &EndpointHandle,
message: Box<Delivery>,
) -> Result<(), Error>;
fn on_message_returned(
&mut self,
endpoint: &EndpointHandle,
routing_key: String,
);
fn on_clock_ticked(&mut self, endpoint: &EndpointHandle, time: u64);
}Expand description
The traditional Callback API
A service should be run with run_service.
Required Methods§
Sourcefn on_ready(&mut self, endpoint: &EndpointHandle)
fn on_ready(&mut self, endpoint: &EndpointHandle)
Called when the EndpointHandle starts consuming the subscribed messages.
Sourcefn on_waiting_for_configuration(&mut self, endpoint: &EndpointHandle)
fn on_waiting_for_configuration(&mut self, endpoint: &EndpointHandle)
Called when the EndpointHandle is connected and Configuration events were subscribed.
Usually, the implementation publishes a configuration request event on the EDA Bus.
Sourcefn on_configuration(
&mut self,
endpoint: &EndpointHandle,
message: Box<Delivery>,
) -> Result<bool, Error>
fn on_configuration( &mut self, endpoint: &EndpointHandle, message: Box<Delivery>, ) -> Result<bool, Error>
Called when a subscribed configuration event is received.
The implementation returns Ok(true) only if it is fully configured and ready to
consume business events.
Sourcefn on_event(
&mut self,
endpoint: &EndpointHandle,
message: Box<Delivery>,
) -> Result<(), Error>
fn on_event( &mut self, endpoint: &EndpointHandle, message: Box<Delivery>, ) -> Result<(), Error>
Called when a subscribed event is received.
If an Error is returned, the message is acknowledged accordingly.
Sourcefn on_command(
&mut self,
endpoint: &EndpointHandle,
message: Box<Delivery>,
) -> Result<(), Error>
fn on_command( &mut self, endpoint: &EndpointHandle, message: Box<Delivery>, ) -> Result<(), Error>
Called when a subscribed command is received.
If an Error is returned, the message is acknowledged accordingly.
Sourcefn on_result(
&mut self,
endpoint: &EndpointHandle,
message: Box<Delivery>,
) -> Result<(), Error>
fn on_result( &mut self, endpoint: &EndpointHandle, message: Box<Delivery>, ) -> Result<(), Error>
Called when a subscribed result is received.
If an Error is returned, the message is acknowledged accordingly.
Sourcefn on_message_returned(
&mut self,
endpoint: &EndpointHandle,
routing_key: String,
)
fn on_message_returned( &mut self, endpoint: &EndpointHandle, routing_key: String, )
Called when a message sent with the mandatory flag true is unroutable.
Sourcefn on_clock_ticked(&mut self, endpoint: &EndpointHandle, time: u64)
fn on_clock_ticked(&mut self, endpoint: &EndpointHandle, time: u64)
This method is called every second with the time elapsed seconds since the endpoint was started.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".