Interface CloudMessenger

  • All Known Implementing Classes:
    DefaultMessenger

    public interface CloudMessenger
    A messenger to communicate between services in CloudNet.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void sendChannelMessage​(@NotNull ChannelMessage channelMessage)
      Sends a channel message into the cluster.
      default void sendChannelMessage​(@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 void sendChannelMessage​(@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 void sendChannelMessage​(@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 void sendChannelMessage​(@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 ChannelMessage sendSingleChannelMessageQuery​(@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 the ChannelMessageReceiveEvent.
        Parameters:
        channel - the channel to identify the message, this can be anything and doesn't have to be registered
        message - the message to identify the message, this can be anything and doesn't have to be registered
        data - 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 the ChannelMessageReceiveEvent.
        Parameters:
        targetServiceInfoSnapshot - the info of the service which will receive the message
        channel - the channel to identify the message, this can be anything and doesn't have to be registered
        message - the message to identify the message, this can be anything and doesn't have to be registered
        data - 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 the ChannelMessageReceiveEvent.
        Parameters:
        targetServiceTask - the task which will receive the message
        channel - the channel to identify the message, this can be anything and doesn't have to be registered
        message - the message to identify the message, this can be anything and doesn't have to be registered
        data - 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 the ChannelMessageReceiveEvent.
        Parameters:
        targetEnvironment - the environment which will receive the message
        channel - the channel to identify the message, this can be anything and doesn't have to be registered
        message - the message to identify the message, this can be anything and doesn't have to be registered
        data - 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