[][src]Struct sqsquatch::Pub

pub struct Pub { /* fields omitted */ }

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]

Initialize Pub

The following sources are checked in order for AWS credentials when calling initialize:

  1. Environment variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  2. credential_process command in the AWS config file, usually located at ~/.aws/config.
  3. AWS credentials file. Usually located at ~/.aws/credentials.
  4. 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]

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

impl Debug for Pub[src]

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]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self