Add metadataPush support to RSocketRequester

Closes gh-24322
This commit is contained in:
Rossen Stoyanchev
2020-05-14 13:54:45 +01:00
parent de378599d3
commit b1224835be
5 changed files with 116 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -248,6 +248,11 @@ final class DefaultRSocketRequester implements RSocketRequester {
.doOnDiscard(Payload.class, Payload::release);
}
@Override
public Mono<Void> sendMetadata() {
return getPayloadMono().flatMap(rsocket::metadataPush);
}
@Override
public Mono<Void> send() {
return getPayloadMono().flatMap(rsocket::fireAndForget);

View File

@@ -276,6 +276,12 @@ public interface RSocketRequester {
*/
RequestSpec metadata(Consumer<MetadataSpec<?>> configurer);
/**
* Perform a {@link RSocket#metadataPush(Payload) metadataPush}.
* @since 5.3
*/
Mono<Void> sendMetadata();
/**
* Provide payload data for the request. This can be one of:
* <ul>
@@ -344,7 +350,12 @@ public interface RSocketRequester {
interface RetrieveSpec {
/**
* Perform a {@link RSocket#fireAndForget fireAndForget}.
* Perform a {@link RSocket#fireAndForget fireAndForget} sending the
* provided data and metadata.
* @return a completion that indicates if the payload was sent
* successfully or not. Note, however that is a one-way send and there
* is no indication of whether or how the even was handled on the
* remote end.
*/
Mono<Void> send();