Azure / Azure/azure-functions-host

Expose API to set visibilitytimeout and TTL for individual queue messages

Open
#4,176 5 comments 5 reactions 0 assignees View on GitHub
enhancement feature:language-extensibility
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

#### Investigative information

Timestamp: 08-03-2019 17:30Z
Function App version (1.0 or 2.0): 2.0.12332.0
Function App name: rixwscrape
Function name(s) (as appropriate): enqueue
Invocation ID:
Region: UK South

#### Repro steps

The Queue Storage output binding allows the configuration of a global or per function visibilityTimeout for _retries_ of failed messages, but no means of setting this programatically for the initial visibilityTimeout per message. All that can be specified is the message body.

#### Expected behavior

To be specify a queue item as an object, rather than a plain string. Something like:

`context.bindings.myQueueItem = [
{ message: "message 1", visibilityTimeout: 30, messageTimeToLive: 3600 },
{ message: "message 2", visibilityTimeout: 60, messageTimeToLive: 3600 },
];`

#### Actual behavior

Not supported

#### Known workarounds

I can achieve what I need to do by using the @azure/storage-queue SDK:
[https://docs.microsoft.com/en-us/javascript/api/%40azure/storage-queue/messagesurl?view=azure-node-preview#enqueue-aborter--string--messagesenqueueoptionalparams-](https://docs.microsoft.com/en-us/javascript/api/%40azure/storage-queue/messagesurl?view=azure-node-preview#enqueue-aborter--string--messagesenqueueoptionalparams-)

`messagesUrl.enqueue(Aborter.none, JSON.stringify(result, undefined, 2), {
visibilitytimeout: 30,
messageTimeToLive: 3600
}),`

But it would be way more developer-friendly if these options could be specified via an output binding - I've got c 20 quite verbose LOC at the moment which could be 2-3.

Contributor guide

Open the contributing guide

Research direction

Start with the Queue Storage output binding and its context.bindings.myQueueItem contract, then compare the requested per-message fields with the @azure/storage-queue MessagesUrl.enqueue options described in the issue. Done means queue output messages can specify individual visibilityTimeout and messageTimeToLive values, while existing plain-string output continues to work and the behavior is covered by the relevant binding tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, javascript
Domain
backend, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.