0
votes

Is it possible to set an expiration time for Azure Function Storage queue output binding?

This is what I have in function.js:

{ "type": "queue", "name": "MyMessageQueue", "queueName": "mymsgqueue", "connection": "AzureWebJobsStorage", "direction": "out" }

However can I specify when the message I add should expire?

1

1 Answers

2
votes

Yes, you can. In your function's Run method, change the MyMessageQueue output parameter type to CloudQueue. Then create a CloudQueueMessage in your code and use the AddMessage method to add the message to the queue. The timeToLive parameter would allow you to control the expiration time.

Refer to the Azure Functions Queue Storage bindings documentation page for more details and examples.