After going through Cosmos db documentation I am a bit confused about the change feed processor library.
- Lease document exists for each physical partition or logical partition?
- If I only have one host with multiple logical partition and a single physical partition. Will the change feed processor utilize multiple threads for each logical partition. I have cosmos change feed processor library implemented like this.
var changeFeedProcessorInstance = new ChangeFeedProcessorBuilder()
.options(cfOptions)
.hostName(hostName)
.feedContainer(container)
.leaseContainer(leaseContainer)
.handleChanges((List<JsonNode> docs) -> {
for (JsonNode document : docs) {
// Doing some processing
}
})
.buildChangeFeedProcessor();
changeFeedProcessorInstance.start()
.subscribeOn(Schedulers.elastic())
.doOnSuccess(aVoid -> {
})
.subscribe();
My assumption is due to Scheduler.elastic a new thread can be utilized per logical partition basis.