将消息排队到 Azure 存储中的 Azure 函数,而不更改输出。

huangapple go评论72阅读模式
英文:

Enqueueing a message to Azure Storage in an Azure function without changing the output

问题

我有一个用Go编写的自定义处理程序,作为Azure函数运行。它有一个具有两种方法的端点:

  • POST /entities
  • PUT /entities

让我的应用程序作为Azure函数运行很容易:我在host.json中添加了"enableForwardingHttpRequest": true,然后它就可以工作了。

**我需要实现的目标:**由于一些原因,现在我需要在实体更改时将消息加入队列,以触发另一个函数,该函数使用queueTrigger执行一些异步操作。

**我尝试过的方法:**到目前为止,我找到的唯一方法是禁用enableForwardingHttpRequest,并更改所有端点以接受Azure函数的原始JSON输入和输出,然后在其中一个字段中输出一条消息(如此处所述)。

这听起来像是为了实现简单的事情而进行了巨大的改变...有没有一种方法可以在不改变应用程序处理请求的方式的情况下将消息加入队列?

英文:

I have a custom handler written in Go running as an Azure Function. It has an endpoint with two methods:

  • POST /entities
  • PUT /entities

It was easy to make my application run as an Azure function: I added "enableForwardingHttpRequest": true to host.json, and it just works.

What I need to achieve: life happened and now I need to enqueue a message when my entities change, so it will trigger another function that uses a queueTrigger to perform some async stuff.

What I tried: The only way I found so far was to disable enableForwardingHttpRequest, and change all my endpoints to accept the Azure Function's raw JSON input and output, and then output a message in one of the fields (as documented here.

It sounds like a huge change to perform something simple... Is there a way I can enqueue a message without having to change all the way my application handles requests?

答案1

得分: 1

根据这个Github文档,目前Azure函数中与Go语言相关的自定义处理程序存在一个bug,需要修复。
将消息排队到 Azure 存储中的 Azure 函数,而不更改输出。

英文:

As per this Github document as of now custom handlers related to go lang in Azure functions having a bug and which need to be fixed.
将消息排队到 Azure 存储中的 Azure 函数,而不更改输出。

huangapple
  • 本文由 发表于 2022年4月21日 00:25:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/71943124.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定