Azure storage queue message (show at specific time)
Asked Answered
C

1

12

How can I add a message to Azure queue storage that will show up in the queue exactly tomorrow (after 24 h) ?

Cryptonymous answered 29/10, 2013 at 12:40 Comment(1)
Is this property NextVisibleTime on a CloudQueueMessage ?Cryptonymous
E
28

If you are using the Storage Client Library, you will be able to use the addMessage overload in CloudQueue that takes the initial visibility delay as an input param.

Specifically, you would have to use the following overload in 2.0:

AddMessage(CloudQueueMessage message, TimeSpan? timeToLive = null, TimeSpan? initialVisibilityDelay = null, QueueRequestOptions options = null, OperationContext operationContext = null)

If you are using version 1.7, you would use the following overload:

public void AddMessage(CloudQueueMessage message, TimeSpan? timeToLive, TimeSpan? initialVisibilityDelay)

You can find more info about Visibility timeout and how it works here.

While the TTL (Time to Live;ie, time until death; not time until live) is not capped (as of version 2017-07-29) the visibilityTimeout "must be larger than or equal to 0, and cannot be larger than 7 days"

Electromagnetic answered 30/10, 2013 at 16:8 Comment(4)
We have been using this initialVisibilityDelay property as well, but just "discovered" a limitation with it: You cannot delay the queue message for more than 7 days from the current time! This was a dealbreaker for us, but it may be possible to work around it by throwing another message back on the queue if not enough time has passed (if you need more than 1 week)Campfire
@Campfire that is because messages expire if they have been sitting on a queue unprocessed for a week, so any method of awaiting a whole week using a queue will be problematic.Iberia
@AndrewHill It's worth noting that the TTL maximum is no longer 7 days, as long as you're using an ARM template later than 2017-07-29. learn.microsoft.com/en-us/rest/api/storageservices/Put-MessageRub
what if you are using a function binding rather than connecting to the storage service explicitly in your code?Yuzik

© 2022 - 2024 — McMap. All rights reserved.