當前位置: 首頁>>代碼示例>>Golang>>正文


Golang SQS.DeleteMessage方法代碼示例

本文整理匯總了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
}
開發者ID:skatsuta,項目名稱:aws-sdk-go-sample,代碼行數:18,代碼來源:main.go

示例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
}
開發者ID:relud,項目名稱:heka_plugin_sqs3,代碼行數:9,代碼來源:sqs3_input.go

示例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
}
開發者ID:porcup,項目名稱:ngproxy,代碼行數:11,代碼來源:sqs.go

示例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.")
		}

	}
}
開發者ID:GeoNet,項目名稱:haz,代碼行數:17,代碼來源:sqs.go


注:本文中的github.com/aws/aws-sdk-go/service/sqs.SQS.DeleteMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。