1

I have a Storage Account where the creation of a blob triggers an Event Grid subscription to move a BlobCreated event to a queue. After that a Function App is triggered on the queue, which will fail on corrupt documents thus moving the queue item to a poison queue.

Right now it seems to move them using the default 7 day TTL, but for the poison queue I would like a TTL for forever. Is there any way to change the TTL for the poison queue in the trigger function?

What I've tried so far:

  1. Looking if the Event Grid subscription had any options to set the TTL for the queue
  2. Looking for possible options in the host.json file (in Func App)
  3. Using reflection to change the ExpirationTime in the CloudQueueMessage input desperately hoping it might be used to create the poison queue item
NotFound
  • 5,005
  • 2
  • 13
  • 33

1 Answers1

1

Right now it seems to move them using the default 7 day TTL, but for the poison queue I would like a TTL for forever. Is there any way to change the TTL for the poison queue in the trigger function?

You can set them as -1. There's more information here and here. You'll need to manually handle these. You could easily add a listener to the poison queue and re send the message with the TTL of -1.

UPDATE

Looked further into this. You can implement a custom IQueueProcessorFactory that returns a CustomQueueProcessor. The default implementation is here. You can change the way the poison queues are handled and send the TTL of -1.

lopezbertoni
  • 3,551
  • 3
  • 37
  • 53
  • 1
    Thanks, I've considered the same but it's more of a workaround than a solution. It'll also triple the requests for the poison queue and require more custom code to maintain. – NotFound Oct 27 '20 at 08:12
  • The `IQueueProcessorFactory` sounds good, although all reference material I can find on implementing (adding it to the configuration) is for Web Jobs and not Function Apps. – NotFound Oct 28 '20 at 15:48
  • @404 I know, it's a little bit unfortunate/misleading, but Azure Functions use the underlying Azure Webjobs assemblies. Microsoft.Azure.Webjobs. – lopezbertoni Oct 28 '20 at 18:15