ServiceBusCommand

Enum ServiceBusCommand 

Source
pub enum ServiceBusCommand {
Show 21 variants SwitchQueue { queue_name: String, queue_type: QueueType, }, GetCurrentQueue, GetQueueStatistics { queue_name: String, queue_type: QueueType, }, PeekMessages { max_count: u32, from_sequence: Option<i64>, }, ReceiveMessages { max_count: u32, }, CompleteMessage { message_id: String, }, AbandonMessage { message_id: String, }, DeadLetterMessage { message_id: String, reason: Option<String>, error_description: Option<String>, }, BulkComplete { message_ids: Vec<MessageIdentifier>, }, BulkDelete { message_ids: Vec<MessageIdentifier>, max_position: usize, }, BulkAbandon { message_ids: Vec<MessageIdentifier>, }, BulkDeadLetter { message_ids: Vec<MessageIdentifier>, reason: Option<String>, error_description: Option<String>, }, BulkSend { message_ids: Vec<MessageIdentifier>, target_queue: String, should_delete_source: bool, repeat_count: usize, max_position: usize, }, BulkSendPeeked { messages_data: Vec<(MessageIdentifier, Vec<u8>)>, target_queue: String, repeat_count: usize, }, SendMessage { queue_name: String, message: MessageData, }, SendMessages { queue_name: String, messages: Vec<MessageData>, }, GetConnectionStatus, GetQueueStats { queue_name: String, }, DisposeConsumer, DisposeAllResources, ResetConnection,
}
Expand description

Commands for Service Bus operations using the command pattern.

This enum defines all possible operations that can be performed through the [ServiceBusManager]. Each command encapsulates the parameters needed for a specific operation, providing a clean separation between the command definition and its execution.

§Command Categories

  • Queue Management - Switch queues, get statistics, and manage connections
  • Message Retrieval - Peek and receive messages from queues
  • Individual Message Operations - Complete, abandon, or dead letter single messages
  • Bulk Operations - Efficient bulk processing of multiple messages
  • Send Operations - Send single or multiple messages to queues
  • Status Operations - Check connection health and queue statistics
  • Resource Management - Clean up consumers and reset connections

§Examples

use quetty_server::service_bus_manager::{ServiceBusCommand, QueueType};

// Switch to a queue
let command = ServiceBusCommand::SwitchQueue {
    queue_name: "my-queue".to_string(),
    queue_type: QueueType::Queue,
};

// Peek messages
let command = ServiceBusCommand::PeekMessages {
    max_count: 10,
    from_sequence: None,
};

// Send a message
let command = ServiceBusCommand::SendMessage {
    queue_name: "target-queue".to_string(),
    message: message_data,
};

Variants§

§

SwitchQueue

Switch to a different queue for message operations.

Changes the active queue context for subsequent operations.

Fields

§queue_name: String

Name of the queue to switch to

§queue_type: QueueType

Type of queue (Queue or Topic)

§

GetCurrentQueue

Get information about the currently active queue.

§

GetQueueStatistics

Retrieve detailed statistics for a specific queue.

Returns message counts, size information, and other queue metrics.

Fields

§queue_name: String

Name of the queue to get statistics for

§queue_type: QueueType

Type of queue (Queue or Topic)

§

PeekMessages

Peek at messages without removing them from the queue.

Messages remain in the queue and can be retrieved again.

Fields

§max_count: u32

Maximum number of messages to peek

§from_sequence: Option<i64>

Optional sequence number to start peeking from

§

ReceiveMessages

Receive messages with a lock for processing.

Messages are locked during processing and must be completed or abandoned.

Fields

§max_count: u32

Maximum number of messages to receive

§

CompleteMessage

Complete (acknowledge) a message, removing it from the queue.

Fields

§message_id: String

ID of the message to complete

§

AbandonMessage

Abandon a message, returning it to the queue for redelivery.

Fields

§message_id: String

ID of the message to abandon

§

DeadLetterMessage

Move a message to the dead letter queue.

Used for messages that cannot be processed successfully.

Fields

§message_id: String

ID of the message to dead letter

§reason: Option<String>

Optional reason for dead lettering

§error_description: Option<String>

Optional detailed error description

§

BulkComplete

Complete multiple messages in a single bulk operation.

Fields

§message_ids: Vec<MessageIdentifier>

List of message identifiers to complete

§

BulkDelete

Delete multiple messages efficiently using bulk processing.

Optimized for large-scale message deletion operations.

Fields

§message_ids: Vec<MessageIdentifier>

List of message identifiers to delete

§max_position: usize

Maximum position to scan when looking for messages

§

BulkAbandon

Abandon multiple messages in a single bulk operation.

Fields

§message_ids: Vec<MessageIdentifier>

List of message identifiers to abandon

§

BulkDeadLetter

Move multiple messages to the dead letter queue.

Fields

§message_ids: Vec<MessageIdentifier>

List of message identifiers to dead letter

§reason: Option<String>

Optional reason for dead lettering

§error_description: Option<String>

Optional detailed error description

§

BulkSend

Send multiple messages to a target queue with optional source deletion.

Can optionally delete source messages after successful send.

Fields

§message_ids: Vec<MessageIdentifier>

List of message identifiers to send

§target_queue: String

Name of the target queue to send messages to

§should_delete_source: bool

Whether to delete source messages after sending

§repeat_count: usize

Number of times to repeat each message

§max_position: usize

Maximum position to scan when retrieving messages

§

BulkSendPeeked

Send pre-fetched message data to a target queue.

Used when message content has already been retrieved via peek operations.

Fields

§messages_data: Vec<(MessageIdentifier, Vec<u8>)>

Pre-fetched message data (identifier and content)

§target_queue: String

Name of the target queue to send messages to

§repeat_count: usize

Number of times to repeat each message

§

SendMessage

Send a single message to a specific queue.

Fields

§queue_name: String

Name of the target queue

§message: MessageData

Message data to send

§

SendMessages

Send multiple messages to a specific queue.

Fields

§queue_name: String

Name of the target queue

§messages: Vec<MessageData>

List of messages to send

§

GetConnectionStatus

Check the current connection status to Service Bus.

§

GetQueueStats

Get basic statistics for a specific queue.

Fields

§queue_name: String

Name of the queue to get stats for

§

DisposeConsumer

Dispose of the current message consumer.

Cleans up consumer resources and releases locks.

§

DisposeAllResources

Dispose of all Service Bus resources.

Comprehensive cleanup of all consumers, producers, and connections.

§

ResetConnection

Reset the Service Bus connection.

Re-establishes connection using current configuration.

Trait Implementations§

Source§

impl Clone for ServiceBusCommand

Source§

fn clone(&self) -> ServiceBusCommand

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServiceBusCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> SendBound for T
where T: Send,