0

我正在尝试使用响应式编程处理来自 Mongodb 的变更流。下面是代码片段。它是按顺序处理每个文档的正确方法吗?

public void stream(String dbname, String collectionName) throws IOException {
        reactiveMongotemplate.changeStream(dbname, collectionName, changeStreamOptions, Document.class).subscribe(aDoc -> process(aDoc));
}

private void process(Document aDoc){
 // this will process the document which may take some time
}
4

0 回答 0