Documentation ¶
Index ¶
- Constants
- Variables
- type Account
- type Base64Bytes
- type BatchMessageReceiveResponse
- type BatchMessageSendRequest
- type CreateQueueRequest
- type ErrorMessageResponse
- type HTTPConfig
- type MessagePool
- func (p *MessagePool) Delete(queueName string, receiptHandle string) (err error)
- func (p *MessagePool) Dequeue(queueName string) (message TinyQueueMessage, err error)
- func (p *MessagePool) Enqueue(queueName string, delaySeconds time.Duration, priority int64, body Base64Bytes) (id string, err error)
- func (p *MessagePool) GetQueueProperty(queueName string) (property QueueProperty, err error)
- type MessagePoolMode
- type MessageReceiveResponse
- type MessageResponse
- type MessageSendRequest
- type MessageSendResponse
- type MessageVisibilityChangeResponse
- type PoolConfig
- type Queue
- type QueueConfig
- type QueueProperty
- type Queues
- type ReceiptHandles
- type TinyMQS
- func (p *TinyMQS) CreatePools(pools []PoolConfig) (err error)
- func (p *TinyMQS) DeleteMessage(resp http.ResponseWriter, req *http.Request, params martini.Params)
- func (p *TinyMQS) ReceiveMessage(resp http.ResponseWriter, req *http.Request, params martini.Params)
- func (p *TinyMQS) Run()
- func (p *TinyMQS) SendMessage(resp http.ResponseWriter, req *http.Request, params martini.Params)
- type TinyMQSConfig
- type TinyQueueMessage
Constants ¶
View Source
const (
TinyMQSErrNamespace = "MQS"
)
Variables ¶
View Source
var ( ErrDecodeBodyFailed = errors.TN(TinyMQSErrNamespace, 1, "decode body failed, {{.err}}, body: \"{{.body}}\"") ErrGetBodyDecodeElementError = errors.TN(TinyMQSErrNamespace, 2, "get body decode element error, local: {{.local}}, error: {{.err}}") ErrQueueNotExist = errors.TN(TinyMQSErrNamespace, 3, "queue not exist, queue: {{.queueName}}") ErrNoMessage = errors.TN(TinyMQSErrNamespace, 4, "message not exist, queue: {{.queueName}}") ErrInternalError = errors.TN(TinyMQSErrNamespace, 5, "Internal error, error: {{.err}}") ErrBadReceiptHandle = errors.TN(TinyMQSErrNamespace, 6, "The receipt handle you provide is not valid. {{.handle}}") ErrOwnerIDIsEmpty = errors.TN(TinyMQSErrNamespace, 7, "owner id is empty") ErrQueueNameIsEmpty = errors.TN(TinyMQSErrNamespace, 8, "queue name is empty, owner: {{.ownerID}}") ErrHostIsEmpty = errors.TN(TinyMQSErrNamespace, 9, "host is empty for pool owner: {{.ownerID}}") ErrPoolAlreadyExist = errors.TN(TinyMQSErrNamespace, 10, "pool already exist, owner: {{.ownerID}}") ErrPoolNotExist = errors.TN(TinyMQSErrNamespace, 11, "host did not have related pool") )
Functions ¶
This section is empty.
Types ¶
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 BatchMessageReceiveResponse ¶
type BatchMessageReceiveResponse struct { XMLName xml.Name `xml:"Messages" json:"-"` Messages []MessageReceiveResponse `xml:"Message" json:"messages"` }
type BatchMessageSendRequest ¶
type BatchMessageSendRequest struct { XMLName xml.Name `xml:"Messages"` Messages []MessageSendRequest `xml:"Message"` }
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 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 HTTPConfig ¶
type HTTPConfig struct {
Address string `json:"address"`
}
type MessagePool ¶
type MessagePool struct {
// contains filtered or unexported fields
}
func NewMessagePool ¶
func NewMessagePool(poolMode MessagePoolMode, queuesProperties ...QueueProperty) *MessagePool
func (*MessagePool) Delete ¶
func (p *MessagePool) Delete(queueName string, receiptHandle string) (err error)
func (*MessagePool) Dequeue ¶
func (p *MessagePool) Dequeue(queueName string) (message TinyQueueMessage, err error)
func (*MessagePool) Enqueue ¶
func (p *MessagePool) Enqueue(queueName string, delaySeconds time.Duration, priority int64, body Base64Bytes) (id string, err error)
func (*MessagePool) GetQueueProperty ¶
func (p *MessagePool) GetQueueProperty(queueName string) (property QueueProperty, err error)
type MessagePoolMode ¶
type MessagePoolMode int32
const ( PoolModeDefault MessagePoolMode = 0 PoolModeAutoCreateQueue MessagePoolMode = 1 )
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 PoolConfig ¶
type QueueConfig ¶
type QueueProperty ¶
type QueueProperty struct { Name string MaxMessageSize int32 MessageRetentionPeriod time.Duration VisibilityTimeout time.Duration PollingWaitSeconds time.Duration }
func DefaultQueueProperty ¶
func DefaultQueueProperty(name string) QueueProperty
type Queues ¶
type Queues struct { XMLName xml.Name `xml:"Queues" json:"-"` Queues []Queue `xml:"Queue" json:"queues"` NextMarker Base64Bytes `xml:"NextMarker" json:"next_marker"` }
type ReceiptHandles ¶
type TinyMQS ¶
type TinyMQS struct {
// contains filtered or unexported fields
}
func NewTinyMQS ¶
func NewTinyMQS() *TinyMQS
func (*TinyMQS) CreatePools ¶
func (p *TinyMQS) CreatePools(pools []PoolConfig) (err error)
func (*TinyMQS) DeleteMessage ¶
func (*TinyMQS) ReceiveMessage ¶
func (*TinyMQS) SendMessage ¶
type TinyMQSConfig ¶
type TinyMQSConfig struct { HTTP HTTPConfig `json:"http"` Pools []PoolConfig `json:"pools"` }
func (*TinyMQSConfig) LoadConfig ¶
func (p *TinyMQSConfig) LoadConfig(filename string) (err error)
type TinyQueueMessage ¶
type TinyQueueMessage struct { Id string ReceiptHandle string Body Base64Bytes EnqueueTime time.Time DequeueCount int64 Priority int64 DelaySeconds time.Duration FirstDequeueTime time.Duration NextDequeueTime time.Duration // contains filtered or unexported fields }
func NewTinyQueueMessage ¶
func NewTinyQueueMessage(body Base64Bytes, delaySeconds time.Duration, priority int64, lifeCycle time.Duration) (message *TinyQueueMessage)
Click to show internal directories.
Click to hide internal directories.