[−][src]Struct sqsquatch::SubFut
Create futures that will intract with an SQS queue in a subscribe manner
Methods
impl SubFut
[src]
pub fn initialize<T>(region: Region, queue_name: T) -> Result<Self> where
T: Into<String>,
[src]
T: Into<String>,
Initialize SubFut
The following sources are checked in order for AWS credentials when calling initialize
:
- Environment variables:
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
credential_process
command in the AWS config file, usually located at~/.aws/config
.- AWS credentials file. Usually located at
~/.aws/credentials
. - IAM instance profile. Will only work if running on an EC2 instance with an instance profile/role.
If the sources are exhausted without finding credentials, an error is returned.
See the documentation for DefaultCredentialsProvider
and ChainProvider
for more information.
Example
let subscriber = SubFut::initialize(Region::UsEast2, "Orders")?;
pub fn receive_message_fut(
&mut self,
message_attribute_names: Option<Vec<String>>,
visibility_timeout: Option<i64>,
wait_time_seconds: Option<i64>
) -> impl Future<Item = ReceiveMessageResult, Error = Error>
[src]
&mut self,
message_attribute_names: Option<Vec<String>>,
visibility_timeout: Option<i64>,
wait_time_seconds: Option<i64>
) -> impl Future<Item = ReceiveMessageResult, Error = Error>
Create a future that will receive a message from the queue.
visibility_timeout
- the duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by areceive_message
request.wait_time_seconds
- The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner thanwait_time_seconds
. If no messages are available and the wait time expires, the call returns successfully with an empty list of messages.
Example
// subscriber initialized as above.. let result = subscriber.receive_message_fut(None, Some(30), Some(20)).compat().await?; assert!(result.messages.is_some()); if let Some(messages) = result.messages { assert_eq!(messages.len(), 1); assert!(messages[0].receipt_handle.is_some()); if let Some(receipt_handle) = &messages[0].receipt_handle { assert_eq!(receipt_handle, "MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljTM8tJJg6HRG6PYSasuWXPJB+CwLj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGYWbnLmpRCJVAyeMjeU5ZBdtcQ+QEauMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/KSbkJ0="); } }
pub fn delete_message_fut(
&mut self,
receipt_handle: String
) -> impl Future<Item = (), Error = Error>
[src]
&mut self,
receipt_handle: String
) -> impl Future<Item = (), Error = Error>
Delete a message from the queue.
receipt_handle
- The receipt handle associated with the message to delete. NOTE this is not the message id. It's a unique identifier on a per-receive request.
Example
// subscriber initialized as above.. let _ = subscriber.delete_message_fut("a receipt_handle".to_string()).compat().await?;
Trait Implementations
Auto Trait Implementations
impl Send for SubFut
impl Sync for SubFut
impl Unpin for SubFut
impl !UnwindSafe for SubFut
impl !RefUnwindSafe for SubFut
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self