【发布时间】:2018-08-16 11:32:52
【问题描述】:
我正在使用 spring webflux + mongodb。当返回一个合并多个通量的更复杂的方法时,我遇到了通量永远不会完成的问题(http 客户端被卡住等待)。
在尝试重现时,问题似乎如下:
someRepository.findAll().subscribe([etc...]); 尽管数据库中有 15228 个实体,但始终准确地发出 3855 个实体。未播放完整信号。 使用 coreSubscriber 时,gc 运行时订阅者将被垃圾回收,这意味着基本上没有任何东西仍在排队。
有人知道这个问题的原因和/或解决方法吗?
(测试在 spring-boot-starter-data-mongodb-reactive 2.0.0.RELEASE、2.0.3.RELEASE 和 2.0.4.RELEASE 版本中 100% 发生,假设发生在中间的版本也是。Mongo 版本:4.0.0)
编辑:相关代码:
public interface LocationRepository extends ReactiveMongoRepository<Location, String> {}
和
locationRepository.findAll().subscribe(result -> log.info("RESULT "+result), error -> log.info("ERROR"+error),() -> log.info("DONE"));
【问题讨论】:
-
请包含相关的代码。以目前的形式,您的问题很难回答。
-
@Hintham 所需的所有代码基本上都已存在。添加了所需的两行,数据库数据似乎有问题。
标签: java spring mongodb spring-webflux reactive