Search code examples
c#.netazureazure-eventhub

How would I consume Azure Event Hubs without any checkpointing?


I want to publish events through an Azure Event Hub. For example stock quotes. I have an application that is interested in using the last consumed quote per stock symbol. I'm not interested in quotes older than 5 minutes.

My plan was to have a consumer in-memory (singleton) and inject it where-ever I need quotes. Every instance of my application would then be reading all events, starting the stream 5 minutes into the past and keep track of the last quote per symbol. I wanted to use something like EventProcessorClient from the SDK. However, that requires a BlobContainerClient to store checkpointing information. I don't want checkpoints, I don't want the different instances of my app to claim ownership of partitions, I want all instances to receive all messages.

So I now have a solution with a custom PluggableCheckpointStoreEventProcessor and an in-memory CheckpointStore, but this feels like I'm doing it wrong. Is there a simpler way?


Solution

  • The short version of this is "don't write checkpoints in your application and you'll have no checkpoints."

    To expand a bit, the processor requires that you provide a checkpoint store that can be used for coordination between processor instances to share work and storage of checkpoints. If you do not have a common durable storage backing the processor and you attempt to use multiple nodes, they will not coordinate and will fight over control of partitions.

    Checkpoints are only written when the application explicitly asks for one. There are no implicit checkpoints created on your behalf. If you don't want to use checkpoints, just avoid calling UpdateCheckpointAsync and none will exist.