README ¶
AWS Broker implementation
This uses SNS and SQS to produce a pub/sub broker implementation. To use this broker, you must provide AWS credentials. All queue permissions management is handled by the credentials, and all AWS-related errors are forwarded to the consumer.
Topic/Queue naming convention
All SNS topics are prefixed with pubsub__
.
All SQS queues are prefixed with pubsub__<topic>_
The SNS topics and SQS queues are created on-demand whenever the topic is first published or subscribed to.
Two subscribers to the same topic with the same subscriptionID will share messages from the same message queue.
Required AWS Permissions
SNS
- CreateTopic
- Subscribe
- Unsubscribe
- Publish
- GetSubscriptionAttributes
- SetSubscriptionAttributes
SQS
- GetQueueUrl
- CreateQueue
- GetQueueAttributes
- SetQueueAttributes
- ReceiveMessage
- DeleteMessage
Documentation ¶
Index ¶
- Variables
- func NewPublisher(sess *session.Session, topic string, opts ...PublisherOption) (pubsub.Publisher, error)
- func NewSubscriber(sess *session.Session, topic, subscriptionID string, opts ...SubscriberOption) (pubsub.Subscriber, error)
- func VerifyPermissions(sess *session.Session, log *logrus.Logger) error
- type PublisherOption
- type SubscriberOption
Constants ¶
This section is empty.
Variables ¶
var ErrAckDeadlineOutOfRange = errors.New("The visibility timeout value is out of range. Values can be 0 to 43200 seconds")
ErrAckDeadlineOutOfRange is returned whenever an invalid duration is passed to ExtendAckDeadline
var ErrMessageRetentionPeriodOutOfRange = errors.New("The message retention period value is out of range. Values can be 60 to 1209600 seconds")
ErrMessageRetentionPeriodOutOfRange is returned whenever an invalid duration is passed to changeMessageRetentionPeriod
var ErrVisibilityTimeoutOutOfRange = errors.New("The visibility timeout value is out of range. Values can be 0 to 43200 seconds")
ErrVisibilityTimeoutOutOfRange is returned whenever an invalid duration is passed to changeVisibilityTimeout
Functions ¶
func NewPublisher ¶
func NewPublisher(sess *session.Session, topic string, opts ...PublisherOption) (pubsub.Publisher, error)
NewPublisher creates a new AWS message broker that will publish messages to the given topic. TODO: info on permissions needed within the config to make this work
Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 247 characters long.
func NewSubscriber ¶
func NewSubscriber(sess *session.Session, topic, subscriptionID string, opts ...SubscriberOption) (pubsub.Subscriber, error)
NewSubscriber creates an AWS message broker that will subscribe to the given topic with at-least-once message delivery semantics for the given subscriptionID TODO: info on permissions needed within the config to make this work
Types ¶
type PublisherOption ¶ added in v0.4.0
type PublisherOption func(*publisher)
func PublishWithLogger ¶ added in v0.4.0
func PublishWithLogger(logger *logrus.Logger) PublisherOption
type SubscriberOption ¶ added in v0.4.0
type SubscriberOption func(*awsSubscriber)
func SubscribeWithLogger ¶ added in v0.4.0
func SubscribeWithLogger(logger *logrus.Logger) SubscriberOption