[FEATURE REQ] EventProcessorClientBuilder should accept .initialPartitionEventPosition(java.util.function.Function<String, EventPosition>)
See original GitHub issueIs your feature request related to a problem? Please describe.
Allow to provide a lambda function to set .initialPartitionEventPosition(java.util.function.Function<String, EventPosition>)
when building EventProcessorClient.
Describe the solution you’d like
Currently to build EventProcessorClient
(using EventProcessorClientBuilder
) we can set .initialPartitionEventPosition()
and pass a java.util.Map<String, EventPosition>
which helps in deciding from where to start consuming events in each partition. This is more flexible, in the case when we want to start reading from different points from different partitions. But there is also a use case where users might want to start reading from the same point from each partition.
-
In the ideal case, when events are published in a round robin fashion to EventHub (which is also the recommended way), it’ll also be very common to also start reading from the same position from each of the partition of that EventHub.
-
In the current scenario, to build that Map, application has to know the number of partitions the EventHub has. Even if there are multiple consumers, each application will have to build the map considering all the partitions and use it. Allowing users to simply provide a lambda simplifies this a lot because we can just use:
.initialPartitionEventPosition((unused) -> EventPosition.earliest())
and not care about the number of paritions, the EventHub might have.
- It seems like this was present in the legacy version of SDK but removed in the new one? Link for old one: https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java/staging/azure-eventhubs-eph/apidocs/com/microsoft/azure/eventprocessorhost/EventProcessorOptions.html#setInitialPositionProvider(java.util.function.Function)
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Description Added
- Expected solution specified
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
@shubhambhattar Thanks for requesting this feature. We will look into the feasibility of supporting this feature and update the ticket when we have a plan.
Thanks for the feature request!