Enum ServiceBusResponse

Source
pub enum ServiceBusResponse {
Show 22 variants QueueSwitched { queue_info: QueueInfo, }, CurrentQueue { queue_info: Option<QueueInfo>, }, QueueStatistics { queue_name: String, queue_type: QueueType, active_message_count: Option<u64>, dead_letter_message_count: Option<u64>, retrieved_at: DateTime<Utc>, }, MessagesReceived { messages: Vec<MessageModel>, }, ReceivedMessages { messages: Vec<ServiceBusReceivedMessage>, }, MessageCompleted { message_id: String, }, MessageAbandoned { message_id: String, }, MessageDeadLettered { message_id: String, }, BulkOperationCompleted { result: BulkOperationResult, }, BulkMessagesCompleted { successful_ids: Vec<MessageIdentifier>, failed_ids: Vec<MessageIdentifier>, stats: OperationStats, }, BulkMessagesAbandoned { successful_ids: Vec<MessageIdentifier>, failed_ids: Vec<MessageIdentifier>, stats: OperationStats, }, BulkMessagesDeadLettered { successful_ids: Vec<MessageIdentifier>, failed_ids: Vec<MessageIdentifier>, stats: OperationStats, }, MessageSent { queue_name: String, }, MessagesSent { queue_name: String, count: usize, stats: OperationStats, }, ConnectionStatus { connected: bool, current_queue: Option<QueueInfo>, last_error: Option<String>, }, QueueStats { queue_name: String, message_count: Option<u64>, active_consumer: bool, }, ConsumerDisposed, AllResourcesDisposed, ResourcesDisposed, ConnectionReset, Success, Error { error: ServiceBusError, },
}
Expand description

Response types for Service Bus operations.

This enum represents all possible responses from [ServiceBusCommand] operations executed through the [ServiceBusManager]. Each response variant corresponds to a specific command type and contains the relevant data or status information.

§Response Categories

  • Queue Management - Information about queue switches, statistics, and current state
  • Message Retrieval - Retrieved messages in various formats
  • Individual Operations - Confirmations for single message operations
  • Bulk Operations - Results from bulk processing with detailed statistics
  • Send Operations - Confirmations and statistics for message sending
  • Status Operations - Connection health and queue status information
  • Resource Management - Confirmations for cleanup operations
  • Generic Results - Success confirmations and error responses

§Examples

use quetty_server::service_bus_manager::{ServiceBusResponse, ServiceBusManager};

match manager.execute_command(command).await {
    ServiceBusResponse::MessagesReceived { messages } => {
        println!("Received {} messages", messages.len());
        for message in messages {
            println!("Message: {}", message.id);
        }
    }
    ServiceBusResponse::QueueSwitched { queue_info } => {
        println!("Switched to queue: {}", queue_info.name);
    }
    ServiceBusResponse::Error { error } => {
        eprintln!("Operation failed: {}", error);
    }
    _ => println!("Operation completed successfully"),
}

Variants§

§

QueueSwitched

Successful queue switch operation.

Returned when a [SwitchQueue] command completes successfully.

Fields

§queue_info: QueueInfo

Information about the newly active queue

§

CurrentQueue

Information about the currently active queue.

Returned by [GetCurrentQueue] command.

Fields

§queue_info: Option<QueueInfo>

Current queue information, or None if no queue is active

§

QueueStatistics

Detailed statistics for a specific queue.

Returned by [GetQueueStatistics] command with comprehensive metrics.

Fields

§queue_name: String

Name of the queue

§queue_type: QueueType

Type of the queue (Queue or Topic)

§active_message_count: Option<u64>

Number of active messages in the queue

§dead_letter_message_count: Option<u64>

Number of messages in the dead letter queue

§retrieved_at: DateTime<Utc>

Timestamp when statistics were retrieved

§

MessagesReceived

Messages retrieved via peek operations.

Contains parsed message models from [PeekMessages] command.

Fields

§messages: Vec<MessageModel>

List of parsed message models

§

ReceivedMessages

Raw messages received with locks for processing.

Contains native Service Bus message objects from [ReceiveMessages] command.

Fields

§messages: Vec<ServiceBusReceivedMessage>

List of raw Service Bus messages with locks

§

MessageCompleted

Confirmation that a message was completed successfully.

Fields

§message_id: String

ID of the completed message

§

MessageAbandoned

Confirmation that a message was abandoned.

Fields

§message_id: String

ID of the abandoned message

§

MessageDeadLettered

Confirmation that a message was moved to dead letter queue.

Fields

§message_id: String

ID of the dead lettered message

§

BulkOperationCompleted

Result of a bulk operation with comprehensive statistics.

Used for complex bulk operations like delete, send, etc.

Fields

§result: BulkOperationResult

Detailed operation results and statistics

§

BulkMessagesCompleted

Result of bulk message completion operation.

Fields

§successful_ids: Vec<MessageIdentifier>

List of successfully completed message identifiers

§failed_ids: Vec<MessageIdentifier>

List of failed message identifiers

§stats: OperationStats

Operation timing and performance statistics

§

BulkMessagesAbandoned

Result of bulk message abandon operation.

Fields

§successful_ids: Vec<MessageIdentifier>

List of successfully abandoned message identifiers

§failed_ids: Vec<MessageIdentifier>

List of failed message identifiers

§stats: OperationStats

Operation timing and performance statistics

§

BulkMessagesDeadLettered

Result of bulk dead letter operation.

Fields

§successful_ids: Vec<MessageIdentifier>

List of successfully dead lettered message identifiers

§failed_ids: Vec<MessageIdentifier>

List of failed message identifiers

§stats: OperationStats

Operation timing and performance statistics

§

MessageSent

Confirmation that a single message was sent successfully.

Fields

§queue_name: String

Name of the target queue where message was sent

§

MessagesSent

Confirmation that multiple messages were sent successfully.

Fields

§queue_name: String

Name of the target queue where messages were sent

§count: usize

Number of messages sent

§stats: OperationStats

Operation timing and performance statistics

§

ConnectionStatus

Current connection status and health information.

Fields

§connected: bool

Whether the connection is currently active

§current_queue: Option<QueueInfo>

Information about the currently active queue

§last_error: Option<String>

Last error message, if any

§

QueueStats

Basic statistics for a specific queue.

Fields

§queue_name: String

Name of the queue

§message_count: Option<u64>

Number of messages in the queue

§active_consumer: bool

Whether there is an active consumer for this queue

§

ConsumerDisposed

Confirmation that the consumer was disposed successfully.

§

AllResourcesDisposed

Confirmation that all resources were disposed successfully.

§

ResourcesDisposed

Confirmation that resources were disposed successfully.

§

ConnectionReset

Confirmation that the connection was reset successfully.

§

Success

Generic success response for operations without specific data.

§

Error

Error response containing detailed error information.

Returned when any operation fails with comprehensive error details.

Fields

§error: ServiceBusError

The specific error that occurred

Trait Implementations§

Source§

impl Debug for ServiceBusResponse

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> 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, 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,