ali_mns

package module
v0.0.0-...-f013aee Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

README

MNS GO SDK

1.0.1

  • support setting timeout
  • add request id to response

Documentation

Index

Constants

View Source
const (
	DefaultQueueQPSLimit int32 = 2000
	DefaultTopicQPSLimit int32 = 2000
	DefaultDNSTTL        int32 = 10
)
View Source
const (
	ClientName           = "mns-go-sdk/1.0.1(fasthttp)"
	DefaultTimeout int64 = 35
)
View Source
const (
	GET    Method = "GET"
	PUT           = "PUT"
	POST          = "POST"
	DELETE        = "DELETE"
)
View Source
const (
	AUTHORIZATION  = "Authorization"
	CONTENT_TYPE   = "Content-Type"
	CONTENT_MD5    = "Content-MD5"
	MQ_VERSION     = "x-mns-version"
	HOST           = "Host"
	DATE           = "Date"
	KEEP_ALIVE     = "Keep-Alive"
	SECURITY_TOKEN = "security-token"
)
View Source
const (
	ALI_MNS_ERR_NS = "MNS"
)
View Source
const (
	GLOBAL_PROXY = "MNS_GLOBAL_PROXY"
)

Variables

View Source
var (
	ERR_SIGN_MESSAGE_FAILED        = errors.TN(ALI_MNS_ERR_NS, 1, "sign message failed, {{.err}}")
	ERR_MARSHAL_MESSAGE_FAILED     = errors.TN(ALI_MNS_ERR_NS, 2, "marshal message filed, {{.err}}")
	ERR_GENERAL_AUTH_HEADER_FAILED = errors.TN(ALI_MNS_ERR_NS, 3, "general auth header failed, {{.err}}")

	ERR_CREATE_NEW_REQUEST_FAILED = errors.TN(ALI_MNS_ERR_NS, 4, "create new request failed, {{.err}}")
	ERR_SEND_REQUEST_FAILED       = errors.TN(ALI_MNS_ERR_NS, 5, "send request failed, {{.err}}")
	ERR_READ_RESPONSE_BODY_FAILED = errors.TN(ALI_MNS_ERR_NS, 6, "read response body failed, {{.err}}")

	ERR_UNMARSHAL_ERROR_RESPONSE_FAILED = errors.TN(ALI_MNS_ERR_NS, 7, "unmarshal error response failed, {{.err}}, ResponseBody: {{.resp}}")
	ERR_UNMARSHAL_RESPONSE_FAILED       = errors.TN(ALI_MNS_ERR_NS, 8, "unmarshal response failed, {{.err}}")
	ERR_DECODE_BODY_FAILED              = errors.TN(ALI_MNS_ERR_NS, 9, "decode body failed, {{.err}}, body: \"{{.body}}\"")
	ERR_GET_BODY_DECODE_ELEMENT_ERROR   = errors.TN(ALI_MNS_ERR_NS, 10, "get body decode element error, local: {{.local}}, error: {{.err}}")

	ERR_MNS_ACCESS_DENIED                = errors.TN(ALI_MNS_ERR_NS, 100, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_ACCESS_KEY_ID        = errors.TN(ALI_MNS_ERR_NS, 101, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INTERNAL_ERROR               = errors.TN(ALI_MNS_ERR_NS, 102, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_AUTHORIZATION_HEADER = errors.TN(ALI_MNS_ERR_NS, 103, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_DATE_HEADER          = errors.TN(ALI_MNS_ERR_NS, 104, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_ARGUMENT             = errors.TN(ALI_MNS_ERR_NS, 105, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_DEGIST               = errors.TN(ALI_MNS_ERR_NS, 106, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_REQUEST_URL          = errors.TN(ALI_MNS_ERR_NS, 107, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_QUERY_STRING         = errors.TN(ALI_MNS_ERR_NS, 108, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_MALFORMED_XML                = errors.TN(ALI_MNS_ERR_NS, 109, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_MISSING_AUTHORIZATION_HEADER = errors.TN(ALI_MNS_ERR_NS, 110, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_MISSING_DATE_HEADER          = errors.TN(ALI_MNS_ERR_NS, 111, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_MISSING_VERSION_HEADER       = errors.TN(ALI_MNS_ERR_NS, 112, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_MISSING_RECEIPT_HANDLE       = errors.TN(ALI_MNS_ERR_NS, 113, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_MISSING_VISIBILITY_TIMEOUT   = errors.TN(ALI_MNS_ERR_NS, 114, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_MESSAGE_NOT_EXIST            = errors.TN(ALI_MNS_ERR_NS, 115, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_QUEUE_ALREADY_EXIST          = errors.TN(ALI_MNS_ERR_NS, 116, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_QUEUE_DELETED_RECENTLY       = errors.TN(ALI_MNS_ERR_NS, 117, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_QUEUE_NAME           = errors.TN(ALI_MNS_ERR_NS, 118, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_VERSION_HEADER       = errors.TN(ALI_MNS_ERR_NS, 119, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_CONTENT_TYPE         = errors.TN(ALI_MNS_ERR_NS, 120, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_QUEUE_NAME_LENGTH_ERROR      = errors.TN(ALI_MNS_ERR_NS, 121, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_QUEUE_NOT_EXIST              = errors.TN(ALI_MNS_ERR_NS, 122, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_RECEIPT_HANDLE_ERROR         = errors.TN(ALI_MNS_ERR_NS, 123, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_SIGNATURE_DOES_NOT_MATCH     = errors.TN(ALI_MNS_ERR_NS, 124, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_TIME_EXPIRED                 = errors.TN(ALI_MNS_ERR_NS, 125, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_QPS_LIMIT_EXCEEDED           = errors.TN(ALI_MNS_ERR_NS, 134, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_UNKNOWN_CODE                 = errors.TN(ALI_MNS_ERR_NS, 135, ali_MNS_ERR_TEMPSTR)

	ERR_MNS_TOPIC_NAME_LENGTH_ERROR       = errors.TN(ALI_MNS_ERR_NS, 200, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_SUBSRIPTION_NAME_LENGTH_ERROR = errors.TN(ALI_MNS_ERR_NS, 201, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_TOPIC_NOT_EXIST               = errors.TN(ALI_MNS_ERR_NS, 202, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_TOPIC_ALREADY_EXIST           = errors.TN(ALI_MNS_ERR_NS, 203, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_TOPIC_NAME            = errors.TN(ALI_MNS_ERR_NS, 204, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_SUBSCRIPTION_NAME     = errors.TN(ALI_MNS_ERR_NS, 205, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_SUBSCRIPTION_ALREADY_EXIST    = errors.TN(ALI_MNS_ERR_NS, 206, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_INVALID_ENDPOINT              = errors.TN(ALI_MNS_ERR_NS, 207, ali_MNS_ERR_TEMPSTR)
	ERR_MNS_SUBSCRIBER_NOT_EXIST          = errors.TN(ALI_MNS_ERR_NS, 211, ali_MNS_ERR_TEMPSTR)

	ERR_MNS_TOPIC_NAME_IS_TOO_LONG                        = errors.TN(ALI_MNS_ERR_NS, 208, "topic name is too long, the max length is 256")
	ERR_MNS_TOPIC_ALREADY_EXIST_AND_HAVE_SAME_ATTR        = errors.TN(ALI_MNS_ERR_NS, 209, "mns topic already exist, and the attribute is the same, topic name: {{.name}}")
	ERR_MNS_SUBSCRIPTION_ALREADY_EXIST_AND_HAVE_SAME_ATTR = errors.TN(ALI_MNS_ERR_NS, 210, "mns subscription already exist, and the attribute is the same, subscription name: {{.name}}")

	ERR_MNS_QUEUE_NAME_IS_TOO_LONG                 = errors.TN(ALI_MNS_ERR_NS, 126, "queue name is too long, the max length is 256")
	ERR_MNS_DELAY_SECONDS_RANGE_ERROR              = errors.TN(ALI_MNS_ERR_NS, 127, "queue delay seconds is not in range of (0~60480)")
	ERR_MNS_MAX_MESSAGE_SIZE_RANGE_ERROR           = errors.TN(ALI_MNS_ERR_NS, 128, "max message size is not in range of (1024~65536)")
	ERR_MNS_MSG_RETENTION_PERIOD_RANGE_ERROR       = errors.TN(ALI_MNS_ERR_NS, 129, "message retention period is not in range of (60~129600)")
	ERR_MNS_MSG_VISIBILITY_TIMEOUT_RANGE_ERROR     = errors.TN(ALI_MNS_ERR_NS, 130, "message visibility timeout is not in range of (1~43200)")
	ERR_MNS_MSG_POOLLING_WAIT_SECONDS_RANGE_ERROR  = errors.TN(ALI_MNS_ERR_NS, 131, "message poolling wait seconds is not in range of (0~30)")
	ERR_MNS_RET_NUMBER_RANGE_ERROR                 = errors.TN(ALI_MNS_ERR_NS, 132, "list param of ret number is not in range of (1~1000)")
	ERR_MNS_QUEUE_ALREADY_EXIST_AND_HAVE_SAME_ATTR = errors.TN(ALI_MNS_ERR_NS, 133, "mns queue already exist, and the attribute is the same, queue name: {{.name}}")
	ERR_MNS_BATCH_OP_FAIL                          = errors.TN(ALI_MNS_ERR_NS, 136, "mns queue batch operation fail")
)
View Source
var (
	DefaultNumOfMessages int32 = 16
)

Functions

func ParseError

func ParseError(resp ErrorResponse, resource string) (err error)

Types

type AliMNSClientConfig

type AliMNSClientConfig struct {
	EndPoint        string
	AccessKeyId     string
	AccessKeySecret string
	Token           string
	TimeoutSecond   int64
}

type AliMNSCredential

type AliMNSCredential struct {
	// contains filtered or unexported fields
}

func NewAliMNSCredential

func NewAliMNSCredential(accessKeySecret, securityToken string) *AliMNSCredential

func (*AliMNSCredential) GetSecretKey

func (p *AliMNSCredential) GetSecretKey() (accessKeySecret string)

func (*AliMNSCredential) GetSecurityToken

func (p *AliMNSCredential) GetSecurityToken() (securityToken string)

func (*AliMNSCredential) SetSecretKey

func (p *AliMNSCredential) SetSecretKey(accessKeySecret string)

func (*AliMNSCredential) SetSecurityToken

func (p *AliMNSCredential) SetSecurityToken(securityToken string)

func (*AliMNSCredential) Signature

func (p *AliMNSCredential) Signature(method Method, headers map[string]string, resource string) (signature string, err error)

type AliMNSQueue

type AliMNSQueue interface {
	QPSMonitor() *QPSMonitor
	Name() string
	SendMessage(message MessageSendRequest) (resp MessageSendResponse, err error)
	BatchSendMessage(messages ...MessageSendRequest) (resp BatchMessageSendResponse, err error)
	ReceiveMessage(respChan chan MessageReceiveResponse, errChan chan error, waitseconds ...int64)
	BatchReceiveMessage(respChan chan BatchMessageReceiveResponse, errChan chan error, numOfMessages int32, waitseconds ...int64)
	PeekMessage(respChan chan MessageReceiveResponse, errChan chan error)
	BatchPeekMessage(respChan chan BatchMessageReceiveResponse, errChan chan error, numOfMessages int32)
	DeleteMessage(receiptHandle string) (err error)
	BatchDeleteMessage(receiptHandles ...string) (resp BatchMessageDeleteErrorResponse, err error)
	ChangeMessageVisibility(receiptHandle string, visibilityTimeout int64) (resp MessageVisibilityChangeResponse, err error)
}

func NewMNSQueue

func NewMNSQueue(name string, client MNSClient, qps ...int32) AliMNSQueue

type AliMNSTopic

type AliMNSTopic interface {
	Name() string
	GenerateQueueEndpoint(queueName string) string
	GenerateMailEndpoint(mailAddress string) string

	PublishMessage(message MessagePublishRequest) (resp MessageSendResponse, err error)

	Subscribe(subscriptionName string, message MessageSubsribeRequest) (err error)
	SetSubscriptionAttributes(subscriptionName string, notifyStrategy NotifyStrategyType) (err error)
	GetSubscriptionAttributes(subscriptionName string) (attr SubscriptionAttribute, err error)
	Unsubscribe(subscriptionName string) (err error)
	ListSubscriptionByTopic(nextMarker string, retNumber int32, prefix string) (subscriptions Subscriptions, err error)
	ListSubscriptionDetailByTopic(nextMarker string, retNumber int32, prefix string) (subscriptionDetails SubscriptionDetails, err error)
}

func NewMNSTopic

func NewMNSTopic(name string, client MNSClient, qps ...int32) AliMNSTopic

type AliQueueManager

type AliQueueManager interface {
	CreateSimpleQueue(queueName string) (err error)
	CreateQueue(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32, slices int32) (err error)
	SetQueueAttributes(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32, slices int32) (err error)
	GetQueueAttributes(queueName string) (attr QueueAttribute, err error)
	DeleteQueue(queueName string) (err error)
	ListQueue(nextMarker string, retNumber int32, prefix string) (queues Queues, err error)
	ListQueueDetail(nextMarker string, retNumber int32, prefix string) (queueDetails QueueDetails, err error)
}

func NewMNSQueueManager

func NewMNSQueueManager(client MNSClient) AliQueueManager

type AliTopicManager

type AliTopicManager interface {
	CreateSimpleTopic(topicName string) (err error)
	CreateTopic(topicName string, maxMessageSize int32, loggingEnabled bool) (err error)
	SetTopicAttributes(topicName string, maxMessageSize int32, loggingEnabled bool) (err error)
	GetTopicAttributes(topicName string) (attr TopicAttribute, err error)
	DeleteTopic(topicName string) (err error)
	ListTopic(nextMarker string, retNumber int32, prefix string) (topics Topics, err error)
	ListTopicDetail(nextMarker string, retNumber int32, prefix string) (topicDetails TopicDetails, err error)
}

func NewMNSTopicManager

func NewMNSTopicManager(client MNSClient) AliTopicManager

type BaseResponder

type BaseResponder interface {
	SetBaseResponse(baseData BaseResponse)
}

type BaseResponse

type BaseResponse struct {
	Code      string `xml:"Code,omitempty" json:"code,omitempty"`
	RequestId string `xml:"RequestId,omitempty" json:"request_id,omitempty"`
	HostId    string `xml:"HostId,omitempty" json:"host_id,omitempty"`
}

func (*BaseResponse) SetBaseResponse

func (this *BaseResponse) SetBaseResponse(data BaseResponse)

type BatchMessageDeleteErrorResponse

type BatchMessageDeleteErrorResponse struct {
	XMLName        xml.Name                 `xml:"Errors" json:"-"`
	FailedMessages []MessageDeleteFailEntry `xml:"Error" json:"errors"`
}

type BatchMessageReceiveResponse

type BatchMessageReceiveResponse struct {
	BaseResponse
	XMLName  xml.Name                 `xml:"Messages" json:"-"`
	Messages []MessageReceiveResponse `xml:"Message" json:"messages"`
}

type BatchMessageSendEntry

type BatchMessageSendEntry struct {
	XMLName        xml.Name `xml:"Message" json:"-"`
	ErrorCode      string   `xml:"ErrorCode,omitempty" json:"error_code,omitempty"`
	ErrorMessage   string   `xml:"ErrorMessage,omitempty" json:"error_messages,omitempty"`
	MessageId      string   `xml:"MessageId,omitempty" json:"message_id,omitempty"`
	MessageBodyMD5 string   `xml:"MessageBodyMD5,omitempty" json:"message_body_md5,omitempty"`
}

type BatchMessageSendRequest

type BatchMessageSendRequest struct {
	XMLName  xml.Name             `xml:"Messages"`
	Messages []MessageSendRequest `xml:"Message"`
}

type BatchMessageSendResponse

type BatchMessageSendResponse struct {
	BaseResponse
	XMLName  xml.Name                `xml:"Messages" json:"-"`
	Messages []BatchMessageSendEntry `xml:"Message" json:"messages"`
}

type CreateQueueRequest

type CreateQueueRequest struct {
	XMLName                xml.Name `xml:"Queue" json:"-"`
	DelaySeconds           int32    `xml:"DelaySeconds" json:"delay_senconds"`
	MaxMessageSize         int32    `xml:"MaximumMessageSize,omitempty" json:"maximum_message_size,omitempty"`
	MessageRetentionPeriod int32    `xml:"MessageRetentionPeriod,omitempty" json:"message_retention_period,omitempty"`
	VisibilityTimeout      int32    `xml:"VisibilityTimeout,omitempty" json:"visibility_timeout,omitempty"`
	PollingWaitSeconds     int32    `xml:"PollingWaitSeconds" json:"polling_wait_secods"`
}

type CreateTopicRequest

type CreateTopicRequest struct {
	XMLName        xml.Name `xml:"Topic" json:"-"`
	MaxMessageSize int32    `xml:"MaximumMessageSize,omitempty" json:"maximum_message_size,omitempty"`
	LoggingEnabled bool     `xml:"LoggingEnabled" json:"logging_enabled"`
}

type Credential

type Credential interface {
	Signature(method Method, headers map[string]string, resource string) (signature string, err error)
	SetSecretKey(accessKeySecret string)
	SetSecurityToken(securityToken string)
	GetSecretKey() (accessKeySecret string)
	GetSecurityToken() (securityToken string)
}

type ErrorResponse

type ErrorResponse struct {
	XMLName   xml.Name `xml:"Error" json:"-"`
	Code      string   `xml:"Code,omitempty" json:"code,omitempty"`
	Message   string   `xml:"Message,omitempty" json:"message,omitempty"`
	RequestId string   `xml:"RequestId,omitempty" json:"request_id,omitempty"`
	HostId    string   `xml:"HostId,omitempty" json:"host_id,omitempty"`
}

type MNSClient

type MNSClient interface {
	Send(method Method, headers map[string]string, message interface{}, resource string) (*fasthttp.Response, error)
	SetProxy(url string)
	// contains filtered or unexported methods
}

func NewAliMNSClient

func NewAliMNSClient(inputUrl, accessKeyId, accessKeySecret string) MNSClient

func NewAliMNSClientWithConfig

func NewAliMNSClientWithConfig(clientConfig AliMNSClientConfig) MNSClient

func NewAliMNSClientWithToken

func NewAliMNSClientWithToken(inputUrl, accessKeyId, accessKeySecret, token string) MNSClient

type MNSDecoder

type MNSDecoder interface {
	Decode(reader io.Reader, v interface{}) (err error)
	DecodeError(bodyBytes []byte, resource string) (decodedError error, err error)

	Test() bool
}

func NewAliMNSDecoder

func NewAliMNSDecoder() MNSDecoder

func NewBatchOpDecoder

func NewBatchOpDecoder(v interface{}) MNSDecoder

type MNSQueue

type MNSQueue struct {
	// contains filtered or unexported fields
}

func (*MNSQueue) BatchDeleteMessage

func (p *MNSQueue) BatchDeleteMessage(receiptHandles ...string) (resp BatchMessageDeleteErrorResponse, err error)

func (*MNSQueue) BatchPeekMessage

func (p *MNSQueue) BatchPeekMessage(respChan chan BatchMessageReceiveResponse, errChan chan error, numOfMessages int32)

func (*MNSQueue) BatchReceiveMessage

func (p *MNSQueue) BatchReceiveMessage(respChan chan BatchMessageReceiveResponse, errChan chan error, numOfMessages int32, waitseconds ...int64)

func (*MNSQueue) BatchSendMessage

func (p *MNSQueue) BatchSendMessage(messages ...MessageSendRequest) (resp BatchMessageSendResponse, err error)

func (*MNSQueue) ChangeMessageVisibility

func (p *MNSQueue) ChangeMessageVisibility(receiptHandle string, visibilityTimeout int64) (resp MessageVisibilityChangeResponse, err error)

func (*MNSQueue) DeleteMessage

func (p *MNSQueue) DeleteMessage(receiptHandle string) (err error)

func (*MNSQueue) Name

func (p *MNSQueue) Name() string

func (*MNSQueue) PeekMessage

func (p *MNSQueue) PeekMessage(respChan chan MessageReceiveResponse, errChan chan error)

func (*MNSQueue) QPSMonitor

func (p *MNSQueue) QPSMonitor() *QPSMonitor

func (*MNSQueue) ReceiveMessage

func (p *MNSQueue) ReceiveMessage(respChan chan MessageReceiveResponse, errChan chan error, waitseconds ...int64)

func (*MNSQueue) SendMessage

func (p *MNSQueue) SendMessage(message MessageSendRequest) (resp MessageSendResponse, err error)

type MNSQueueManager

type MNSQueueManager struct {
	// contains filtered or unexported fields
}

func (*MNSQueueManager) CreateQueue

func (p *MNSQueueManager) CreateQueue(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32, slices int32) (err error)

func (*MNSQueueManager) CreateSimpleQueue

func (p *MNSQueueManager) CreateSimpleQueue(queueName string) (err error)

func (*MNSQueueManager) DeleteQueue

func (p *MNSQueueManager) DeleteQueue(queueName string) (err error)

func (*MNSQueueManager) GetQueueAttributes

func (p *MNSQueueManager) GetQueueAttributes(queueName string) (attr QueueAttribute, err error)

func (*MNSQueueManager) ListQueue

func (p *MNSQueueManager) ListQueue(nextMarker string, retNumber int32, prefix string) (queues Queues, err error)

func (*MNSQueueManager) ListQueueDetail

func (p *MNSQueueManager) ListQueueDetail(nextMarker string, retNumber int32, prefix string) (queueDetails QueueDetails, err error)

func (*MNSQueueManager) SetQueueAttributes

func (p *MNSQueueManager) SetQueueAttributes(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32, slices int32) (err error)

type MNSTopic

type MNSTopic struct {
	// contains filtered or unexported fields
}

func (*MNSTopic) GenerateMailEndpoint

func (p *MNSTopic) GenerateMailEndpoint(mailAddress string) string

func (*MNSTopic) GenerateQueueEndpoint

func (p *MNSTopic) GenerateQueueEndpoint(queueName string) string

func (*MNSTopic) GetSubscriptionAttributes

func (p *MNSTopic) GetSubscriptionAttributes(subscriptionName string) (attr SubscriptionAttribute, err error)

func (*MNSTopic) ListSubscriptionByTopic

func (p *MNSTopic) ListSubscriptionByTopic(nextMarker string, retNumber int32, prefix string) (subscriptions Subscriptions, err error)

func (*MNSTopic) ListSubscriptionDetailByTopic

func (p *MNSTopic) ListSubscriptionDetailByTopic(nextMarker string, retNumber int32, prefix string) (subscriptionDetails SubscriptionDetails, err error)

func (*MNSTopic) Name

func (p *MNSTopic) Name() string

func (*MNSTopic) PublishMessage

func (p *MNSTopic) PublishMessage(message MessagePublishRequest) (resp MessageSendResponse, err error)

func (*MNSTopic) SetSubscriptionAttributes

func (p *MNSTopic) SetSubscriptionAttributes(subscriptionName string, notifyStrategy NotifyStrategyType) (err error)

func (*MNSTopic) Subscribe

func (p *MNSTopic) Subscribe(subscriptionName string, message MessageSubsribeRequest) (err error)

func (*MNSTopic) Unsubscribe

func (p *MNSTopic) Unsubscribe(subscriptionName string) (err error)

type MNSTopicManager

type MNSTopicManager struct {
	// contains filtered or unexported fields
}

func (*MNSTopicManager) CreateSimpleTopic

func (p *MNSTopicManager) CreateSimpleTopic(topicName string) (err error)

func (*MNSTopicManager) CreateTopic

func (p *MNSTopicManager) CreateTopic(topicName string, maxMessageSize int32, loggingEnabled bool) (err error)

func (*MNSTopicManager) DeleteTopic

func (p *MNSTopicManager) DeleteTopic(topicName string) (err error)

func (*MNSTopicManager) GetTopicAttributes

func (p *MNSTopicManager) GetTopicAttributes(topicName string) (attr TopicAttribute, err error)

func (*MNSTopicManager) ListTopic

func (p *MNSTopicManager) ListTopic(nextMarker string, retNumber int32, prefix string) (topics Topics, err error)

func (*MNSTopicManager) ListTopicDetail

func (p *MNSTopicManager) ListTopicDetail(nextMarker string, retNumber int32, prefix string) (topicDetails TopicDetails, err error)

func (*MNSTopicManager) SetTopicAttributes

func (p *MNSTopicManager) SetTopicAttributes(topicName string, maxMessageSize int32, loggingEnabled bool) (err error)

type MailAttributes

type MailAttributes struct {
	Subject        string `json:"Subject"`
	AccountName    string `json:"AccountName"`
	AddressType    int32  `json:"AddressType"`
	IsHtml         bool   `json:"IsHtml"`
	ReplyToAddress int32  `json:"ReplyToAddress"`
}

func (*MailAttributes) MarshalJSON

func (m *MailAttributes) MarshalJSON() ([]byte, error)

type MessageAttributes

type MessageAttributes struct {
	XMLName        xml.Name        `xml:"MessageAttributes" json:"-"`
	MailAttributes *MailAttributes `xml:"DirectMail,omitempty" json:"direct_mail,omitempty"`
}

func (*MessageAttributes) MarshalXML

func (m *MessageAttributes) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type MessageDeleteFailEntry

type MessageDeleteFailEntry struct {
	XMLName       xml.Name `xml:"Error" json:"-"`
	ErrorCode     string   `xml:"ErrorCode" json:"error_code"`
	ErrorMessage  string   `xml:"ErrorMessage" json:"error_messages"`
	ReceiptHandle string   `xml:"ReceiptHandle,omitempty" json:"receipt_handle"`
}

type MessagePublishRequest

type MessagePublishRequest struct {
	XMLName           xml.Name           `xml:"Message" json:"-"`
	MessageBody       string             `xml:"MessageBody" json:"message_body"`
	MessageTag        string             `xml:"MessageTag,omitempty" json:"message_tag,omitempty"`
	MessageAttributes *MessageAttributes `xml:"MessageAttributes,omitempty" json:"message_attributes,omitempty"`
}

type MessageReceiveResponse

type MessageReceiveResponse struct {
	MessageResponse
	MessageId        string `xml:"MessageId" json:"message_id"`
	ReceiptHandle    string `xml:"ReceiptHandle" json:"receipt_handle"`
	MessageBodyMD5   string `xml:"MessageBodyMD5" json:"message_body_md5"`
	MessageBody      string `xml:"MessageBody" json:"message_body"`
	EnqueueTime      int64  `xml:"EnqueueTime" json:"enqueue_time"`
	NextVisibleTime  int64  `xml:"NextVisibleTime" json:"next_visible_time"`
	FirstDequeueTime int64  `xml:"FirstDequeueTime" json:"first_dequeue_time"`
	DequeueCount     int64  `xml:"DequeueCount" json:"dequeue_count"`
	Priority         int64  `xml:"Priority" json:"priority"`
}

type MessageResponse

type MessageResponse struct {
	BaseResponse
	XMLName xml.Name `xml:"Message" json:"-"`
	Message string   `xml:"Message,omitempty" json:"message,omitempty"`
}

type MessageSendRequest

type MessageSendRequest struct {
	XMLName      xml.Name `xml:"Message" json:"-"`
	MessageBody  string   `xml:"MessageBody" json:"message_body"`
	DelaySeconds int64    `xml:"DelaySeconds" json:"delay_seconds"`
	Priority     int64    `xml:"Priority" json:"priority"`
}

type MessageSendResponse

type MessageSendResponse struct {
	MessageResponse
	MessageId      string `xml:"MessageId" json:"message_id"`
	MessageBodyMD5 string `xml:"MessageBodyMD5" json:"message_body_md5"`
	// ReceiptHandle is assigned when any DelayMessage is sent
	ReceiptHandle string `xml:"ReceiptHandle,omitempty"`
}

type MessageSubsribeRequest

type MessageSubsribeRequest struct {
	XMLName             xml.Name                `xml:"Subscription"`
	Endpoint            string                  `xml:"Endpoint"`
	FilterTag           string                  `xml:"FilterTag,omitempty"`
	NotifyStrategy      NotifyStrategyType      `xml:"NotifyStrategy,omitempty"`
	NotifyContentFormat NotifyContentFormatType `xml:"NotifyContentFormat,omitempty"`
}

type MessageVisibilityChangeResponse

type MessageVisibilityChangeResponse struct {
	BaseResponse
	XMLName         xml.Name `xml:"ChangeVisibility" json:"-"`
	ReceiptHandle   string   `xml:"ReceiptHandle" json:"receipt_handle"`
	NextVisibleTime int64    `xml:"NextVisibleTime" json:"next_visible_time"`
}

type Method

type Method string

type NotifyContentFormatType

type NotifyContentFormatType string
const (
	XML        NotifyContentFormatType = "XML"
	SIMPLIFIED NotifyContentFormatType = "SIMPLIFIED"
)

type NotifyStrategyType

type NotifyStrategyType string
const (
	BACKOFF_RETRY           NotifyStrategyType = "BACKOFF_RETRY"
	EXPONENTIAL_DECAY_RETRY NotifyStrategyType = "EXPONENTIAL_DECAY_RETRY"
)

type OpenServicManager

type OpenServicManager struct {
	// contains filtered or unexported fields
}

func NewOpenServiceManager

func NewOpenServiceManager(client MNSClient) *OpenServicManager

func (*OpenServicManager) OpenService

func (p *OpenServicManager) OpenService() (attr OpenService, err error)

type OpenService

type OpenService struct {
	XMLName xml.Name `xml:"OpenService" json:"-"`
	OrderId string   `xml:"OrderId" json:"order_id"`
}

type QPSMonitor

type QPSMonitor struct {
	// contains filtered or unexported fields
}

func NewQPSMonitor

func NewQPSMonitor(delaySecond int32, qpsLimit int32) *QPSMonitor

func (*QPSMonitor) Pulse

func (p *QPSMonitor) Pulse()

func (*QPSMonitor) QPS

func (p *QPSMonitor) QPS() int32

func (*QPSMonitor) Update

func (p *QPSMonitor) Update() int32

type Queue

type Queue struct {
	QueueURL string `xml:"QueueURL" json:"url"`
}

type QueueAttribute

type QueueAttribute struct {
	XMLName                xml.Name `xml:"Queue" json:"-"`
	QueueName              string   `xml:"QueueName,omitempty" json:"queue_name,omitempty"`
	DelaySeconds           int32    `xml:"DelaySeconds,omitempty" json:"delay_seconds,omitempty"`
	MaxMessageSize         int32    `xml:"MaximumMessageSize,omitempty" json:"maximum_message_size,omitempty"`
	MessageRetentionPeriod int32    `xml:"MessageRetentionPeriod,omitempty" json:"message_retention_period,omitempty"`
	VisibilityTimeout      int32    `xml:"VisibilityTimeout,omitempty" json:"visibility_timeout,omitempty"`
	PollingWaitSeconds     int32    `xml:"PollingWaitSeconds,omitempty" json:"polling_wait_secods,omitempty"`
	ActiveMessages         int64    `xml:"ActiveMessages,omitempty" json:"active_messages,omitempty"`
	InactiveMessages       int64    `xml:"InactiveMessages,omitempty" json:"inactive_messages,omitempty"`
	DelayMessages          int64    `xml:"DelayMessages,omitempty" json:"delay_messages,omitempty"`
	CreateTime             int64    `xml:"CreateTime,omitempty" json:"create_time,omitempty"`
	LastModifyTime         int64    `xml:"LastModifyTime,omitempty" json:"last_modify_time,omitempty"`
}

type QueueDetails

type QueueDetails struct {
	XMLName    xml.Name         `xml:"Queues" json:"-"`
	Attrs      []QueueAttribute `xml:"Queue" json:"queues"`
	NextMarker string           `xml:"NextMarker" json:"next_marker"`
}

type Queues

type Queues struct {
	XMLName    xml.Name `xml:"Queues" json:"-"`
	Queues     []Queue  `xml:"Queue" json:"queues"`
	NextMarker string   `xml:"NextMarker" json:"next_marker"`
}

type ReceiptHandles

type ReceiptHandles struct {
	XMLName        xml.Name `xml:"ReceiptHandles"`
	ReceiptHandles []string `xml:"ReceiptHandle"`
}

type SetSubscriptionAttributesRequest

type SetSubscriptionAttributesRequest struct {
	XMLName        xml.Name           `xml:"Subscription" json:"-"`
	NotifyStrategy NotifyStrategyType `xml:"NotifyStrategy,omitempty" json:"notify_strategy,omitempty"`
}

type Subscription

type Subscription struct {
	SubscriptionURL string `xml:"SubscriptionURL" json:"url"`
}

type SubscriptionAttribute

type SubscriptionAttribute struct {
	XMLName             xml.Name                `xml:"Subscription" json:"-"`
	SubscriptionName    string                  `xml:"SubscriptionName,omitempty" json:"queue_name,omitempty"`
	Subscriber          string                  `xml:"Subscriber,omitempty" json:"subscriber,omitempty"`
	TopicOwner          string                  `xml:"TopicOwner,omitempty" json:"topic_owner,omitempty"`
	TopicName           string                  `xml:"TopicName,omitempty" json:"topic_name,omitempty"`
	Endpoint            string                  `xml:"Endpoint,omitempty" json:"endpoint,omitempty"`
	NotifyStrategy      NotifyStrategyType      `xml:"NotifyStrategy,omitempty" json:"notify_strategy,omitempty"`
	NotifyContentFormat NotifyContentFormatType `xml:"NotifyContentFormat,omitempty" json:"notify_content_format,omitempty"`
	FilterTag           string                  `xml:"FilterTag,omitempty" json:"filter_tag,omitempty"`
	CreateTime          int64                   `xml:"CreateTime,omitempty" json:"create_time,omitempty"`
	LastModifyTime      int64                   `xml:"LastModifyTime,omitempty" json:"last_modify_time,omitempty"`
}

type SubscriptionDetails

type SubscriptionDetails struct {
	XMLName    xml.Name                `xml:"Subscriptions" json:"-"`
	Attrs      []SubscriptionAttribute `xml:"Subscription" json:"subscriptions"`
	NextMarker string                  `xml:"NextMarker" json:"next_marker"`
}

type Subscriptions

type Subscriptions struct {
	XMLName       xml.Name       `xml:"Subscriptions" json:"-"`
	Subscriptions []Subscription `xml:"Subscription" json:"subscriptions"`
	NextMarker    string         `xml:"NextMarker" json:"next_marker"`
}

type Topic

type Topic struct {
	TopicURL string `xml:"TopicURL" json:"url"`
}

type TopicAttribute

type TopicAttribute struct {
	XMLName                xml.Name `xml:"Topic" json:"-"`
	TopicName              string   `xml:"TopicName,omitempty" json:"queue_name,omitempty"`
	MaxMessageSize         int32    `xml:"MaximumMessageSize,omitempty" json:"maximum_message_size,omitempty"`
	MessageRetentionPeriod int32    `xml:"MessageRetentionPeriod,omitempty" json:"message_retention_period,omitempty"`
	MessageCount           int64    `xml:"MessageCount,omitempty" json:"message_count,omitempty"`
	CreateTime             int64    `xml:"CreateTime,omitempty" json:"create_time,omitempty"`
	LastModifyTime         int64    `xml:"LastModifyTime,omitempty" json:"last_modify_time,omitempty"`
	LoggingEnabled         bool     `xml:"LoggingEnabled" json:"logging_enabled"`
}

type TopicDetails

type TopicDetails struct {
	XMLName    xml.Name         `xml:"Topics" json:"-"`
	Attrs      []TopicAttribute `xml:"Topic" json:"topics"`
	NextMarker string           `xml:"NextMarker" json:"next_marker"`
}

type Topics

type Topics struct {
	XMLName    xml.Name `xml:"Topics" json:"-"`
	Topics     []Topic  `xml:"Topic" json:"topics"`
	NextMarker string   `xml:"NextMarker" json:"next_marker"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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