Java Code Examples for reactor.core.publisher.FluxSink#complete()
The following examples show how to use
reactor.core.publisher.FluxSink#complete() .
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: ExecuteSinkConsumer.java From retrofit2-reactor-adapter with Apache License 2.0 | 6 votes |
@Override public void accept(FluxSink<Response<T>> sink) { // Since Call is a one-shot type, clone it for each new subscriber. Call<T> call = originalCall.clone(); sink.onDispose(call::cancel); Response<T> response; try { response = call.execute(); } catch (IOException e) { sink.error(e); return; } sink.next(response); sink.complete(); }
Example 2
Source File: ScrolledSearch.java From james-project with Apache License 2.0 | 6 votes |
private void next(FluxSink<SearchResponse> sink, AtomicReference<Optional<String>> scrollId, long numberOfRequestedElements) { if (numberOfRequestedElements <= 0) { return; } Consumer<SearchResponse> onResponse = searchResponse -> { scrollId.set(Optional.of(searchResponse.getScrollId())); sink.next(searchResponse); boolean noHitsLeft = searchResponse.getHits().getHits().length == 0; if (noHitsLeft) { sink.complete(); } else { next(sink, scrollId, numberOfRequestedElements - 1); } }; Consumer<Throwable> onFailure = sink::error; buildRequest(scrollId.get()) .subscribe(onResponse, onFailure); }
Example 3
Source File: GrpcMetaProcessor.java From milkman with MIT License | 5 votes |
@SneakyThrows private void fetchServiceDefinition(FluxSink<String> sink, GrpcRequestContainer request, ProtoMethodName protoMethod) { ManagedChannel channel = createChannel(request); FileDescriptorSet descriptorSet = fetchServiceDescriptionViaReflection(channel, protoMethod); String protoContent = toProto(descriptorSet); sink.next(protoContent); sink.complete(); }
Example 4
Source File: GenericEvent.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@Override public void closeStream(ObjectIdentifier objectIdentifier) { FluxSink<T> sink = removeStream(objectIdentifier); if (sink != null) { sink.complete(); } }
Example 5
Source File: TcpConnectorPeer.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@Override public void apiCallComplete(long apiCallId) { FluxSink<ByteArrayInputStream> rpcSink = openRpcs.get(apiCallId); if (rpcSink == null) { errorReporter.logDebug("Unexpected API call completion received"); } else { rpcSink.complete(); } }
Example 6
Source File: FluxMethodBridge.java From titus-control-plane with Apache License 2.0 | 5 votes |
private FluxInvocation(FluxSink<Object> sink, Object[] args) { StreamObserver<Object> grpcStreamObserver = new ClientResponseObserver<Object, Object>() { @Override public void beforeStart(ClientCallStreamObserver requestStream) { sink.onCancel(() -> requestStream.cancel("React subscription cancelled", null)); } @Override public void onNext(Object value) { sink.next(value); } @Override public void onError(Throwable error) { sink.error(error); } @Override public void onCompleted() { sink.complete(); } }; Object[] grpcArgs = new Object[]{ grpcArgPos < 0 ? Empty.getDefaultInstance() : args[grpcArgPos], grpcStreamObserver }; GRPC_STUB invocationStub = handleCallMetadata(args) .withDeadline(Deadline.after(timeout.toMillis(), TimeUnit.MILLISECONDS)); try { grpcMethod.invoke(invocationStub, grpcArgs); } catch (Exception e) { sink.error(e); } }