1
votes

How can i create a queue trigger which can take collections of items from Queue as a Trigger.

My current Queue Trigger looks like

   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)

but I want something like (which can take n number of items from Queue) [ The below code throws exception and says it to be json array ]

  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)

As i want to do the batch processing of the Queue Item as well as the Function should only be triggered if any item present in the queue . Want to Take(10) from the Queue and process the trigger function.

How can i achieve this ?

1

1 Answers

4
votes

This is not possible. Your Azure Function will be triggered once per each message in the queue. Some trigger types support batch parameters (e.g. Event Hubs or Cosmos DB), but Queue Trigger is not one of them.