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:
- Metadata keys: Characters other than "a-zA-z0-9_-.", and additionally "." when it's at the start of the key or the previous character was ".", are escaped using "__0x<hex>__". These characters were determined by experimentation.
- Metadata values: Escaped using URL encoding.
As
awspubsub exposes the following types for As:
- Topic: *sns.SNS
- Subscription: *sqs.SQS
- Message: *sqs.Message
- Error: awserror.Error
Index ¶
- func OpenSubscription(ctx context.Context, client *sqs.SQS, qURL string, opts *SubscriptionOptions) *pubsub.Subscription
- func OpenTopic(ctx context.Context, client *sns.SNS, topicARN string, opts *TopicOptions) *pubsub.Topic
- type SubscriptionOptions
- type TopicOptions
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 SubscriptionOptions ¶
type SubscriptionOptions struct{}
SubscriptionOptions will contain configuration for subscriptions.
type TopicOptions ¶
type TopicOptions struct{}
TopicOptions will contain configuration for topics.
Source Files ¶
awspubsub.go
- Version
- v0.10.0
- Published
- Feb 12, 2019
- Platform
- js/wasm
- Imports
- 11 packages
- Last checked
- 6 days ago –
Tools for package owners.