T - the channel message typepublic interface Channel<T> extends TypeAware<T>
Channels can be subscribed to through a ChannelAgent.
| Modifier and Type | Method and Description |
|---|---|
Codec<T> |
getCodec()
Gets the channels codec.
|
String |
getName()
Gets the name of the channel.
|
com.google.common.reflect.TypeToken<T> |
getType()
Gets the channels message type.
|
ChannelAgent<T> |
newAgent()
Creates a new
ChannelAgent for this channel. |
default ChannelAgent<T> |
newAgent(ChannelListener<T> listener)
Creates a new
ChannelAgent for this channel, and immediately
adds the given ChannelListener to it. |
Promise<Void> |
sendMessage(T message)
Sends a new message to the channel.
|
@Nonnull ChannelAgent<T> newAgent()
ChannelAgent for this channel.@Nonnull default ChannelAgent<T> newAgent(ChannelListener<T> listener)
ChannelAgent for this channel, and immediately
adds the given ChannelListener to it.listener - the listener to register@Nonnull Promise<Void> sendMessage(@Nonnull T message)
This method will return immediately, and the future will be completed once the message has been sent.
message - the message to dispatchCopyright © 2022. All rights reserved.