public interface Sender
Sender sender = ctx.getSender();
Flux.fromCallable(...)
.subscribe(new Subscriber () {
onSubscribe(Subscription s) {
this.subscription = s;
this.subscription.request(1);
}
onNext(Object next) {
sender.write(next, (ctx, cause) -> {
subscription.request(1);
});
}
onError(Throwable error) {
subscription.cancel();
}
onComplete() {
sender.close();
}
})
Modifier and Type | Interface and Description |
---|---|
static interface |
Sender.Callback
Write callback.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the sender.
|
Sender |
write(byte[] data,
Sender.Callback callback)
Write a bytes chunk.
|
default Sender |
write(String data,
Charset charset,
Sender.Callback callback)
Write a string chunk.
|
default Sender |
write(String data,
Sender.Callback callback)
Write a string chunk.
|
@Nonnull default Sender write(@Nonnull String data, @Nonnull Sender.Callback callback)
data
- String chunk.callback
- Callback.@Nonnull default Sender write(@Nonnull String data, @Nonnull Charset charset, @Nonnull Sender.Callback callback)
data
- String chunk.charset
- Charset.callback
- Callback.@Nonnull Sender write(@Nonnull byte[] data, @Nonnull Sender.Callback callback)
data
- Bytes chunk.callback
- Callback.void close()
Copyright © 2020. All rights reserved.