[−][src]Struct sqsquatch::Pub
Publish a message to an SQS queue
Methods
impl Pub
[src]
pub fn initialize<T>(region: Region, queue_name: T) -> Result<Self> where
T: Into<String>,
[src]
T: Into<String>,
Initialize Pub
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 publisher = Pub::initialize(Region::UsEast2, "Orders")?;
pub fn publish<M>(
&mut self,
message: M,
attributes: Option<HashMap<String, String>>
) -> Result<Uuid> where
M: Serialize,
[src]
&mut self,
message: M,
attributes: Option<HashMap<String, String>>
) -> Result<Uuid> where
M: Serialize,
Publish a message onto the queue
Important
-
The maximum message size is 256KB. This size includes any attributes you send along as well.
-
A message can include only XML, JSON, and unformatted text. Any characters not included in the following list will be rejected. For more information, see the W3C specification for characters. The following Unicode characters are allowed:
#x9 | #xA | #xD | #x20 to #xD7FF | #xE000 to #xFFFD | #x10000 to #x10FFFF
Example
// publisher initialized as above.. let result = publisher.publish("test_message", None)?; assert_eq!(result, Uuid::parse_str("5fea7756-0ea4-451a-a703-a558b933e274")?);
Trait Implementations
Auto Trait Implementations
impl !Send for Pub
impl !Sync for Pub
impl Unpin for Pub
impl !UnwindSafe for Pub
impl !RefUnwindSafe for Pub
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, 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