Skip to content

Adding initialVisibilityDelay option to Azure Storage Queue binding#3820

Merged
yaron2 merged 9 commits intodapr:mainfrom
willvelida:feature/3555
Jun 26, 2025
Merged

Adding initialVisibilityDelay option to Azure Storage Queue binding#3820
yaron2 merged 9 commits intodapr:mainfrom
willvelida:feature/3555

Conversation

@willvelida
Copy link
Copy Markdown
Contributor

@willvelida willvelida commented May 17, 2025

Description

This PR implements the initialVisibilityDelay option for Azure Queue Storage Binding. This feature allows setting a delay before a message becomes visible in the queue after being added, which is a functionality available in the Azure Storage Queue service.

The implementation includes:

  1. Adding the InitialVisibilityDelay field to the storageQueuesMetadata struct with appropriate mapstructure tags
  2. Modifying the QueueHelper interface to include the initialVisibilityDelay parameter in the Write method
  3. Updating the AzureQueueHelper.Write implementation to use the initialVisibilityDelay parameter when calling EnqueueMessage
  4. Adding logic in the AzureStorageQueues.Invoke method to extract initialVisibilityDelay from request metadata
  5. Adding documentation in metadata.yaml for the new option
  6. Creating tests to verify the functionality:
    • Added a specific unit test TestWriteWithInitialVisibilityDelay that verifies the initialVisibilityDelay parameter is correctly passed from the request metadata to the Write method
    • Updated the mock helper to support the new initialVisibilityDelay parameter
    • Modified existing tests to accommodate the new parameter, ensuring backward compatibility
    • Verified that the functionality works properly by asserting that the value passed to EnqueueMessage matches the expected value

Issue reference

This PR will close #3555

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

…omponent

Signed-off-by: Will Velida <willvelida@hotmail.co.uk>
@willvelida willvelida requested review from a team as code owners May 17, 2025 09:22
Comment thread bindings/azure/storagequeues/metadata.yaml Outdated
Comment thread bindings/azure/storagequeues/storagequeues.go Outdated
type QueueHelper interface {
Init(ctx context.Context, metadata bindings.Metadata) (*storageQueuesMetadata, error)
Write(ctx context.Context, data []byte, ttl *time.Duration) error
Write(ctx context.Context, data []byte, ttl *time.Duration, initialVisibilityDelay *time.Duration) error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this value is passed as a parameter but isn't expected to change dynamically, I suggest making it a struct property in the types that implement this interface.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After setting the default value to 0, I was thinking that if we keep it as a parameter, consumers can configure it on a per-message basis and it keep some consistency with the ttl parameter. I'm also think that using a struct here could introduce race conditions with the binding.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough!

…ests and formatting metadata

Signed-off-by: Will Velida <willvelida@hotmail.co.uk>
@willvelida willvelida requested a review from nelson-parente May 26, 2025 11:29
@cicoyle cicoyle added the autoupdate automatically keeps PR up to date against master label Jun 25, 2025
@yaron2 yaron2 merged commit fd158f9 into dapr:main Jun 26, 2025
90 checks passed
mikeee pushed a commit to mikeee/dapr_components-contrib that referenced this pull request Jun 27, 2025
…apr#3820)

Signed-off-by: Will Velida <willvelida@hotmail.co.uk>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Cassie Coyle <cassie@diagrid.io>
sicoyle pushed a commit to sicoyle/components-contrib that referenced this pull request Jul 7, 2025
…apr#3820)

Signed-off-by: Will Velida <willvelida@hotmail.co.uk>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Cassie Coyle <cassie@diagrid.io>
@willvelida willvelida deleted the feature/3555 branch September 3, 2025 10:20
passuied pushed a commit to passuied/components-contrib that referenced this pull request Feb 14, 2026
…apr#3820)

Signed-off-by: Will Velida <willvelida@hotmail.co.uk>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Cassie Coyle <cassie@diagrid.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autoupdate automatically keeps PR up to date against master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure Queue: InitialVisibilityDelay option

4 participants