首页 文章

自定义逻辑app连接器

提问于
浏览
2

我们正在创建一个多租户应用程序 . 为了允许用户创建业务逻辑,我们希望使用Logic应用程序 .

因此,我想创建一个Web应用程序,它将公开DocumentDB更改源 . When creating a logic app, you can choose between different out of the box connectors. How can we get ours included in the list? Is there any documentation on that?

我们的想法是让逻辑应用程序与每个文档插入一起运行 . 为实现这一目标,我有两个选择:轮询触发器和Webhook触发器 . 我更喜欢轮询触发器,因为这比实现逻辑来处理每个租户的所有订阅URL更少 . 对此方法有疑虑/建议的任何人?

位置 Headers 应该成为我的DocumentDB更改源的延续令牌,这是正确的吗?

  • Logic应用程序将在没有位置 Headers 的情况下第一次调用我的api

  • 我的api会在没有连续令牌的情况下调用DocDb,这将逐个返回所有文档,因为max doc count设置为1

  • 我的api将返回检索到的第一个文档,并将retry-after设置为0,并将该位置设置为我收到的新延续令牌 . 如果没有找到文件,api将返回结果,如步骤5 .

  • Logic应用程序将启动一个新实例来处理文档,并将使用标头中的延续令牌再次调用API .

将重复步骤3到4,直到处理完所有文档 . 因为我每个逻辑应用程序实例只处理一个文档,所以Azure应该能够自动扩展吗?

  • 处理完所有文档后,api将返回202状态代码,其中位置标头设置为最新的延续令牌,重试次数为15 .

  • 15秒后,逻辑应用程序将使用最新的延续令牌调用我们的api . 这将再次触发该过程 .

Is my solution feasible? What if I need to stop, or clone the logic app configuration for some reason, how can I know what the latest continuation was or do I need to save my continuation tokens in some data store?

1 回答

  • 2

    是的,你应该支持你在这里描述的内容 . 您可以在逻辑应用中使用自己的连接器,方法是单击搜索上方的下拉列表,然后选择使用API管理或应用服务中的API作为详细herehere .

    假设您正在使用上面的202轮询模式,则可以在 location 标头的"trigger state"中保留延续令牌 . 因此,例如 Headers 可以是 https://mydocdbconnector.azurewebsites.net/api/trigger?triggerstate={thisCouldBeTheContinuationToken} - 在后续轮询中,最后一个延续令牌被发送回触发器并且可以在操作中使用 . 只要触发器在定义中保持不变(启用/禁用/等所有保留触发器状态),就会保留触发器状态 .

    唯一的一部分我'm not clear on is the multi-tenant requirements you have. I assume you mean you want each of the users to be able to trigger on their own documentDb instance -- the best supported pattern for this today is to have a logic app per customer - each with it'拥有triggerState和触发器 . 这也可以利用自定义连接器 . 这是像Microsoft Flow这样的服务使用的模式,它构建在Logic Apps之上 .

    如果有帮助,请告诉我 .

相关问题