@Override public void accept(long n) throws Exception { final AtomicLong counter = new AtomicLong(n); RFuture<Integer> t = topic.addListenerAsync(type, new MessageListener<M>() { @Override public void onMessage(CharSequence channel, M msg) {
@Override public void accept(long n) throws Exception { final AtomicLong counter = new AtomicLong(n); RFuture<Integer> t = topic.addListenerAsync(type, new MessageListener<M>() { @Override public void onMessage(CharSequence channel, M msg) {
commandExecutor, disabledAckName); topics.add(topic); RFuture<Integer> topicFuture = topic.addListenerAsync(Object.class, new MessageListener<Object>() { @Override public void onMessage(CharSequence channel, Object msg) {
commandExecutor, disabledAckName); topics.add(topic); RFuture<Integer> topicFuture = topic.addListenerAsync(Object.class, new MessageListener<Object>() { @Override public void onMessage(CharSequence channel, Object msg) {
@Override public void accept(long n) throws Exception { final AtomicLong counter = new AtomicLong(n); RFuture<Integer> t = topic.addListenerAsync(type, new MessageListener<M>() { @Override public void onMessage(CharSequence channel, M msg) {
commandExecutor, disabledAckName); topics.add(topic); RFuture<Integer> topicFuture = topic.addListenerAsync(Object.class, new MessageListener<Object>() { @Override public void onMessage(CharSequence channel, Object msg) {
public <M> Flux<M> getMessages(Class<M> type) { return Flux.<M>create(emitter -> { emitter.onRequest(n -> { AtomicLong counter = new AtomicLong(n); RFuture<Integer> t = topic.addListenerAsync(type, new MessageListener<M>() { @Override public void onMessage(CharSequence channel, M msg) { emitter.next(msg); if (counter.decrementAndGet() == 0) { topic.removeListenerAsync(this); emitter.complete(); } } }); t.whenComplete((id, e) -> { if (e != null) { emitter.error(e); return; } emitter.onDispose(() -> { topic.removeListenerAsync(id); }); }); }); }); }