【发布时间】:2021-04-14 17:34:01
【问题描述】:
我正在尝试在 ignite 连续查询中接收数据,并通过 rsocket 请求流向客户端发送流数据。连续查询的代码块是这样的:
ContinuousQuery<String, BinaryObject> query = new ContinuousQuery<>();
query.setLocalListener(new CacheEntryUpdatedListener<String, BinaryObject>() {
@Override
public void onUpdated(Iterable<CacheEntryEvent<? extends String, ? extends BinaryObject>> events)
throws CacheEntryListenerException {
// react to the update events here
events.forEach(cacheEntryEvent -> {
SampleResponse sampleResponse= createResponse(cacheEntryEvent.getValue());
});
}
});
igniteCache.query(query);
此代码在 Spring Boot 服务中。我想知道将 sampleResponse 发送到控制器类中的 rsocket,如下所示:
@MessageMapping("marketData.stream")
public Flux<SampleResponse> responseStream(@Header("jwt") String jwt, SampleRequest request) {
// the method which contains the continuous query
return Flux.push(service.processStream(request));
}
如何通知 rsocket 发送在 ignite 连续查询的 onUpdate 方法中创建的消息?
【问题讨论】: