pub struct SqsResource {
pub endpoint_url: String,
pub region: String,
pub queue_name: String,
pub queue_url: String,
/* private fields */
}Expand description
SQS resource manager
Fields§
§endpoint_url: StringSQS-compatible endpoint URL (e.g. ElasticMQ)
region: StringAWS region (default: us-east-1)
queue_name: StringName of the isolated SQS queue
queue_url: StringURL of the created SQS queue
Implementations§
Source§impl SqsResource
impl SqsResource
Sourcepub async fn new(endpoint_url: &str, queue_name: &str) -> Result<Self>
pub async fn new(endpoint_url: &str, queue_name: &str) -> Result<Self>
Create a new SQS resource with an isolated queue
Sourcepub async fn send_message(&self, body: &str) -> Result<()>
pub async fn send_message(&self, body: &str) -> Result<()>
Send a single message to the queue
Sourcepub async fn receive_messages(&self, max_messages: i32) -> Result<Vec<String>>
pub async fn receive_messages(&self, max_messages: i32) -> Result<Vec<String>>
Receive messages from the queue
Returns a list of message bodies. Uses long polling with a wait time of up to 5 seconds.
Sourcepub async fn receive_all_messages(
&self,
max_messages: usize,
max_wait: Duration,
) -> Result<Vec<String>>
pub async fn receive_all_messages( &self, max_messages: usize, max_wait: Duration, ) -> Result<Vec<String>>
Receive all available messages from the queue, polling until no more messages arrive.
This is useful for verification in e2e tests where we want to read all messages that have been written to the queue.
Sourcepub async fn get_message_count(&self) -> Result<i64>
pub async fn get_message_count(&self) -> Result<i64>
Get the approximate number of messages in the queue
Trait Implementations§
Source§impl Drop for SqsResource
impl Drop for SqsResource
Auto Trait Implementations§
impl !RefUnwindSafe for SqsResource
impl !UnwindSafe for SqsResource
impl Freeze for SqsResource
impl Send for SqsResource
impl Sync for SqsResource
impl Unpin for SqsResource
impl UnsafeUnpin for SqsResource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.