Interface ClusterDiscoveryCallback


  • public interface ClusterDiscoveryCallback
    This callback is meant to regularly discover the addresses of all available HiveMQ cluster nodes.

    Note: Extension discovery is only used by HiveMQ if <discovery> is set to <extension> in the <cluster> section of the HiveMQ config file.

    Since:
    4.0.0, CE 2019.1
    • Method Detail

      • init

        void init​(@NotNull ClusterDiscoveryInput clusterDiscoveryInput,
                  @NotNull ClusterDiscoveryOutput clusterDiscoveryOutput)
        This method is called once by HiveMQ when this callback is added via ClusterService.addDiscoveryCallback(ClusterDiscoveryCallback).

        It can be used to register this HiveMQ instance with some kind of central registry or to save it to a database or file server for example.

        Parameters:
        clusterDiscoveryInput - The object providing input information for cluster discovery.
        clusterDiscoveryOutput - The object for providing output information for cluster discovery, e.g. the addresses of all HiveMQ cluster nodes.
        Since:
        4.0.0, CE 2019.1
      • reload

        void reload​(@NotNull ClusterDiscoveryInput clusterDiscoveryInput,
                    @NotNull ClusterDiscoveryOutput clusterDiscoveryOutput)
        This method is called regularly by HiveMQ to discover all current available cluster nodes.

        The interval between calls to this method is 60 seconds by default and can be overwritten by an individual ClusterDiscoveryCallback via ClusterDiscoveryOutput.setReloadInterval(int).

        Parameters:
        clusterDiscoveryInput - The object providing input information for cluster discovery.
        clusterDiscoveryOutput - The object for providing output information for cluster discovery, e.g. the addresses of all HiveMQ cluster nodes.
        Since:
        4.0.0, CE 2019.1
      • destroy

        void destroy​(@NotNull ClusterDiscoveryInput clusterDiscoveryInput)
        This method is called once by HiveMQ in one of the following cases:

        It can be used to unregister this HiveMQ instance from a central registry.

        Parameters:
        clusterDiscoveryInput - The object providing input information for cluster discovery.
        Since:
        4.0.0, CE 2019.1