4

I have an Azure Function that listens for messages in an Event Hub. The function takes messages from the Event Hub, processes them, and passes them to another Hub. At this point the messages are removed from the Event Hub.

If the Function fails processing the message for whatever reason, is it possible to tell the Event Hub to not remove the message, and to try to deliver it to the Function again at some point in the future?

I understand that the Event Hubs have a maximum retention period of 7 days. I would like for the Event Hub & Function to continue trying during that period.

DaveDev
  • 41,155
  • 72
  • 223
  • 385

1 Answers1

0

Readers never "remove" messages from an Event Hub. They are different from Service Bus Topics and Queues in this.

Event Hubs rely on clients to maintain their own bookmarks for each partition. The high-level API EventProcessorHost does this for you:

The EventProcessorHost class also implements an Azure storage-based checkpointing mechanism. This mechanism stores the offset on a per partition basis, so that each consumer can determine what the last checkpoint from the previous consumer was.

But the lower-level EventHubReceiver exposes the StartingSequenceNumber property for you to control this explicitly.

However a desire for guaranteed delivery strongly suggests that you may want to copy the messages requiring guaranteed delivery from an Event Hub to a Service Bus Topic or Queue or perhaps an Azure SQL Database table for processing.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67