Search code examples
node.jsazureazure-storage-queuesazure-functions

Can I queue multiple items from a single run of an Azure Function?


I have a Node.js timerTrigger Azure function that processes a collection and queues the processing results for further processing (by a Node.js queueTrigger function).

The code is something like the following:

module.exports = function (context, myTimer) {
    collection.forEach(function (item) {
        var items = [];

        // do some work and fill 'items'

        var toBeQueued = { items: items };

        context.bindings.myQueue = toBeQueued;
    });

    context.done();
};

This code will only queue the last toBeQueued and not each one I'm trying to queue.

Is there any way to queue more than one item?

Update

To be clear, I'm talking about queueing a toBeQueued in each iteration of forEach, not just queueing an array. Yes, there is an issue with Azure Functions because of which I cannot queue an array, but I have a workaround for it; i.e., { items: items }.


Solution

  • Not yet, but we'll address that within the week, stay tuned :) You'll be able to pass an array to the binding as you're trying to do above.

    We have an issue tracking this in our public repo here. Thanks for reporting.