Trait RsmqConnection

Source
pub trait RsmqConnection {
    // Required methods
    fn change_message_visibility(
        &mut self,
        qname: &str,
        message_id: &str,
        hidden: Duration,
    ) -> impl Future<Output = RsmqResult<()>> + Send;
    fn create_queue(
        &mut self,
        qname: &str,
        hidden: Option<Duration>,
        delay: Option<Duration>,
        maxsize: Option<i32>,
    ) -> impl Future<Output = RsmqResult<()>> + Send;
    fn delete_message(
        &mut self,
        qname: &str,
        id: &str,
    ) -> impl Future<Output = RsmqResult<bool>> + Send;
    fn delete_queue(
        &mut self,
        qname: &str,
    ) -> impl Future<Output = RsmqResult<()>> + Send;
    fn get_queue_attributes(
        &mut self,
        qname: &str,
    ) -> impl Future<Output = RsmqResult<RsmqQueueAttributes>> + Send;
    fn list_queues(
        &mut self,
    ) -> impl Future<Output = RsmqResult<Vec<String>>> + Send;
    fn pop_message<E: TryFrom<RedisBytes, Error = Vec<u8>>>(
        &mut self,
        qname: &str,
    ) -> impl Future<Output = RsmqResult<Option<RsmqMessage<E>>>> + Send;
    fn receive_message<E: TryFrom<RedisBytes, Error = Vec<u8>>>(
        &mut self,
        qname: &str,
        hidden: Option<Duration>,
    ) -> impl Future<Output = RsmqResult<Option<RsmqMessage<E>>>> + Send;
    fn send_message<E: Into<RedisBytes> + Send>(
        &mut self,
        qname: &str,
        message: E,
        delay: Option<Duration>,
    ) -> impl Future<Output = RsmqResult<String>> + Send;
    fn set_queue_attributes(
        &mut self,
        qname: &str,
        hidden: Option<Duration>,
        delay: Option<Duration>,
        maxsize: Option<i64>,
    ) -> impl Future<Output = RsmqResult<RsmqQueueAttributes>> + Send;
}

Required Methods§

Source

fn change_message_visibility( &mut self, qname: &str, message_id: &str, hidden: Duration, ) -> impl Future<Output = RsmqResult<()>> + Send

Change the hidden time of a already sent message.

hidden has a max time of 9_999_999 for compatibility reasons to this library JS version counterpart

Source

fn create_queue( &mut self, qname: &str, hidden: Option<Duration>, delay: Option<Duration>, maxsize: Option<i32>, ) -> impl Future<Output = RsmqResult<()>> + Send

Creates a new queue. Attributes can be later modified with “set_queue_attributes” method

hidden: Time the messages will be hidden when they are received with the “receive_message” method. It has a max time of 9_999_999 for compatibility reasons to this library JS version counterpart

delay: Time the messages will be delayed before being delivered

maxsize: Maximum size in bytes of each message in the queue. Needs to be between 1024 or 65536 or -1 (unlimited size)

Source

fn delete_message( &mut self, qname: &str, id: &str, ) -> impl Future<Output = RsmqResult<bool>> + Send

Deletes a message from the queue.

Important to use when you are using receive_message.

Source

fn delete_queue( &mut self, qname: &str, ) -> impl Future<Output = RsmqResult<()>> + Send

Deletes the queue and all the messages on it

Source

fn get_queue_attributes( &mut self, qname: &str, ) -> impl Future<Output = RsmqResult<RsmqQueueAttributes>> + Send

Returns the queue attributes and statistics

Source

fn list_queues( &mut self, ) -> impl Future<Output = RsmqResult<Vec<String>>> + Send

Returns a list of queues in the namespace

Source

fn pop_message<E: TryFrom<RedisBytes, Error = Vec<u8>>>( &mut self, qname: &str, ) -> impl Future<Output = RsmqResult<Option<RsmqMessage<E>>>> + Send

Deletes and returns a message. Be aware that using this you may end with deleted & unprocessed messages.

Source

fn receive_message<E: TryFrom<RedisBytes, Error = Vec<u8>>>( &mut self, qname: &str, hidden: Option<Duration>, ) -> impl Future<Output = RsmqResult<Option<RsmqMessage<E>>>> + Send

Returns a message. The message stays hidden for some time (defined by “hidden” argument or the queue settings). After that time, the message will be redelivered. In order to avoid the redelivery, you need to use the “delete_message” after this function.

hidden has a max time of 9_999_999 for compatibility reasons to this library JS version counterpart.

Source

fn send_message<E: Into<RedisBytes> + Send>( &mut self, qname: &str, message: E, delay: Option<Duration>, ) -> impl Future<Output = RsmqResult<String>> + Send

Sends a message to the queue. The message will be delayed some time (controlled by the “delayed” argument or the queue settings) before being delivered to a client.

Source

fn set_queue_attributes( &mut self, qname: &str, hidden: Option<Duration>, delay: Option<Duration>, maxsize: Option<i64>, ) -> impl Future<Output = RsmqResult<RsmqQueueAttributes>> + Send

Modify the queue attributes. Keep in mind that “hidden” and “delay” can be overwritten when the message is sent. “hidden” can be changed by the method “change_message_visibility”

hidden: Time the messages will be hidden when they are received with the “receive_message” method. It has a max time of 9_999_999 for compatibility reasons to this library JS version counterpart

delay: Time the messages will be delayed before being delivered

maxsize: Maximum size in bytes of each message in the queue. Needs to be between 1024 or 65536 or -1 (unlimited size)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§