Documentation ¶
Index ¶
- Constants
- Variables
- type AliMQSClient
- type AliMQSCredential
- type AliMQSQueue
- type AliQueueManager
- type Base64Bytes
- type CreateQueueRequest
- type Credential
- type ErrorMessageResponse
- type MQSClient
- type MQSLocation
- type MQSQueue
- func (p *MQSQueue) ChangeMessageVisibility(receiptHandle string, visibilityTimeout int64) (resp MessageVisibilityChangeResponse, err error)
- func (p *MQSQueue) DeleteMessage(receiptHandle string) (err error)
- func (p *MQSQueue) Name() string
- func (p *MQSQueue) PeekMessage(respChan chan MessageReceiveResponse, errChan chan error)
- func (p *MQSQueue) ReceiveMessage(respChan chan MessageReceiveResponse, errChan chan error, waitseconds ...int64)
- func (p *MQSQueue) SendMessage(message MessageSendRequest) (resp MessageSendResponse, err error)
- func (p *MQSQueue) Stop()
- type MQSQueueManager
- func (p *MQSQueueManager) CreateQueue(location MQSLocation, queueName string, delaySeconds int32, ...) (err error)
- func (p *MQSQueueManager) DeleteQueue(location MQSLocation, queueName string) (err error)
- func (p *MQSQueueManager) GetQueueAttributes(location MQSLocation, queueName string) (attr QueueAttribute, err error)
- func (p *MQSQueueManager) ListQueue(location MQSLocation, marker string, retNumber int32, prefix string) (queues Queues, err error)
- func (p *MQSQueueManager) SetQueueAttributes(location MQSLocation, queueName string, delaySeconds int32, ...) (err error)
- type MessageReceiveResponse
- type MessageResponse
- type MessageSendRequest
- type MessageSendResponse
- type MessageVisibilityChangeResponse
- type Method
- type Queue
- type QueueAttribute
- type Queues
Constants ¶
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-mqs-version" HOST = "Host" DATE = "Date" KEEP_ALIVE = "Keep-Alive" )
View Source
const ( PROXY_PREFIX = "MQS_PROXY_" GLOBAL_PROXY = "MQS_GLOBAL_PROXY" )
View Source
const (
ALI_MQS_ERR_NS = "MQS"
)
View Source
const (
DefaultTimeout int64 = 35
)
Variables ¶
View Source
var ( ERR_SIGN_MESSAGE_FAILED = errors.TN(ALI_MQS_ERR_NS, 1, "sign message failed, {{.err}}") ERR_MARSHAL_MESSAGE_FAILED = errors.TN(ALI_MQS_ERR_NS, 2, "marshal message filed, {{.err}}") ERR_GENERAL_AUTH_HEADER_FAILED = errors.TN(ALI_MQS_ERR_NS, 3, "general auth header failed, {{.err}}") ERR_CREATE_NEW_REQUEST_FAILED = errors.TN(ALI_MQS_ERR_NS, 4, "create new request failed, {{.err}}") ERR_SEND_REQUEST_FAILED = errors.TN(ALI_MQS_ERR_NS, 5, "send request failed, {{.err}}") ERR_READ_RESPONSE_BODY_FAILED = errors.TN(ALI_MQS_ERR_NS, 6, "read response body failed, {{.err}}") ERR_UNMARSHAL_ERROR_RESPONSE_FAILED = errors.TN(ALI_MQS_ERR_NS, 7, "unmarshal error response failed, {{.err}}") ERR_UNMARSHAL_RESPONSE_FAILED = errors.TN(ALI_MQS_ERR_NS, 8, "unmarshal response failed, {{.err}}") ERR_DECODE_BODY_FAILED = errors.TN(ALI_MQS_ERR_NS, 9, "decode body failed, {{.err}}, body: \"{{.body}}\"") ERR_GET_BODY_DECODE_ELEMENT_ERROR = errors.TN(ALI_MQS_ERR_NS, 10, "get body decode element error, local: {{.local}}, error: {{.err}}") ERR_MQS_ACCESS_DENIED = errors.TN(ALI_MQS_ERR_NS, 100, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_ACCESS_KEY_ID = errors.TN(ALI_MQS_ERR_NS, 101, ali_MQS_ERR_TEMPSTR) ERR_MQS_INTERNAL_ERROR = errors.TN(ALI_MQS_ERR_NS, 102, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_AUTHORIZATION_HEADER = errors.TN(ALI_MQS_ERR_NS, 103, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_DATE_HEADER = errors.TN(ALI_MQS_ERR_NS, 104, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_ARGUMENT = errors.TN(ALI_MQS_ERR_NS, 105, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_DEGIST = errors.TN(ALI_MQS_ERR_NS, 106, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_REQUEST_URL = errors.TN(ALI_MQS_ERR_NS, 107, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_QUERY_STRING = errors.TN(ALI_MQS_ERR_NS, 108, ali_MQS_ERR_TEMPSTR) ERR_MQS_MALFORMED_XML = errors.TN(ALI_MQS_ERR_NS, 109, ali_MQS_ERR_TEMPSTR) ERR_MQS_MISSING_AUTHORIZATION_HEADER = errors.TN(ALI_MQS_ERR_NS, 110, ali_MQS_ERR_TEMPSTR) ERR_MQS_MISSING_DATE_HEADER = errors.TN(ALI_MQS_ERR_NS, 111, ali_MQS_ERR_TEMPSTR) ERR_MQS_MISSING_VERSION_HEADER = errors.TN(ALI_MQS_ERR_NS, 112, ali_MQS_ERR_TEMPSTR) ERR_MQS_MISSING_RECEIPT_HANDLE = errors.TN(ALI_MQS_ERR_NS, 113, ali_MQS_ERR_TEMPSTR) ERR_MQS_MISSING_VISIBILITY_TIMEOUT = errors.TN(ALI_MQS_ERR_NS, 114, ali_MQS_ERR_TEMPSTR) ERR_MQS_MESSAGE_NOT_EXIST = errors.TN(ALI_MQS_ERR_NS, 115, ali_MQS_ERR_TEMPSTR) ERR_MQS_QUEUE_ALREADY_EXIST = errors.TN(ALI_MQS_ERR_NS, 116, ali_MQS_ERR_TEMPSTR) ERR_MQS_QUEUE_DELETED_RECENTLY = errors.TN(ALI_MQS_ERR_NS, 117, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_QUEUE_NAME = errors.TN(ALI_MQS_ERR_NS, 118, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_VERSION_HEADER = errors.TN(ALI_MQS_ERR_NS, 119, ali_MQS_ERR_TEMPSTR) ERR_MQS_INVALID_CONTENT_TYPE = errors.TN(ALI_MQS_ERR_NS, 120, ali_MQS_ERR_TEMPSTR) ERR_MQS_QUEUE_NAME_LENGTH_ERROR = errors.TN(ALI_MQS_ERR_NS, 121, ali_MQS_ERR_TEMPSTR) ERR_MQS_QUEUE_NOT_EXIST = errors.TN(ALI_MQS_ERR_NS, 122, ali_MQS_ERR_TEMPSTR) ERR_MQS_RECEIPT_HANDLE_ERROR = errors.TN(ALI_MQS_ERR_NS, 123, ali_MQS_ERR_TEMPSTR) ERR_MQS_SIGNATURE_DOES_NOT_MATCH = errors.TN(ALI_MQS_ERR_NS, 124, ali_MQS_ERR_TEMPSTR) ERR_MQS_TIME_EXPIRED = errors.TN(ALI_MQS_ERR_NS, 125, ali_MQS_ERR_TEMPSTR) ERR_MQS_QUEUE_NAME_IS_TOO_LONG = errors.TN(ALI_MQS_ERR_NS, 126, "queue name is too long, the max length is 256") ERR_MQS_DELAY_SECONDS_RANGE_ERROR = errors.TN(ALI_MQS_ERR_NS, 127, "queue delay seconds is not in range of (0~60480)") ERR_MQS_MAX_MESSAGE_SIZE_RANGE_ERROR = errors.TN(ALI_MQS_ERR_NS, 128, "max message size is not in range of (1024~65536)") ERR_MQS_MSG_RETENTION_PERIOD_RANGE_ERROR = errors.TN(ALI_MQS_ERR_NS, 129, "message retention period is not in range of (60~129600)") ERR_MQS_MSG_VISIBILITY_TIMEOUT_RANGE_ERROR = errors.TN(ALI_MQS_ERR_NS, 130, "message visibility timeout is not in range of (1~43200)") ERR_MQS_MSG_POOLLING_WAIT_SECONDS_RANGE_ERROR = errors.TN(ALI_MQS_ERR_NS, 131, "message poolling wait seconds is not in range of (0~30)") REE_MQS_GET_QUEUE_RET_NUMBER_RANGE_ERROR = errors.TN(ALI_MQS_ERR_NS, 132, "get queue list param of ret number is not in range of (1~1000)") ERR_MQS_QUEUE_ALREADY_EXIST_AND_HAVE_SAME_ATTR = errors.TN(ALI_MQS_ERR_NS, 133, "mqs queue already exist, and the attribute is the same, queue name: {{.name}}") )
View Source
var (
RECEIVER_COUNT = 10
)
Functions ¶
This section is empty.
Types ¶
type AliMQSClient ¶
type AliMQSClient struct { Timeout int64 // contains filtered or unexported fields }
func (*AliMQSClient) SetProxy ¶
func (p *AliMQSClient) SetProxy(url string)
type AliMQSCredential ¶
type AliMQSCredential struct {
// contains filtered or unexported fields
}
func NewAliMQSCredential ¶
func NewAliMQSCredential(accessKeySecret string) *AliMQSCredential
func (*AliMQSCredential) SetSecretKey ¶
func (p *AliMQSCredential) SetSecretKey(accessKeySecret string)
type AliMQSQueue ¶
type AliMQSQueue interface { Name() string SendMessage(message MessageSendRequest) (resp MessageSendResponse, err error) ReceiveMessage(respChan chan MessageReceiveResponse, errChan chan error, waitseconds ...int64) PeekMessage(respChan chan MessageReceiveResponse, errChan chan error) DeleteMessage(receiptHandle string) (err error) ChangeMessageVisibility(receiptHandle string, visibilityTimeout int64) (resp MessageVisibilityChangeResponse, err error) Stop() }
func NewMQSQueue ¶
func NewMQSQueue(name string, client MQSClient) AliMQSQueue
type AliQueueManager ¶
type AliQueueManager interface { CreateQueue(location MQSLocation, queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32) (err error) SetQueueAttributes(location MQSLocation, queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32) (err error) GetQueueAttributes(location MQSLocation, queueName string) (attr QueueAttribute, err error) DeleteQueue(location MQSLocation, queueName string) (err error) ListQueue(location MQSLocation, marker string, retNumber int32, prefix string) (queues Queues, err error) }
func NewMQSQueueManager ¶
func NewMQSQueueManager(ownerId, accessKeyId, accessKeySecret string) AliQueueManager
type Base64Bytes ¶
type Base64Bytes []byte
func (Base64Bytes) MarshalXML ¶
func (p Base64Bytes) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Base64Bytes) UnmarshalXML ¶
func (p *Base64Bytes) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
type CreateQueueRequest ¶
type CreateQueueRequest struct { XMLName xml.Name `xml:"Queue" json:"-"` DelaySeconds int32 `xml:"DelaySenconds,omitempty" json:"delay_senconds,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"` }
type Credential ¶
type ErrorMessageResponse ¶
type ErrorMessageResponse 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 MQSClient ¶
type MQSClient interface { Send(method Method, headers map[string]string, message interface{}, resource string, v interface{}) (statusCode int, err error) SetProxy(url string) }
func NewAliMQSClient ¶
type MQSLocation ¶
type MQSLocation string
const ( Beijing MQSLocation = "beijing" Hangzhou MQSLocation = "hangzhou" Qingdao MQSLocation = "qingdao" )
type MQSQueue ¶
type MQSQueue struct {
// contains filtered or unexported fields
}
func (*MQSQueue) ChangeMessageVisibility ¶
func (p *MQSQueue) ChangeMessageVisibility(receiptHandle string, visibilityTimeout int64) (resp MessageVisibilityChangeResponse, err error)
func (*MQSQueue) DeleteMessage ¶
func (*MQSQueue) PeekMessage ¶
func (p *MQSQueue) PeekMessage(respChan chan MessageReceiveResponse, errChan chan error)
func (*MQSQueue) ReceiveMessage ¶
func (p *MQSQueue) ReceiveMessage(respChan chan MessageReceiveResponse, errChan chan error, waitseconds ...int64)
func (*MQSQueue) SendMessage ¶
func (p *MQSQueue) SendMessage(message MessageSendRequest) (resp MessageSendResponse, err error)
type MQSQueueManager ¶
type MQSQueueManager struct {
// contains filtered or unexported fields
}
func (*MQSQueueManager) CreateQueue ¶
func (p *MQSQueueManager) CreateQueue(location MQSLocation, queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32) (err error)
func (*MQSQueueManager) DeleteQueue ¶
func (p *MQSQueueManager) DeleteQueue(location MQSLocation, queueName string) (err error)
func (*MQSQueueManager) GetQueueAttributes ¶
func (p *MQSQueueManager) GetQueueAttributes(location MQSLocation, queueName string) (attr QueueAttribute, err error)
func (*MQSQueueManager) ListQueue ¶
func (p *MQSQueueManager) ListQueue(location MQSLocation, marker string, retNumber int32, prefix string) (queues Queues, err error)
func (*MQSQueueManager) SetQueueAttributes ¶
func (p *MQSQueueManager) SetQueueAttributes(location MQSLocation, queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32) (err error)
type MessageReceiveResponse ¶
type MessageReceiveResponse struct { MessageResponse ReceiptHandle string `xml:"ReceiptHandle" json:"receipt_handle"` MessageBodyMD5 string `xml:"MessageBodyMD5" json:"message_body_md5"` MessageBody Base64Bytes `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 { XMLName xml.Name `xml:"Message" 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 MessageSendRequest ¶
type MessageSendRequest struct { XMLName xml.Name `xml:"Message"` MessageBody Base64Bytes `xml:"MessageBody"` DelaySeconds int64 `xml:"DelaySeconds"` Priority int64 `xml:"Priority"` }
type MessageSendResponse ¶
type MessageSendResponse struct { MessageResponse MessageId string `xml:"MessageId" json:"message_id"` MessageBodyMD5 string `xml:"MessageBodyMD5" json:"message_body_md5"` }
type QueueAttribute ¶
type QueueAttribute struct { XMLName xml.Name `xml:"Queue" json:"-"` QueueName string `xml:"QueueName,omitempty" json:"queue_name,omitempty"` DelaySeconds int32 `xml:"DelaySenconds,omitempty" json:"delay_senconds,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"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.