Interface MessageChannel<P extends ChannelPayload>
- Type Parameters:
P- the type of payload handled by this channel
public interface MessageChannel<P extends ChannelPayload>
Communication pipe for sending and receiving
ChannelPayloads.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceMessageChannel.Sender<P extends ChannelPayload>A target-bound sender for dispatching payloads. -
Method Summary
Modifier and TypeMethodDescriptionlisten(MessageListener<P> listener) Subscribes a listener to messages received on this channel.to(Collection<Platform.ServerTarget> targets) Targets one or more servers for sending.toAll()Targets all connected servers for sending.
-
Method Details
-
to
Targets one or more servers for sending.- Parameters:
targets- the destination servers- Returns:
- a sender scoped to the given targets
-
toAll
MessageChannel.Sender<P> toAll()Targets all connected servers for sending.- Returns:
- a sender that broadcasts to every connected server
-
listen
Subscribes a listener to messages received on this channel.- Parameters:
listener- the listener to call for incoming messages- Returns:
- a subscription handle to cancel the listener
-