gocloud.devgocloud.dev/pubsub/awspubsub Index | Files

package awspubsub

import "gocloud.dev/pubsub/awspubsub"

Package awspubsub provides an implementation of pubsub that uses AWS SNS (Simple Notification Service) and SQS (Simple Queueing Service).

Escaping

Go CDK supports all UTF-8 strings; to make this work with providers lacking full UTF-8 support, strings must be escaped (during writes) and unescaped (during reads). The following escapes are required for awspubsub:

As

awspubsub exposes the following types for As:

Index

Functions

func OpenSubscription

func OpenSubscription(ctx context.Context, client *sqs.SQS, qURL string, opts *SubscriptionOptions) *pubsub.Subscription

OpenSubscription opens a on AWS SQS for the given SQS client and queue URL. The queue is assumed to be subscribed to some SNS topic, though there is no check for this.

func OpenTopic

func OpenTopic(ctx context.Context, client *sns.SNS, topicARN string, opts *TopicOptions) *pubsub.Topic

OpenTopic opens the topic on AWS SNS for the given SNS client and topic ARN.

Types

type BodyBase64Encoding

type BodyBase64Encoding int

BodyBase64Encoding is an enum of strategies for when to base64 message bodies.

const (
	// NonUTF8Only means that message bodies that are valid UTF-8 encodings are
	// sent as-is. Invalid UTF-8 message bodies are base64 encoded, and a
	// MessageAttribute with key "base64encoded" is added to the message.
	// When receiving messages, the "base64encoded" attribute is used to determine
	// whether to base64 decode, and is then filtered out.
	NonUTF8Only BodyBase64Encoding = 0
	// Always means that all message bodies are base64 encoded.
	// A MessageAttribute with key "base64encoded" is added to the message.
	// When receiving messages, the "base64encoded" attribute is used to determine
	// whether to base64 decode, and is then filtered out.
	Always BodyBase64Encoding = 1
	// Never means that message bodies are never base64 encoded. Non-UTF-8
	// bytes in message bodies may be modified by SNS/SQS.
	Never BodyBase64Encoding = 2
)

type SubscriptionOptions

type SubscriptionOptions struct{}

SubscriptionOptions will contain configuration for subscriptions.

type TopicOptions

type TopicOptions struct {
	// BodyBase64Encoding determines when message bodies are base64 encoded.
	// The default is NonUTF8Only.
	BodyBase64Encoding BodyBase64Encoding
}

TopicOptions contains configuration options for topics.

Source Files

awspubsub.go

Version
v0.11.0
Published
Feb 28, 2019
Platform
linux/amd64
Imports
14 packages
Last checked
12 hours ago

Tools for package owners.