当前位置: 首页>>代码示例>>C#>>正文


C# IAmazonS3.DeleteObjectAsync方法代码示例

本文整理汇总了C#中IAmazonS3.DeleteObjectAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IAmazonS3.DeleteObjectAsync方法的具体用法?C# IAmazonS3.DeleteObjectAsync怎么用?C# IAmazonS3.DeleteObjectAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAmazonS3的用法示例。


在下文中一共展示了IAmazonS3.DeleteObjectAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteMessage

		private void DeleteMessage(IAmazonSQS sqs, 
			IAmazonS3 s3,
			Message message, 
			SqsTransportMessage sqsTransportMessage, 
			TransportMessage transportMessage)
		{
			sqs.DeleteMessage(_queueUrl, message.ReceiptHandle);

			if (!String.IsNullOrEmpty(sqsTransportMessage.S3BodyKey))
			{
				// Delete the S3 body asynchronously. 
				// We don't really care too much if this call succeeds or fails - if it fails, 
				// the S3 bucket lifecycle configuration will eventually delete the message anyway.
				// So, we can get better performance by not waiting around for this call to finish.
				var s3DeleteTask = s3.DeleteObjectAsync(
					new DeleteObjectRequest
					{
						BucketName = ConnectionConfiguration.S3BucketForLargeMessages,
						Key = ConnectionConfiguration.S3KeyPrefix + transportMessage.Id
					});

				s3DeleteTask.ContinueWith(t =>
				{
					if (t.Exception != null)
					{
						// If deleting the message body from S3 fails, we don't 
						// want the exception to make its way through to the _endProcessMessage below,
						// as the message has been successfully processed and deleted from the SQS queue
						// and effectively doesn't exist anymore. 
						// It doesn't really matter, as S3 is configured to delete message body data
						// automatically after a certain period of time.
						Logger.Warn("Couldn't delete message body from S3. Message body data will be aged out at a later time.", t.Exception);
					}
				});
			}
		}
开发者ID:GCMGrosvenor,项目名称:NServiceBus.AmazonSQS-1,代码行数:36,代码来源:SqsDequeueStrategy.cs


注:本文中的IAmazonS3.DeleteObjectAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。