|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2020 the original author or authors. |
| 2 | + * Copyright 2002-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
30 | 30 | import io.rsocket.transport.netty.client.TcpClientTransport;
|
31 | 31 | import io.rsocket.transport.netty.client.WebsocketClientTransport;
|
32 | 32 | import org.reactivestreams.Publisher;
|
| 33 | +import reactor.core.Disposable; |
33 | 34 | import reactor.core.publisher.Flux;
|
34 | 35 | import reactor.core.publisher.Mono;
|
35 | 36 |
|
|
49 | 50 | * @author Brian Clozel
|
50 | 51 | * @since 5.2
|
51 | 52 | */
|
52 |
| -public interface RSocketRequester { |
| 53 | +public interface RSocketRequester extends Disposable { |
53 | 54 |
|
54 | 55 | /**
|
55 | 56 | * Return the underlying {@link RSocketClient} used to make requests with.
|
@@ -110,6 +111,27 @@ public interface RSocketRequester {
|
110 | 111 | */
|
111 | 112 | RequestSpec metadata(Object metadata, @Nullable MimeType mimeType);
|
112 | 113 |
|
| 114 | + /** |
| 115 | + * Shortcut method that delegates to the same on the underlying |
| 116 | + * {@link #rsocketClient()} in order to close the connection from the |
| 117 | + * underlying transport and notify subscribers. |
| 118 | + * @since 5.3.7 |
| 119 | + */ |
| 120 | + @Override |
| 121 | + default void dispose() { |
| 122 | + rsocketClient().dispose(); |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * Shortcut method that delegates to the same on the underlying |
| 127 | + * {@link #rsocketClient()}. |
| 128 | + * @since 5.3.7 |
| 129 | + */ |
| 130 | + @Override |
| 131 | + default boolean isDisposed() { |
| 132 | + return rsocketClient().isDisposed(); |
| 133 | + } |
| 134 | + |
113 | 135 | /**
|
114 | 136 | * Obtain a builder to create a client {@link RSocketRequester} by connecting
|
115 | 137 | * to an RSocket server.
|
|
0 commit comments