app

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoDefaultElementInJSON = "Invalid parameter: Message Structure - No default entry in JSON message body"
)

Predefined errors

Variables

View Source
var DeduplicationPeriod = 5 * time.Minute
View Source
var SnsErrors map[string]SnsErrorType
View Source
var SqsErrors map[string]SqsErrorType
View Source
var SyncQueues = struct {
	sync.RWMutex
	Queues map[string]*Queue
}{Queues: make(map[string]*Queue)}
View Source
var SyncTopics = struct {
	sync.RWMutex
	Topics map[string]*Topic
}{Topics: make(map[string]*Topic)}

Functions

func HasFIFOQueueName

func HasFIFOQueueName(queueName string) bool

Types

type Attribute

type Attribute struct {
	Name  string `xml:"Name,omitempty"`
	Value string `xml:"Value,omitempty"`
}

** Get Queue Attributes **

type BatchResultErrorEntry

type BatchResultErrorEntry struct {
	Code        string `xml:"Code"`
	Id          string `xml:"Id"`
	Message     string `xml:"Message,omitempty"`
	SenderFault bool   `xml:"SenderFault"`
}

type ChangeMessageVisibilityResult

type ChangeMessageVisibilityResult struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

type ConfirmSubscriptionResponse

type ConfirmSubscriptionResponse struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Result   SubscribeResult  `xml:"ConfirmSubscriptionResult"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

** ConfirmSubscriptionResponse **

type CreateQueueResponse

type CreateQueueResponse struct {
	Xmlns    string            `xml:"xmlns,attr"`
	Result   CreateQueueResult `xml:"CreateQueueResult"`
	Metadata ResponseMetadata  `xml:"ResponseMetadata"`
}

type CreateQueueResult

type CreateQueueResult struct {
	QueueUrl string `xml:"QueueUrl"`
}

** Create Queue Response

type CreateTopicResponse

type CreateTopicResponse struct {
	Xmlns    string            `xml:"xmlns,attr"`
	Result   CreateTopicResult `xml:"CreateTopicResult"`
	Metadata ResponseMetadata  `xml:"ResponseMetadata"`
}

type CreateTopicResult

type CreateTopicResult struct {
	TopicArn string `xml:"TopicArn"`
}

** Create Topic Response

type DeleteMessageBatchResponse

type DeleteMessageBatchResponse struct {
	Xmlns    string                   `xml:"xmlns,attr,omitempty"`
	Result   DeleteMessageBatchResult `xml:"DeleteMessageBatchResult"`
	Metadata ResponseMetadata         `xml:"ResponseMetadata,omitempty"`
}

** Delete Message Batch Response

type DeleteMessageBatchResult

type DeleteMessageBatchResult struct {
	Entry []DeleteMessageBatchResultEntry `xml:"DeleteMessageBatchResultEntry"`
	Error []BatchResultErrorEntry         `xml:"BatchResultErrorEntry,omitempty"`
}

type DeleteMessageBatchResultEntry

type DeleteMessageBatchResultEntry struct {
	Id string `xml:"Id"`
}

type DeleteMessageResponse

type DeleteMessageResponse struct {
	Xmlns    string           `xml:"xmlns,attr,omitempty"`
	Metadata ResponseMetadata `xml:"ResponseMetadata,omitempty"`
}

** Delete Message Response

type DeleteQueueResponse

type DeleteQueueResponse struct {
	Xmlns    string           `xml:"xmlns,attr,omitempty"`
	Metadata ResponseMetadata `xml:"ResponseMetadata,omitempty"`
}

type DeleteTopicResponse

type DeleteTopicResponse struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

** Delete Topic **

type EnvQueue

type EnvQueue struct {
	Name                          string
	ReceiveMessageWaitTimeSeconds int
	RedrivePolicy                 string
	MaximumMessageSize            int
	VisibilityTimeout             int
}

type EnvQueueAttributes

type EnvQueueAttributes struct {
	VisibilityTimeout             int
	ReceiveMessageWaitTimeSeconds int
	MaximumMessageSize            int
}

type EnvSubsciption

type EnvSubsciption struct {
	Protocol     string
	EndPoint     string
	TopicArn     string
	QueueName    string
	Raw          bool
	FilterPolicy string
}

** config **

type EnvTopic

type EnvTopic struct {
	Name          string
	Subscriptions []EnvSubsciption
}

type Environment

type Environment struct {
	Host                   string
	Port                   string
	SqsPort                string
	SnsPort                string
	Region                 string
	AccountID              string
	LogToFile              bool
	LogFile                string
	EnableDuplicates       bool
	Topics                 []EnvTopic
	Queues                 []EnvQueue
	QueueAttributeDefaults EnvQueueAttributes
	RandomLatency          RandomLatency
}
var CurrentEnvironment Environment

type ErrorResponse

type ErrorResponse struct {
	Result    ErrorResult `xml:"Error"`
	RequestId string      `xml:"RequestId"`
}

type ErrorResult

type ErrorResult struct {
	Type    string `xml:"Type,omitempty"`
	Code    string `xml:"Code,omitempty"`
	Message string `xml:"Message,omitempty"`
}

** Error Responses **

type FilterPolicy

type FilterPolicy map[string][]string

only simple "ExactMatch" string policy is supported at the moment

func (*FilterPolicy) IsSatisfiedBy

func (fp *FilterPolicy) IsSatisfiedBy(msgAttrs map[string]MessageAttributeValue) bool

Function checks if MessageAttributes passed to Topic satisfy FilterPolicy set by subscription

type GetQueueAttributesResponse

type GetQueueAttributesResponse struct {
	Xmlns    string                   `xml:"xmlns,attr,omitempty"`
	Result   GetQueueAttributesResult `xml:"GetQueueAttributesResult"`
	Metadata ResponseMetadata         `xml:"ResponseMetadata,omitempty"`
}

type GetQueueAttributesResult

type GetQueueAttributesResult struct {
	/* VisibilityTimeout, DelaySeconds, ReceiveMessageWaitTimeSeconds, ApproximateNumberOfMessages
	   ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, LastModifiedTimestamp, QueueArn */
	Attrs []Attribute `xml:"Attribute,omitempty"`
}

type GetQueueUrlResponse

type GetQueueUrlResponse struct {
	Xmlns    string            `xml:"xmlns,attr,omitempty"`
	Result   GetQueueUrlResult `xml:"GetQueueUrlResult"`
	Metadata ResponseMetadata  `xml:"ResponseMetadata,omitempty"`
}

type GetQueueUrlResult

type GetQueueUrlResult struct {
	QueueUrl string `xml:"QueueUrl,omitempty"`
}

** Get Queue Url Response

type GetSubscriptionAttributesResponse

type GetSubscriptionAttributesResponse struct {
	Xmlns    string                          `xml:"xmlns,attr,omitempty"`
	Result   GetSubscriptionAttributesResult `xml:"GetSubscriptionAttributesResult"`
	Metadata ResponseMetadata                `xml:"ResponseMetadata,omitempty"`
}

type GetSubscriptionAttributesResult

type GetSubscriptionAttributesResult struct {
	SubscriptionAttributes SubscriptionAttributes `xml:"Attributes,omitempty"`
}

** Get Subscription Attributes **

type ListQueuesResponse

type ListQueuesResponse struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Result   ListQueuesResult `xml:"ListQueuesResult"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

type ListQueuesResult

type ListQueuesResult struct {
	QueueUrl []string `xml:"QueueUrl"`
}

** List Queues Response

type ListSubscriptionsByTopicResponse

type ListSubscriptionsByTopicResponse struct {
	Xmlns    string                         `xml:"xmlns,attr"`
	Result   ListSubscriptionsByTopicResult `xml:"ListSubscriptionsByTopicResult"`
	Metadata ResponseMetadata               `xml:"ResponseMetadata"`
}

type ListSubscriptionsByTopicResult

type ListSubscriptionsByTopicResult struct {
	Subscriptions TopicSubscriptions `xml:"Subscriptions"`
}

type ListSubscriptionsResponse

type ListSubscriptionsResponse struct {
	Xmlns    string                  `xml:"xmlns,attr"`
	Result   ListSubscriptionsResult `xml:"ListSubscriptionsResult"`
	Metadata ResponseMetadata        `xml:"ResponseMetadata"`
}

type ListSubscriptionsResult

type ListSubscriptionsResult struct {
	Subscriptions TopicSubscriptions `xml:"Subscriptions"`
}

type ListTopicsResponse

type ListTopicsResponse struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Result   ListTopicsResult `xml:"ListTopicsResult"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

type ListTopicsResult

type ListTopicsResult struct {
	Topics TopicNamestype `xml:"Topics"`
}

type Message

type Message struct {
	MessageBody            []byte
	Uuid                   string
	MD5OfMessageAttributes string
	MD5OfMessageBody       string
	ReceiptHandle          string
	ReceiptTime            time.Time
	VisibilityTimeout      time.Time
	NumberOfReceives       int
	Retry                  int
	MessageAttributes      map[string]MessageAttributeValue
	GroupID                string
	DeduplicationID        string
	SentTime               time.Time
	DelaySecs              int
}

func (*Message) IsReadyForReceipt

func (m *Message) IsReadyForReceipt() bool

type MessageAttributeValue

type MessageAttributeValue struct {
	Name     string
	DataType string
	Value    string
	ValueKey string
}

type MessageStructure

type MessageStructure string
const (
	MessageStructureJSON MessageStructure = "json"
)

type MsgAttr

type MsgAttr struct {
	Type  string
	Value string
}

type Protocol

type Protocol string
const (
	ProtocolHTTP    Protocol = "http"
	ProtocolHTTPS   Protocol = "https"
	ProtocolSQS     Protocol = "sqs"
	ProtocolDefault Protocol = "default"
)

type PublishResponse

type PublishResponse struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Result   PublishResult    `xml:"PublishResult"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

type PublishResult

type PublishResult struct {
	MessageId string `xml:"MessageId"`
}

type PurgeQueueResponse

type PurgeQueueResponse struct {
	Xmlns    string           `xml:"xmlns,attr,omitempty"`
	Metadata ResponseMetadata `xml:"ResponseMetadata,omitempty"`
}

** Purge Queue Response

type Queue

type Queue struct {
	Name                string
	URL                 string
	Arn                 string
	TimeoutSecs         int
	ReceiveWaitTimeSecs int
	DelaySecs           int
	MaximumMessageSize  int
	Messages            []Message
	DeadLetterQueue     *Queue
	MaxReceiveCount     int
	IsFIFO              bool
	FIFOMessages        map[string]int
	FIFOSequenceNumbers map[string]int
	EnableDuplicates    bool
	Duplicates          map[string]time.Time
}

func (*Queue) InitDuplicatation

func (q *Queue) InitDuplicatation(deduplicationId string)

func (*Queue) IsDuplicate

func (q *Queue) IsDuplicate(deduplicationId string) bool

func (*Queue) IsLocked

func (q *Queue) IsLocked(groupId string) bool

func (*Queue) LockGroup

func (q *Queue) LockGroup(groupId string)

func (*Queue) NextSequenceNumber

func (q *Queue) NextSequenceNumber(groupId string) string

func (*Queue) UnlockGroup

func (q *Queue) UnlockGroup(groupId string)

type RandomLatency

type RandomLatency struct {
	Min int
	Max int
}

type ReceiveMessageResponse

type ReceiveMessageResponse struct {
	Xmlns    string               `xml:"xmlns,attr"`
	Result   ReceiveMessageResult `xml:"ReceiveMessageResult"`
	Metadata ResponseMetadata     `xml:"ResponseMetadata"`
}

type ReceiveMessageResult

type ReceiveMessageResult struct {
	Message []*ResultMessage `xml:"Message,omitempty"`
}

type ResponseMetadata

type ResponseMetadata struct {
	RequestId string `xml:"RequestId"`
}

** Common **

type ResultAttribute

type ResultAttribute struct {
	Name  string `xml:"Name,omitempty"`
	Value string `xml:"Value,omitempty"`
}

type ResultMessage

type ResultMessage struct {
	MessageId              string                    `xml:"MessageId,omitempty"`
	ReceiptHandle          string                    `xml:"ReceiptHandle,omitempty"`
	MD5OfBody              string                    `xml:"MD5OfBody,omitempty"`
	Body                   []byte                    `xml:"Body,omitempty"`
	MD5OfMessageAttributes string                    `xml:"MD5OfMessageAttributes,omitempty"`
	MessageAttributes      []*ResultMessageAttribute `xml:"MessageAttribute,omitempty"`
	Attributes             []*ResultAttribute        `xml:"Attribute,omitempty"`
}

type ResultMessageAttribute

type ResultMessageAttribute struct {
	Name  string                       `xml:"Name,omitempty"`
	Value *ResultMessageAttributeValue `xml:"Value,omitempty"`
}

type ResultMessageAttributeValue

type ResultMessageAttributeValue struct {
	DataType    string `xml:"DataType,omitempty"`
	StringValue string `xml:"StringValue,omitempty"`
	BinaryValue string `xml:"BinaryValue,omitempty"`
}

type SNSMessage

type SNSMessage struct {
	Type              string
	Token             string `json:"Token",omitempty`
	MessageId         string
	TopicArn          string
	Subject           string
	Message           string
	Timestamp         string
	SignatureVersion  string
	Signature         string `json:"Signature",omitempty`
	SigningCertURL    string
	UnsubscribeURL    string
	SubscribeURL      string             `json:"SubscribeURL",omitempty`
	MessageAttributes map[string]MsgAttr `json:"MessageAttributes",omitempty`
}

type SendMessageBatchResponse

type SendMessageBatchResponse struct {
	Xmlns    string                 `xml:"xmlns,attr,omitempty"`
	Result   SendMessageBatchResult `xml:"SendMessageBatchResult"`
	Metadata ResponseMetadata       `xml:"ResponseMetadata,omitempty"`
}

** Delete Message Batch Response

type SendMessageBatchResult

type SendMessageBatchResult struct {
	Entry []SendMessageBatchResultEntry `xml:"SendMessageBatchResultEntry"`
	Error []BatchResultErrorEntry       `xml:"BatchResultErrorEntry,omitempty"`
}

type SendMessageBatchResultEntry

type SendMessageBatchResultEntry struct {
	Id                     string `xml:"Id"`
	MessageId              string `xml:"MessageId"`
	MD5OfMessageBody       string `xml:"MD5OfMessageBody,omitempty"`
	MD5OfMessageAttributes string `xml:"MD5OfMessageAttributes,omitempty"`
	SequenceNumber         string `xml:"SequenceNumber"`
}

type SendMessageResponse

type SendMessageResponse struct {
	Xmlns    string            `xml:"xmlns,attr"`
	Result   SendMessageResult `xml:"SendMessageResult"`
	Metadata ResponseMetadata  `xml:"ResponseMetadata"`
}

type SendMessageResult

type SendMessageResult struct {
	MD5OfMessageAttributes string `xml:"MD5OfMessageAttributes"`
	MD5OfMessageBody       string `xml:"MD5OfMessageBody"`
	MessageId              string `xml:"MessageId"`
	SequenceNumber         string `xml:"SequenceNumber"`
}

type SetQueueAttributesResponse

type SetQueueAttributesResponse struct {
	Xmlns    string           `xml:"xmlns,attr,omitempty"`
	Metadata ResponseMetadata `xml:"ResponseMetadata,omitempty"`
}

type SetSubscriptionAttributesResponse

type SetSubscriptionAttributesResponse struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

type SnsErrorType

type SnsErrorType struct {
	HttpError int
	Type      string
	Code      string
	Message   string
}

type SqsErrorType

type SqsErrorType struct {
	HttpError int
	Type      string
	Code      string
	Message   string
}

func (*SqsErrorType) Error

func (s *SqsErrorType) Error() string

type SubscribeResponse

type SubscribeResponse struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Result   SubscribeResult  `xml:"SubscribeResult"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

type SubscribeResult

type SubscribeResult struct {
	SubscriptionArn string `xml:"SubscriptionArn"`
}

** Create Subscription **

type Subscription

type Subscription struct {
	TopicArn        string
	Protocol        string
	SubscriptionArn string
	EndPoint        string
	Raw             bool
	FilterPolicy    *FilterPolicy
}

type SubscriptionAttributeEntry

type SubscriptionAttributeEntry struct {
	Key   string `xml:"key,omitempty"`
	Value string `xml:"value,omitempty"`
}

type SubscriptionAttributes

type SubscriptionAttributes struct {
	/* SubscriptionArn, FilterPolicy */
	Entries []SubscriptionAttributeEntry `xml:"entry,omitempty"`
}

type Topic

type Topic struct {
	Name          string
	Arn           string
	Subscriptions []*Subscription
}

type TopicArnResult

type TopicArnResult struct {
	TopicArn string `xml:"TopicArn"`
}

** List Topics Response

type TopicMemberResult

type TopicMemberResult struct {
	TopicArn        string `xml:"TopicArn"`
	Protocol        string `xml:"Protocol"`
	SubscriptionArn string `xml:"SubscriptionArn"`
	Owner           string `xml:"Owner"`
	Endpoint        string `xml:"Endpoint"`
}

** List Subscriptions Response

type TopicNamestype

type TopicNamestype struct {
	Member []TopicArnResult `xml:"member"`
}

type TopicSubscriptions

type TopicSubscriptions struct {
	Member []TopicMemberResult `xml:"member"`
}

type UnsubscribeResponse

type UnsubscribeResponse struct {
	Xmlns    string           `xml:"xmlns,attr"`
	Metadata ResponseMetadata `xml:"ResponseMetadata"`
}

** Unsubscribe **

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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