c# - 如何将 azure 排队消息发送到 azure sql 数据库

标签 c# azure azure-functions azure-table-storage

我已经设置了一个 ASP.NET C# 应用程序,它将信息发送到 azure 存储帐户队列。接下来,我需要通过函数将消息文本从队列中发送到 azure sql 数据库。 消息正文格式如下:

ID:疫苗接种中心:疫苗接种日期:疫苗序列号

例如010203040506:迪拜:01/01/2002:AASB44

该表是在 Azure 数据库中创建的,包含以下列:ID、Vaccination_Centre、Vaccination_Date、Vaccine_Serial_Number 有什么想法如何实现这一目标吗?谢谢

最佳答案

正如 @Scott Mildenberger 评论的那样,我们也可以使用 Azure 逻辑应用来执行您的要求,如下所示: 首先,我创建了一个服务总线队列,如下所示:

enter image description here

然后创建逻辑应用程序 然后在逻辑应用程序的工作流程中: 首先,当新消息进入服务总线队列时创建触发器,如下所示: enter image description here

使用 base64ToString(triggerBody()?['ContentData']) 将队列安全地字符串化,如下所示:

enter image description here

然后使用 split(variables('emo'),':') 拆分队列消息,如下所示:

enter image description here

然后您可以使用(Sql 连接器)创建行向 Sql 数据库表发送消息,如下所示:

enter image description here

enter image description here

对于 idvariables('div')[0] 疫苗接种中心变量('div')[1] 疫苗接种日期变量('div')[2] VaccineSerialNumbervariables('div')[3]

然后现在在服务总线队列中发送消息,如下所示:

enter image description here

现在检查运行结果:

enter image description here

enter image description here

enter image description here

现在它也在Sql数据库表中:

enter image description here

如果您遵循此过程,您将像插入我的行一样插入您的行。

关于c# - 如何将 azure 排队消息发送到 azure sql 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74114722/

相关文章:

c# - 嵌套集合属性上的 EF Core 总和不起作用

xcode - Azure FaSTLane 自动递增内部版本号

连接到虚拟机的 Azure 网站

azure - 从 Blazor Web assembly 独立连接到受 Active Directory B2C 保护的 Azure Function App

c# - 使用Azure功能处理Azure服务总线队列消息

c# - 复制并更新主动录制Wav文件的内容到一个新文件

c# - LocalDb 和 IdentityDbContext Entity Framework 错误 26

azure - 如何在 Linux 计划上的 Azure Functions 上获取内存转储

c# - Roslyn 的新版本 (Microsoft.CodeAnalysis) 中的 `Solution.LoadStandAloneProject` 发生了什么?

azure - 持久任务框架重新排队失败的任务