pub trait ConnectionServices:
Debug
+ Send
+ Sync {
// Required methods
fn publish(
&self,
channel: &str,
envelope: &MessageEnvelope,
idempotency_key: Option<&str>,
) -> Result<PublishOutcome, ServerError>;
fn subscribe(
&self,
channel: &str,
accepted_schemas: &[ProtocolSchemaId],
) -> Result<ConnectionSubscription, ServerError>;
fn unsubscribe(
&self,
subscription: ConnectionSubscription,
) -> Result<(), ServerError>;
fn open_conversation(
&self,
conversation_id: u64,
subject: &str,
) -> Result<ConnectionConversation, ServerError>;
fn conversation_message(
&self,
conversation: &ConnectionConversation,
envelope: &MessageEnvelope,
) -> Result<(), ServerError>;
fn close_conversation(
&self,
conversation: ConnectionConversation,
) -> Result<(), ServerError>;
fn flush_durable_state(&self) -> Result<(), ServerError>;
}Expand description
Operations that adapt wire frames to liminal library calls.
Required Methods§
Sourcefn publish(
&self,
channel: &str,
envelope: &MessageEnvelope,
idempotency_key: Option<&str>,
) -> Result<PublishOutcome, ServerError>
fn publish( &self, channel: &str, envelope: &MessageEnvelope, idempotency_key: Option<&str>, ) -> Result<PublishOutcome, ServerError>
Delegates a publish request to the liminal library.
idempotency_key, when Some, drives dedup-on-delivery: a re-publish with
the same key is delivered to subscribers at most once. The returned
PublishOutcome carries the genuine delivery ack.
§Errors
Returns ServerError when the liminal publish operation fails.
Sourcefn subscribe(
&self,
channel: &str,
accepted_schemas: &[ProtocolSchemaId],
) -> Result<ConnectionSubscription, ServerError>
fn subscribe( &self, channel: &str, accepted_schemas: &[ProtocolSchemaId], ) -> Result<ConnectionSubscription, ServerError>
Delegates a subscribe request to the liminal library.
§Errors
Returns ServerError when the liminal subscribe operation fails.
Sourcefn unsubscribe(
&self,
subscription: ConnectionSubscription,
) -> Result<(), ServerError>
fn unsubscribe( &self, subscription: ConnectionSubscription, ) -> Result<(), ServerError>
Delegates unsubscribe to the liminal library.
§Errors
Returns ServerError when the liminal unsubscribe operation fails.
Sourcefn open_conversation(
&self,
conversation_id: u64,
subject: &str,
) -> Result<ConnectionConversation, ServerError>
fn open_conversation( &self, conversation_id: u64, subject: &str, ) -> Result<ConnectionConversation, ServerError>
Delegates conversation open to the liminal library.
§Errors
Returns ServerError when the liminal conversation open operation fails.
Sourcefn conversation_message(
&self,
conversation: &ConnectionConversation,
envelope: &MessageEnvelope,
) -> Result<(), ServerError>
fn conversation_message( &self, conversation: &ConnectionConversation, envelope: &MessageEnvelope, ) -> Result<(), ServerError>
Delegates a conversation message to the liminal library.
§Errors
Returns ServerError when the liminal conversation message operation fails.
Sourcefn close_conversation(
&self,
conversation: ConnectionConversation,
) -> Result<(), ServerError>
fn close_conversation( &self, conversation: ConnectionConversation, ) -> Result<(), ServerError>
Delegates conversation close to the liminal library.
§Errors
Returns ServerError when the liminal conversation close operation fails.
Sourcefn flush_durable_state(&self) -> Result<(), ServerError>
fn flush_durable_state(&self) -> Result<(), ServerError>
Flushes durable channel state through the liminal library boundary.
§Errors
Returns ServerError when the liminal channel flush operation fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".