本文整理汇总了Golang中github.com/vburenin/firempq/pqueue.PQueue.Description方法的典型用法代码示例。如果您正苦于以下问题:Golang PQueue.Description方法的具体用法?Golang PQueue.Description怎么用?Golang PQueue.Description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/vburenin/firempq/pqueue.PQueue
的用法示例。
在下文中一共展示了PQueue.Description方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetQueueAttributes
func GetQueueAttributes(pq *pqueue.PQueue, sqsQuery *urlutils.SQSQuery) sqs_response.SQSResponse {
paramsLen := len(sqsQuery.ParamsList) - 1
pqCfg := pq.Config()
pqDesc := pq.Description()
resp := &GetQueueAttributesResponse{
RequestId: "reqId",
}
for i := 0; i < paramsLen; i += 2 {
allAttr := false
if strings.HasPrefix(sqsQuery.ParamsList[i], "AttributeName") {
attrName := sqsQuery.ParamsList[i+1]
if attrName == AttrAll {
allAttr = true
resp.Attributes = make([]*QAttr, 0, 13) // 13 total attributes
}
if allAttr || attrName == AttrApproximateNumberOfMessages {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrApproximateNumberOfMessages,
Value: pq.AvailableMessages(),
})
}
if allAttr || attrName == AttrApproximateNumberOfMessagesNotVisible {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrApproximateNumberOfMessagesNotVisible,
Value: pq.LockedCount(),
})
}
if allAttr || attrName == AttrVisibilityTimeout {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrVisibilityTimeout,
Value: pqCfg.PopLockTimeout / 1000,
})
}
if allAttr || attrName == AttrCreatedTimestamp {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrCreatedTimestamp,
Value: pqDesc.CreateTs / 1000,
})
}
if allAttr || attrName == AttrLastModifiedTimestamp {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrLastModifiedTimestamp,
Value: pqCfg.LastUpdateTs / 1000,
})
}
if allAttr || attrName == AttrMaximumMessageSize {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrMaximumMessageSize,
Value: pqCfg.MaxMsgSize,
})
}
if allAttr || attrName == AttrMessageRetentionPeriod {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrMessageRetentionPeriod,
Value: pqCfg.MsgTtl / 1000,
})
}
if allAttr || attrName == AttrQueueArn {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrQueueArn,
Value: makeQueueArn(pqDesc.Name),
})
}
if allAttr || attrName == AttrApproximateNumberOfMessagesDelayed {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrApproximateNumberOfMessagesDelayed,
Value: pq.DelayedCount(),
})
}
if allAttr || attrName == AttrDelaySeconds {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrDelaySeconds,
Value: pqCfg.DeliveryDelay / 1000,
})
}
if allAttr || attrName == AttrReceiveMessageWaitTimeSeconds {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrReceiveMessageWaitTimeSeconds,
Value: pqCfg.PopWaitTimeout / 1000,
})
}
if allAttr || attrName == AttrRedrivePolicy {
if pqCfg.PopLimitQueueName != "" {
resp.Attributes = append(resp.Attributes, &QAttr{
Name: AttrRedrivePolicy,
//.........这里部分代码省略.........