简体   繁体   English

Azure Function QueueTrigger - 将新项目放回队列

[英]Azure Function QueueTrigger - Put new items back on queue

I have an Azure Function based on a QueueTrigger .我有一个基于QueueTrigger的 Azure 函数。 This gets triggered when something appears on the queue, but after I processed this item, I then want to put new items back on the queue.当队列中出现某些内容时会触发此操作,但在我处理此项目后,我想将新项目放回队列中。

Is there a way to do this directly from within the Azure Function?有没有办法直接从 Azure 函数中执行此操作?

[Function("Batch")]
public async Task Run([QueueTrigger("batch", Connection = "DataQueue")] string data,
    FunctionContext context)
{
    var model = JsonConvert.DeserializeObject<MyObject>(data);

    // 1. process model
    // 2. Put items back on queue?
}

You can use output bindings as the following:您可以使用输出绑定如下:

[StorageAccount("MyStorageConnectionAppSetting")]
public static class QueueFunctions
{
    [FunctionName("QueueOutput")]
    [return: Queue("myqueue-items")]
    public static string QueueOutput([HttpTrigger] dynamic input,  ILogger log)
    {
        log.LogInformation($"C# function processed: {input.Text}");
        return input.Text;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM