Class Server


  • public class Server
    extends Object
    • Constructor Detail

      • Server

        public Server()
    • Method Detail

      • startServer

        public void startServer()
                         throws IOException
        Starts Moquette bringing the configuration from the file located at m_config/moquette.conf
        Throws:
        IOException - in case of any IO error.
      • startServer

        public void startServer​(File configFile)
                         throws IOException
        Starts Moquette bringing the configuration from the given file
        Parameters:
        configFile - text file that contains the configuration.
        Throws:
        IOException - in case of any IO Error.
      • startServer

        public void startServer​(Properties configProps)
                         throws IOException
        Starts the integration with the given properties.

        Its suggested to at least have the following properties:

        • port
        • password_file
        Parameters:
        configProps - the properties map to use as configuration.
        Throws:
        IOException - in case of any IO Error.
      • startServer

        public void startServer​(IConfig config)
                         throws IOException
        Starts Moquette bringing the configuration files from the given Config implementation.
        Parameters:
        config - the configuration to use to start the broker.
        Throws:
        IOException - in case of any IO Error.
      • startServer

        public void startServer​(IConfig config,
                                List<? extends InterceptHandler> handlers)
                         throws IOException
        Starts Moquette with config provided by an implementation of IConfig class and with the set of InterceptHandler.
        Parameters:
        config - the configuration to use to start the broker.
        handlers - the handlers to install in the broker.
        Throws:
        IOException - in case of any IO Error.
      • internalPublish

        public void internalPublish​(io.netty.handler.codec.mqtt.MqttPublishMessage msg,
                                    String clientId)
        Use the broker to publish a message. It's intended for embedding applications. It can be used only after the integration is correctly started with startServer.
        Parameters:
        msg - the message to forward. The ByteBuf in the message will be released.
        clientId - the id of the sending integration.
        Throws:
        IllegalStateException - if the integration is not yet started
      • stopServer

        public void stopServer()
      • getPort

        public int getPort()
      • getSslPort

        public int getSslPort()
      • addInterceptHandler

        public void addInterceptHandler​(InterceptHandler interceptHandler)
        SPI method used by Broker embedded applications to add intercept handlers.
        Parameters:
        interceptHandler - the handler to add.
      • removeInterceptHandler

        public void removeInterceptHandler​(InterceptHandler interceptHandler)
        SPI method used by Broker embedded applications to remove intercept handlers.
        Parameters:
        interceptHandler - the handler to remove.
      • listConnectedClients

        public Collection<ClientDescriptor> listConnectedClients()
        Return a list of descriptors of connected clients.