pub struct SqsService {
client: Client,
}
Expand description
SQS service for interacting with AWS SQS
This service provides a high-level interface for SQS operations with dependency injection for better performance and testability.
Fields§
§client: Client
Implementations§
Source§impl SqsService
impl SqsService
Sourcepub fn with_client(client: Client) -> Self
pub fn with_client(client: Client) -> Self
Sourcepub fn with_config(config: &SdkConfig) -> Self
pub fn with_config(config: &SdkConfig) -> Self
Sourcepub async fn get_queue(&self, name: &str) -> Result<String>
pub async fn get_queue(&self, name: &str) -> Result<String>
Get an SQS queue URL
§Arguments
name
- The name of the queue to get
§Returns
Returns the queue URL as a String
§Errors
SqsError::Service
- If the SQS client fails to create.SqsError::Timeout
- If the request times out.SqsError::Transport
- If the request fails to dispatch.SqsError::Build
- If the request fails to build.SqsError::InvalidResponse
- If the queue URL is not found.
Sourcepub async fn send_message(
&self,
queue_url: &str,
body: &str,
delay_seconds: Option<i32>,
) -> Result<String>
pub async fn send_message( &self, queue_url: &str, body: &str, delay_seconds: Option<i32>, ) -> Result<String>
Send an SQS message
§Arguments
queue_url
- The URL of the queue to sendbody
- The message to senddelay_seconds
- The delay in seconds before the message is sent
§Returns
Returns the message ID as a String
§Errors
SqsError::Service
- If the SQS client fails to create.SqsError::Timeout
- If the request times out.SqsError::Transport
- If the request fails to dispatch.SqsError::Build
- If the request fails to build.SqsError::InvalidResponse
- If the message ID is not found.
Auto Trait Implementations§
impl Freeze for SqsService
impl !RefUnwindSafe for SqsService
impl Send for SqsService
impl Sync for SqsService
impl Unpin for SqsService
impl !UnwindSafe for SqsService
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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.