reactor.fn.Consumer Java Examples
The following examples show how to use
reactor.fn.Consumer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Reactor2TcpClient.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override public Publisher<Void> apply(ChannelStream<Message<P>, Message<P>> channelStream) { Promise<Void> closePromise = Promises.prepare(); this.connectionHandler.afterConnected(new Reactor2TcpConnection<P>(channelStream, closePromise)); channelStream .finallyDo(new Consumer<Signal<Message<P>>>() { @Override public void accept(Signal<Message<P>> signal) { if (signal.isOnError()) { connectionHandler.handleFailure(signal.getThrowable()); } else if (signal.isOnComplete()) { connectionHandler.afterConnectionClosed(); } } }) .consume(new Consumer<Message<P>>() { @Override public void accept(Message<P> message) { connectionHandler.handleMessage(message); } }); return closePromise; }
Example #2
Source File: RepositoryStatisticsUpdatedReactor.java From mojito with Apache License 2.0 | 5 votes |
@PostConstruct private void createProcessor() { processor = RingBufferProcessor.create(); Stream stream = Streams.wrap(processor); stream.buffer(1, TimeUnit.SECONDS).consume(new Consumer<List<Long>>() { @Override public void accept(List<Long> repositoryIds) { for (Long repositoryId : Sets.newHashSet(repositoryIds)) { repositoryStatisticsJobScheduler.schedule(repositoryId); } } }); }
Example #3
Source File: Flow2InitializerTest.java From cloudbreak with Apache License 2.0 | 5 votes |
@Test public void testInitialize() { List<FlowConfiguration<?>> flowConfigs = new ArrayList<>(); flowConfigs.add(new HelloWorldFlowConfig()); given(this.flowConfigs.stream()).willReturn(flowConfigs.stream()); underTest.init(); verify(reactor, times(1)).on(any(Selector.class), any(Consumer.class)); }
Example #4
Source File: Reactor2StompCodec.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public Function<Buffer, Message<byte[]>> decoder(final Consumer<Message<byte[]>> messageConsumer) { return new DecodingFunction(this.stompDecoder, messageConsumer); }
Example #5
Source File: Reactor2StompCodec.java From spring4-understanding with Apache License 2.0 | 4 votes |
public DecodingFunction(StompDecoder decoder, Consumer<Message<byte[]>> next) { this.decoder = decoder; this.messageConsumer = next; }
Example #6
Source File: GpfdistCodec.java From spring-cloud-stream-app-starters with Apache License 2.0 | 4 votes |
@Override public Function<Buffer, Buffer> decoder(Consumer<Buffer> next) { return null; }