Interface CloudMessenger
-
- All Known Implementing Classes:
DefaultMessenger
public interface CloudMessengerA messenger to communicate between services in CloudNet.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidsendChannelMessage(@NotNull ChannelMessage channelMessage)Sends a channel message into the cluster.default voidsendChannelMessage(@NotNull ServiceEnvironmentType targetEnvironment, @NotNull java.lang.String channel, @NotNull java.lang.String message, @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument data)Sends a channel message to all services of a specific environment in the cluster.default voidsendChannelMessage(@NotNull ServiceInfoSnapshot targetServiceInfoSnapshot, @NotNull java.lang.String channel, @NotNull java.lang.String message, @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument data)Sends a channel message to a specific service in the cluster.default voidsendChannelMessage(@NotNull ServiceTask targetServiceTask, @NotNull java.lang.String channel, @NotNull java.lang.String message, @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument data)Sends a channel message to all services of a specific task in the cluster.default voidsendChannelMessage(@NotNull java.lang.String channel, @NotNull java.lang.String message, @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument data)Sends a channel message to all services and nodes in the cluster.@NotNull java.util.Collection<ChannelMessage>sendChannelMessageQuery(@NotNull ChannelMessage channelMessage)Sends a channel message into the cluster and waits for the result from the receivers.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<ChannelMessage>>sendChannelMessageQueryAsync(@NotNull ChannelMessage channelMessage)Sends a channel message into the cluster and waits for the result from the receivers.@Nullable ChannelMessagesendSingleChannelMessageQuery(@NotNull ChannelMessage channelMessage)Sends a channel message into the cluster and waits for the result from the receivers.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<ChannelMessage>sendSingleChannelMessageQueryAsync(@NotNull ChannelMessage channelMessage)Sends a channel message into the cluster and waits for the result from the receivers.
-
-
-
Method Detail
-
sendChannelMessage
default void sendChannelMessage(@NotNull @NotNull java.lang.String channel, @NotNull @NotNull java.lang.String message, @NotNull @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument data)Sends a channel message to all services and nodes in the cluster. It can be received with theChannelMessageReceiveEvent.- Parameters:
channel- the channel to identify the message, this can be anything and doesn't have to be registeredmessage- the message to identify the message, this can be anything and doesn't have to be registereddata- extra data for the message
-
sendChannelMessage
default void sendChannelMessage(@NotNull @NotNull ServiceInfoSnapshot targetServiceInfoSnapshot, @NotNull @NotNull java.lang.String channel, @NotNull @NotNull java.lang.String message, @NotNull @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument data)Sends a channel message to a specific service in the cluster. It can be received with theChannelMessageReceiveEvent.- Parameters:
targetServiceInfoSnapshot- the info of the service which will receive the messagechannel- the channel to identify the message, this can be anything and doesn't have to be registeredmessage- the message to identify the message, this can be anything and doesn't have to be registereddata- extra data for the message
-
sendChannelMessage
default void sendChannelMessage(@NotNull @NotNull ServiceTask targetServiceTask, @NotNull @NotNull java.lang.String channel, @NotNull @NotNull java.lang.String message, @NotNull @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument data)Sends a channel message to all services of a specific task in the cluster. It can be received with theChannelMessageReceiveEvent.- Parameters:
targetServiceTask- the task which will receive the messagechannel- the channel to identify the message, this can be anything and doesn't have to be registeredmessage- the message to identify the message, this can be anything and doesn't have to be registereddata- extra data for the message
-
sendChannelMessage
default void sendChannelMessage(@NotNull @NotNull ServiceEnvironmentType targetEnvironment, @NotNull @NotNull java.lang.String channel, @NotNull @NotNull java.lang.String message, @NotNull @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument data)Sends a channel message to all services of a specific environment in the cluster. It can be received with theChannelMessageReceiveEvent.- Parameters:
targetEnvironment- the environment which will receive the messagechannel- the channel to identify the message, this can be anything and doesn't have to be registeredmessage- the message to identify the message, this can be anything and doesn't have to be registereddata- extra data for the message
-
sendChannelMessage
void sendChannelMessage(@NotNull @NotNull ChannelMessage channelMessage)Sends a channel message into the cluster.- Parameters:
channelMessage- the channel message to be sent
-
sendChannelMessageQueryAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<ChannelMessage>> sendChannelMessageQueryAsync(@NotNull @NotNull ChannelMessage channelMessage)
Sends a channel message into the cluster and waits for the result from the receivers.- Parameters:
channelMessage- the channel message to be sent- Returns:
- a collection containing the responses from all receivers
-
sendChannelMessageQuery
@NotNull @NotNull java.util.Collection<ChannelMessage> sendChannelMessageQuery(@NotNull @NotNull ChannelMessage channelMessage)
Sends a channel message into the cluster and waits for the result from the receivers.- Parameters:
channelMessage- the channel message to be sent- Returns:
- a collection containing the responses from all receivers
-
sendSingleChannelMessageQueryAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<ChannelMessage> sendSingleChannelMessageQueryAsync(@NotNull @NotNull ChannelMessage channelMessage)
Sends a channel message into the cluster and waits for the result from the receivers. This method only returns the first of all received messages.- Parameters:
channelMessage- the channel message to be sent- Returns:
- the response of the first receiver
-
sendSingleChannelMessageQuery
@Nullable @Nullable ChannelMessage sendSingleChannelMessageQuery(@NotNull @NotNull ChannelMessage channelMessage)
Sends a channel message into the cluster and waits for the result from the receivers. This method only returns the first of all received messages.- Parameters:
channelMessage- the channel message to be sent- Returns:
- the response of the first receiver
-
-