Class MqttPlugin

All Implemented Interfaces:
MBeanService, HttpCertificateProvider, Runnable

public class MqttPlugin extends PluginThread implements HttpCertificateProvider
The Class MqttPlugin.
  • Constructor Details

    • MqttPlugin

      public MqttPlugin(String ref, Map<String,String> params)
      Instantiates a new http plugin.
      Parameters:
      ref - the ref
      params - the params
  • Method Details

    • getPluginName

      public String getPluginName()
      Gets the plugin name. Gets the plugin name.
      Specified by:
      getPluginName in class PluginThread
      Returns:
      the plugin name
    • getVersion

      public String getVersion()
      Gets the version. Gets the version.
      Specified by:
      getVersion in class PluginThread
      Returns:
      the version
    • getListeningPorts

      public List<Integer> getListeningPorts()
      Gets the port(s) this plugin is actually listening on, read directly from the plugin's own live state (as opposed to re-deriving it from configuration by plugin ref/name, which is fragile and breaks whenever a plugin's configuration section name differs from what a caller assumes). Subclasses that open one or more network listeners should override this to return their actual bound port(s); the default returns an empty list, meaning "no listening port to report" (e.g. a plugin with no network listener of its own). Returns the mqtt and/or mqtts port(s) this plugin is actually listening on, read directly from this plugin's own live state (populated once start() has successfully started) rather than re-derived from configuration elsewhere.
      Overrides:
      getListeningPorts in class PluginThread
      Returns:
      the listening port(s), or an empty list if none/not applicable
    • start

      public boolean start()
      Start. Start.
      Specified by:
      start in class PluginThread
      Returns:
      true, if successful
    • stop

      public void stop()
      Stop. Stop.
      Specified by:
      stop in class PluginThread
    • buildCertificateJson

      public String buildCertificateJson()
      Returns a JSON-encoded snapshot of the TLS certificate currently loaded by this plugin's HTTPS server, or "{}" if no certificate is available.
      Specified by:
      buildCertificateJson in interface HttpCertificateProvider
      Returns:
      JSON string; never null
    • deployCertificate

      public void deployCertificate(byte[] pkcs12Bytes, String keystorePassword) throws Exception
      Deploys a new PKCS#12 keystore to this plugin's HTTPS server and hot-reloads the certificate without restarting the server (where supported).
      Specified by:
      deployCertificate in interface HttpCertificateProvider
      Parameters:
      pkcs12Bytes - the PKCS#12 keystore bytes
      keystorePassword - password for the keystore and private key
      Throws:
      Exception - if the deployment or reload fails
    • reloadCertificate

      public void reloadCertificate() throws Exception
      Description copied from interface: HttpCertificateProvider
      Hot-reloads the TLS certificate from the keystore file currently on disk, without requiring a new keystore to be uploaded. Use this after replacing the keystore file via automation or a secrets manager.
      Specified by:
      reloadCertificate in interface HttpCertificateProvider
      Throws:
      Exception - if the reload fails