public interface GrpcChannelFactory extends AutoCloseable
Channel
s for a given service name. Implementations are encouraged to utilize
connection pooling and thus close
should be called before disposing it.Modifier and Type | Method and Description |
---|---|
void |
close() |
default Channel |
createChannel(String name)
Creates a new channel for the given service name.
|
default Channel |
createChannel(String name,
List<ClientInterceptor> interceptors)
Creates a new channel for the given service name.
|
Channel |
createChannel(String name,
List<ClientInterceptor> interceptors,
boolean sortInterceptors)
Creates a new channel for the given service name.
|
default Map<String,ConnectivityState> |
getConnectivityState()
Gets an unmodifiable map that contains the names of the created channel with their current
ConnectivityState . |
default Channel createChannel(String name)
ClientInterceptor
s.
Note: The underlying implementation might reuse existing ManagedChannel
s allow connection reuse.
name
- The name of the service.default Channel createChannel(String name, List<ClientInterceptor> interceptors)
ClientInterceptor
s.
Note: The underlying implementation might reuse existing ManagedChannel
s allow connection reuse.
Note: The given interceptors will be appended to the global interceptors and applied using
ClientInterceptors.interceptForward(Channel, ClientInterceptor...)
.
name
- The name of the service.interceptors
- A list of additional client interceptors that should be added to the channel.Channel createChannel(String name, List<ClientInterceptor> interceptors, boolean sortInterceptors)
ClientInterceptor
s.
Note: The underlying implementation might reuse existing ManagedChannel
s allow connection reuse.
Note: The given interceptors will be appended to the global interceptors and applied using
ClientInterceptors.interceptForward(Channel, ClientInterceptor...)
.
name
- The name of the service.interceptors
- A list of additional client interceptors that should be added to the channel.sortInterceptors
- Whether the interceptors (both global and custom) should be sorted before being applied.default Map<String,ConnectivityState> getConnectivityState()
ConnectivityState
. This method will return an empty map, if the feature is not supported.void close()
close
in interface AutoCloseable