Data Subscription with max results #14693
Replies: 3 comments 4 replies
-
Hi Ian, Can I have some more information about what you are trying to achieve? Is there a specific reason you need a subscription for this? maybe a query that takes 100 and skips each time could work for you. You can use
Currently there is no way to ask the server to only send a single batch. Another option is to get the current |
Beta Was this translation helpful? Give feedback.
-
Thanks - it needs to be a subscription rather than a query because I want to process the documents only once. I am subscribing to a stream of documents that are created at some point and do not need to be read again. Anything up to 100 is fine. I think you have given me the answer I needed: worker.AfterAcknowledgment += batch => I assume this will stop processing after one batch? |
Beta Was this translation helpful? Give feedback.
-
I guess an alternative and more traditional approach would be to force the caller to keep track of the Date / Time of the last document they received and query greater than that Date / Time and use streaming on the query. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I would like to create a Data Subscription that I can call from an API with a max number of results.
The Data Subscription would close and then be opened again the next time it's called. I need to be able to limit the number of results returned i.e. GetLatestResults(maxResults = 100)
I can see the batchSize on a subscription, but my understanding is that this controls how the data is returned from the database. I believe the database will keep sending batches until there are no more left to send.
Is there a way to tell the Data Subscription to only send a single batch?
I was thinking about throwing a SubscriptionClosed exception from inside the AfterAcknowledgement event, but I am not sure if there is a better way?
Many thanks,
Ian
Beta Was this translation helpful? Give feedback.
All reactions