Documentation ¶
Index ¶
- Constants
- Variables
- type PubsubClient
- func (c *PubsubClient) CreateQueue(queueName string, opts map[string]*string) (*Queue, error)
- func (c *PubsubClient) CreateQueueContext(ctx context.Context, queueName string, opts map[string]*string) (*Queue, error)
- func (c *PubsubClient) CreateQueueWithDLQ(queueName string, dlq Queue, maxReceive int64, opts map[string]*string) (*Queue, error)
- func (c *PubsubClient) CreateSubscription(topic *Topic, queue *Queue, opts map[string]*string) (*Subscription, error)
- func (c *PubsubClient) CreateSubscriptionContext(ctx context.Context, topic *Topic, queue *Queue, opts map[string]*string) (*Subscription, error)
- func (c *PubsubClient) CreateTopic(topicName string, opts map[string]*string) (*Topic, error)
- func (c *PubsubClient) CreateTopicContext(ctx context.Context, topicName string, opts map[string]*string) (*Topic, error)
- func (c *PubsubClient) NewQueue(queueArn string) (*Queue, error)
- func (c *PubsubClient) NewQueueContext(ctx context.Context, queueArn string) (*Queue, error)
- func (c *PubsubClient) NewSubscription(subscriptionArn string) (*Subscription, error)
- func (c *PubsubClient) NewSubscriptionContext(ctx context.Context, subscriptionArn string) (*Subscription, error)
- func (c *PubsubClient) NewTopic(topicArn string) (*Topic, error)
- func (c *PubsubClient) NewTopicContext(ctx context.Context, topicArn string) (*Topic, error)
- type Queue
- func (q *Queue) Consume(ctx context.Context, ...) error
- func (q *Queue) ConsumeViaS3(ctx context.Context, ...) error
- func (q *Queue) ConsumeViaSNS(ctx context.Context, ...) error
- func (q *Queue) Exist(ctx context.Context) (bool, error)
- func (q *Queue) Send(ctx context.Context, message string, ...) error
- type S3Event
- type SNSEvent
- type Subscription
- type Topic
Constants ¶
const ( NameQueueArn = "QueueArn" NameTopicArn = "TopicArn" QueueAttributeRedrivePolicy = "RedrivePolicy" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type PubsubClient ¶
type PubsubClient struct { SQS *sqs.Client SNS *sns.Client Config sqsConfig OpsTimeout time.Duration }
PubsubClient provides the API clients to make operations call for Amazon Simple Queue Service and Amazon Simple Notification Service
func NewPubsubClient ¶
NewPubsubClient returns a new client from the provided clients and config.
func (*PubsubClient) CreateQueue ¶
CreateQueue calls the CreateQueueContext method.
func (*PubsubClient) CreateQueueContext ¶
func (c *PubsubClient) CreateQueueContext(ctx context.Context, queueName string, opts map[string]*string) (*Queue, error)
CreateQueueContext returns an initialized queue client based on the queue name and options.
func (*PubsubClient) CreateQueueWithDLQ ¶
func (*PubsubClient) CreateSubscription ¶
func (c *PubsubClient) CreateSubscription(topic *Topic, queue *Queue, opts map[string]*string) (*Subscription, error)
CreateSubscription calls the CreateSubscriptionContext method.
func (*PubsubClient) CreateSubscriptionContext ¶
func (c *PubsubClient) CreateSubscriptionContext(ctx context.Context, topic *Topic, queue *Queue, opts map[string]*string) (*Subscription, error)
CreateSubscriptionContext returns an initialized subscription client based on the topic, queue and options.
func (*PubsubClient) CreateTopic ¶
CreateTopic calls the CreateTopicContext method.
func (*PubsubClient) CreateTopicContext ¶
func (c *PubsubClient) CreateTopicContext(ctx context.Context, topicName string, opts map[string]*string) (*Topic, error)
CreateTopicContext returns an initialized topic client based on the topic name and options.
func (*PubsubClient) NewQueue ¶
func (c *PubsubClient) NewQueue(queueArn string) (*Queue, error)
NewQueue calls the NewQueueContext method.
func (*PubsubClient) NewQueueContext ¶
NewQueueContext returns an initialized queue client based on the queue arn.
func (*PubsubClient) NewSubscription ¶
func (c *PubsubClient) NewSubscription(subscriptionArn string) (*Subscription, error)
NewSubscription calls the NewSubscriptionContext method.
func (*PubsubClient) NewSubscriptionContext ¶
func (c *PubsubClient) NewSubscriptionContext(ctx context.Context, subscriptionArn string) (*Subscription, error)
NewSubscriptionContext returns an initialized subscription client based on the subscription arn.
func (*PubsubClient) NewTopic ¶
func (c *PubsubClient) NewTopic(topicArn string) (*Topic, error)
NewQueue calls the NewTopicContext method.
func (*PubsubClient) NewTopicContext ¶
NewTopicContext returns an initialized topic client based on the topic arn.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue provides a PubsubClient for a specific queue.
func (*Queue) Consume ¶
func (q *Queue) Consume(ctx context.Context, handler func(c context.Context, message string) (bool, error)) error
Consume calls the consume method.
func (*Queue) ConsumeViaS3 ¶
func (q *Queue) ConsumeViaS3(ctx context.Context, handler func(c context.Context, event S3Event) (retryable bool, err error)) error
ConsumeViaS3 maps the message to an S3Event struct and calls the consume method.
func (*Queue) ConsumeViaSNS ¶
func (q *Queue) ConsumeViaSNS(ctx context.Context, handler func(c context.Context, event SNSEvent) (retryable bool, err error)) error
ConsumeViaSNS maps the message to an SNSEvent struct and calls the consume method.
type S3Event ¶
type S3Event struct { Records []struct { AwsRegion string `json:"awsRegion"` EventName string `json:"eventName"` EventTime string `json:"eventTime"` EventSource string `json:"eventSource"` EventVersion string `json:"eventVersion"` UserIdentity map[string]string `json:"userIdentity"` RequestParameters map[string]interface{} `json:"requestParameters"` ResponseElements map[string]interface{} `json:"responseElements"` S3 struct { S3SchemaVersion string `json:"s3SchemaVersion"` ConfigurationId string `json:"configurationId"` Bucket struct { Name string `json:"name"` OwnerIdentity map[string]interface{} `json:"ownerIdentity"` ARN string `json:"arn"` } `json:"bucket"` Object struct { Key string `json:"key"` Size int64 `json:"size"` ETag string `json:"etag"` Sequencer string `json:"sequencer"` } `json:"object"` } `json:"s3"` } }
S3Event is the struct to map when sending messages to the queue via s3.
type SNSEvent ¶
type SNSEvent struct { Type string MessageId string Message string Token string TopicArn string SubscribeURL *string Timestamp string Signature string SignatureVersion string SigningCertURL string MessageAttributes map[string]map[string]string }
SNSEvent is the struct to map when sending messages to the queue via topic.
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription provides a PubsubClient for a specific subscription.