本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/sqs.SQS.DeleteMessage方法的典型用法代碼示例。如果您正苦於以下問題:Golang SQS.DeleteMessage方法的具體用法?Golang SQS.DeleteMessage怎麽用?Golang SQS.DeleteMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/aws/aws-sdk-go/service/sqs.SQS
的用法示例。
在下文中一共展示了SQS.DeleteMessage方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: deleteMessage
func deleteMessage(svc *sqs.SQS, msgs ...*sqs.Message) error {
// delete messages
delParams := sqs.DeleteMessageInput{
QueueUrl: queueURL,
}
for i, msg := range msgs {
delParams.ReceiptHandle = msg.ReceiptHandle
_, err := svc.DeleteMessage(&delParams)
if err != nil {
return err
}
fmt.Printf("message deleted %v: %v\n", i, *msg.Body)
}
return nil
}
示例2: delete_message
func delete_message(svc *sqs.SQS, queue_url *string, receipt_handle *string) error {
params := &sqs.DeleteMessageInput{
QueueUrl: queue_url,
ReceiptHandle: receipt_handle,
}
_, err := svc.DeleteMessage(params)
if err != nil { return err }
return nil
}
示例3: deleteMessage
func deleteMessage(svc *sqs.SQS, queueURL string, receiptHandle string) error {
params := &sqs.DeleteMessageInput{
QueueUrl: aws.String(queueURL), // Required
ReceiptHandle: aws.String(receiptHandle), // Required
}
_, err := svc.DeleteMessage(params)
if err != nil {
return err
}
return nil
}
示例4: delete
func delete(qUrl string, svc *sqs.SQS, dx chan string) {
for {
m := <-dx
params := &sqs.DeleteMessageInput{
QueueUrl: aws.String(qUrl), // Required
ReceiptHandle: aws.String(m), // Required
}
_, err := svc.DeleteMessage(params)
if err != nil {
log.Println("WARN - problem deleting messages from SQS, continuing.")
}
}
}