【发布时间】:2018-08-10 09:45:21
【问题描述】:
我如何创建一个队列触发器,它可以将队列中的项目集合作为触发器。
我当前的队列触发器看起来像
public static async Task Run(
[QueueTrigger("socmapping")]
SocMapping myQueueItem,
[Queue("socmapping-invalid")]
IAsyncCollector<SocMapping> invalidSocMappings,
TraceWriter log,
[Queue("projectedavfeedforsocmapping")]
IAsyncCollector<ProjectedVacancySummary> projectedVacancySummary,
[DocumentDB("AVFeedAudit", "AuditRecords", ConnectionStringSetting = "AVAuditCosmosDB")]
IAsyncCollector<AuditRecord<object, object>> auditRecord)
但我想要类似的东西(可以从队列中获取 n 个项目)[下面的代码抛出异常并说它是 json 数组]
public static async Task Run(
[QueueTrigger("socmapping")]
***List<SocMapping> myQueueItem,***
[Queue("socmapping-invalid")]
IAsyncCollector<SocMapping> invalidSocMappings,
TraceWriter log,
[Queue("projectedavfeedforsocmapping")]
IAsyncCollector<ProjectedVacancySummary> projectedVacancySummary,
[DocumentDB("AVFeedAudit", "AuditRecords", ConnectionStringSetting = "AVAuditCosmosDB")]
IAsyncCollector<AuditRecord<object, object>> auditRecord)
因为我想对队列项目进行批处理,所以只有在队列中存在任何项目时才应该触发函数。想从队列中取出(10)并处理触发函数。
我怎样才能做到这一点?
【问题讨论】:
标签: c# azure azure-functions