Reputation: 179
I have Reactor
hot stream which polls Redis
using reactive Lettuce API
:
Flux
.generate(sink -> sink.next(0))
.flatMap(
r -> pollingConnection
.reactive()
.brpop(pollingTimeout, queue)
...
.subscribe(subscription);
Is there a way to do it without flatMap
? Any async sinks?
Upvotes: 1
Views: 342
Reputation: 28301
for regular non-blocking polling, I guess you would better off using Flux.interval
rather than Flux.generate
(which, combined to flatMap
, will generate 256 immediate requests btw)
since the API seems to be based on a brpop
Publisher
, you don't have much choice but using flatMap
if you want to trigger multiple pops.
Upvotes: 1