snssqs

package module
Version: v2.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

README

SQS SNS Broker Plugin for go-micro

Amazon Simple Notification Service and Simple Queue Service broker plugin for go-micro allows you to publish to SNS and subscribe messages brokered by SQS. This plugin does not (yet) support automatic creation of SQS queues or SNS topics so those will have to exist in your infrastructure before attempting to send/receive.

AWS Credentials

This plugin uses the official Go SDK for AWS. As such, it will obtain AWS credentials the same way all other aws-go-sdk applications do. The plugin explicitly allows the use of the shared credentials file to make development on workstations easier, but you can also supply the usual AWS_* environment variables in dev/test/prod environments. Also if you're deploying in EC2/ECS, the IAM Role will be picked up automatically and you won't need to supply any credentials.

Publishing and Subscribing

Publishing and subscribing with the plugin should work just like all other brokers. Simply supply the name of the queue in the publish or subscribe arguments:

broker.Publish("my_topic", msg)
...
broker.Subscribe("queue", subscriberFunc)

You will need to supply the AWS_REGION environment variable to configure the region (in addition to credentials as above).

Because SNS can't deliver to FIFO queues, you cannot subscribe to a FIFO queue using this broker.

Options

If you're using a regular (non-fifo) queue you should be able to get by without having to supply any special options. However, if you need to specify a group identifier for a message or a de-duplication identifier, then you'll have to specify a generator function for those.

This plugin is under active development and will likely get more configurable options and features in the near future.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientHeaderWhitelistOnPublish added in v2.8.0

func ClientHeaderWhitelistOnPublish(whitelist map[string]struct{}) client.PublishOption

ClientHeaderWhitelist validate headers before sending to sns

func ClientValidateHeaderOnPublish added in v2.8.0

func ClientValidateHeaderOnPublish(validate bool) client.PublishOption

ClientValidateHeaderOnPublish validate headers before sending to sns

func ClientValidateOnPublish added in v2.8.0

func ClientValidateOnPublish(validate bool) client.PublishOption

func HeaderWhitelistOnPublish added in v2.8.0

func HeaderWhitelistOnPublish(whitelist map[string]struct{}) broker.PublishOption

HeaderWhitelist validate headers before sending to sns

func MaxReceiveMessages

func MaxReceiveMessages(max int64) broker.SubscribeOption

MaxReceiveMessages indicates how many messages a receive operation should pull during any single call

func NewBroker

func NewBroker(opts ...broker.Option) broker.Broker

NewBroker creates a new broker with options

func SNSConfig

func SNSConfig(c *aws.Config) broker.Option

SNSConfig add AWS config options to the sns client

func SQSConfig

func SQSConfig(c *aws.Config) broker.Option

SQSConfig add AWS config options to the sqs client

func STSConfig

func STSConfig(c *aws.Config) broker.Option

STSConfig add AWS config options to the sts client

func ValidateBody added in v2.8.0

func ValidateBody(msg *broker.Message) error

ValidateBody Validate message for the lowest requirements of both SNS and SQS

func ValidateHeader added in v2.8.0

func ValidateHeader(msg *broker.Message, whitelist map[string]struct{}) error

func ValidateHeaderOnPublish added in v2.8.0

func ValidateHeaderOnPublish(validate bool) broker.PublishOption

ValidateHeaderOnPublish validate headers before sending to sns

func ValidateOnPublish

func ValidateOnPublish(validate bool) broker.PublishOption

ValidateOnPublish determines whether to pre-validate messages before they're published This has a significant performance impact

func VisibilityTimeout

func VisibilityTimeout(seconds int64) broker.SubscribeOption

VisibilityTimeout controls how long a message is hidden from other queue consumers before being put back. If a consumer does not delete the message, it will be put back even if it was "processed"

func WaitTimeSeconds

func WaitTimeSeconds(seconds int64) broker.SubscribeOption

WaitTimeSeconds controls the length of long polling for available messages

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL