简体   繁体   English

如何在azure service bus中完成消息

[英]How to complete the message in azure service bus

I am using Azure function app for listing to azure service bus message queue.我正在使用 Azure 函数应用程序列出 Azure 服务总线消息队列。

I want to turn off autocomplete of the message and need to decide to completion programmatically.我想关闭消息的自动完成功能,并需要决定以编程方式完成。 I manage to turn off autocompletion by updating the host.json as follow.我设法通过如下更新 host.json 来关闭自动完成。

{   "version": "2.0",   "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 2.0.0)"   },   "extensions": {
        "serviceBus": {
            "messageHandlerOptions": {
                "autoComplete": false
            }
        }
    } }

My question is How do I complete the message delivery.我的问题是如何完成消息传递。 What is the method I should invoke?我应该调用什么方法? I am writing Azure function app in javascript.我正在用 javascript 编写 Azure 函数应用程序。

Call message.Complete().调用 message.Complete()。

eg Your service bus trigger looks like this:例如,您的服务总线触发器如下所示:

[FunctionName("MyFunctionFQ")]
public static async Task Run([ServiceBusTrigger("%MyQueueName%", AccessRights.Listen, Connection = "SBConnection")]BrokeredMessage message, TraceWriter log) 
{
    // do your processing.....

    // complete the message
    message.Complete();
}
    

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM