Interface ExtensionMain


public interface ExtensionMain
The main starting point for each HiveMQ extension.

Each extension must implement at least this interface. The implementation of this interface is used by HiveMQ to load and enable/disable an extension.

Since:
4.0.0, CE 2019.1
  • Method Details

    • extensionStart

      void extensionStart​(@NotNull ExtensionStartInput extensionStartInput, @NotNull ExtensionStartOutput extensionStartOutput)
      This method is called by HiveMQ if an extension is enabled.

      It can be used to setup the extension and register client interceptors and callbacks with HiveMQ.

      If this method returns HiveMQ assumes that this extension is finished starting up.

      There are multiple options when this method can be called by HiveMQ:

      • When HiveMQ starts up
      • When the extension is enabled at runtime due to an administrative action
      It is possible to abort the extension start if the extension isn't ready for use (i.e. missing configuration file) with ExtensionStartOutput.preventExtensionStartup(String).

      CAUTION: since 4.4.1, CE 2020.5: This method blocks the HiveMQ start. Please make sure that your implementation will always return.

      Parameters:
      extensionStartInput - A ExtensionStartInput.
      extensionStartOutput - A ExtensionStartOutput.
      Since:
      4.0.0, CE 2019.1
    • extensionStop

      void extensionStop​(@NotNull ExtensionStopInput extensionStopInput, @NotNull ExtensionStopOutput extensionStopOutput)
      This method is called by HiveMQ if an extension is disabled.

      It can be used to shut down the extension.

      Interceptors, Authorizer and Authenticator from this extension are automatically de-registered by HiveMQ and do not need to be de-registered manually.

      If this method returns HiveMQ assumes that this extension is finished shutting down.

      There are multiple options when this method can be called by HiveMQ:

      • When HiveMQ shuts down
      • When the extension is disabled at runtime due to an administrative action
      Parameters:
      extensionStopInput - A ExtensionStartInput
      extensionStopOutput - A ExtensionStartOutput
      Since:
      4.0.0, CE 2019.1