Interface ConnectionFactory

  • All Known Implementing Classes:
    ConnectionFactoryImpl

    public interface ConnectionFactory
    A factory for AMQP 1.0 connections.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void connect​(io.vertx.proton.ProtonClientOptions options, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> closeHandler, io.vertx.core.Handler<io.vertx.proton.ProtonConnection> disconnectHandler, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> connectionResultHandler)
      Connects to a server.
      void connect​(io.vertx.proton.ProtonClientOptions options, String username, String password, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> closeHandler, io.vertx.core.Handler<io.vertx.proton.ProtonConnection> disconnectHandler, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> connectionResultHandler)
      Connects to a server.
      void connect​(io.vertx.proton.ProtonClientOptions options, String username, String password, String containerId, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> closeHandler, io.vertx.core.Handler<io.vertx.proton.ProtonConnection> disconnectHandler, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> connectionResultHandler)
      Connects to a server.
      static String createContainerId​(String name, String serverRole, UUID uuid)
      Creates a container id to be advertised to the remote peer.
      String getHost()
      Gets the host name of the server that this factory creates connections to.
      String getPathSeparator()
      Gets the character sequence that the server uses for separating path components of target addresses.
      int getPort()
      Gets the port of the server that this factory creates connections to.
      default String getServerRole()
      Gets the name of the role that the server plays from the client's perspective.
      static ConnectionFactory newConnectionFactory​(io.vertx.core.Vertx vertx, ClientConfigProperties clientConfigProperties)
      Create a new ConnectionFactory using the default implementation.
    • Method Detail

      • getHost

        String getHost()
        Gets the host name of the server that this factory creates connections to.
        Returns:
        The host name or literal IP address.
      • getPort

        int getPort()
        Gets the port of the server that this factory creates connections to.
        Returns:
        The port number.
      • getPathSeparator

        String getPathSeparator()
        Gets the character sequence that the server uses for separating path components of target addresses.
        Returns:
        The path separator.
      • getServerRole

        default String getServerRole()
        Gets the name of the role that the server plays from the client's perspective.
        Returns:
        The name or null if not set.
      • connect

        void connect​(io.vertx.proton.ProtonClientOptions options,
                     io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> closeHandler,
                     io.vertx.core.Handler<io.vertx.proton.ProtonConnection> disconnectHandler,
                     io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> connectionResultHandler)
        Connects to a server.
        Parameters:
        options - The client options to use for connecting. If null default options will be used.
        closeHandler - The handler to invoke when an AMQP Close frame is received from the server (may be null).
        disconnectHandler - The handler to invoke when the connection to the server is lost unexpectedly (may be null).
        connectionResultHandler - The callback to invoke with the outcome of the connection attempt.
        Throws:
        NullPointerException - if the result handler is null.
      • connect

        void connect​(io.vertx.proton.ProtonClientOptions options,
                     String username,
                     String password,
                     io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> closeHandler,
                     io.vertx.core.Handler<io.vertx.proton.ProtonConnection> disconnectHandler,
                     io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> connectionResultHandler)
        Connects to a server.
        Parameters:
        options - The client options to use for connecting. If null default options will be used.
        username - The username to use for authenticating to the server using SASL PLAIN. If null, the default username defined for this factory will be used.
        password - The password to use for authenticating to the server using SASL PLAIN. If null, the default password defined for this factory will be used.
        closeHandler - The handler to invoke when an AMQP Close frame is received from the server (may be null).
        disconnectHandler - The handler to invoke when the connection to the server is lost unexpectedly (may be null).
        connectionResultHandler - The callback to invoke with the outcome of the connection attempt.
        Throws:
        NullPointerException - if the result handler is null.
      • connect

        void connect​(io.vertx.proton.ProtonClientOptions options,
                     String username,
                     String password,
                     String containerId,
                     io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> closeHandler,
                     io.vertx.core.Handler<io.vertx.proton.ProtonConnection> disconnectHandler,
                     io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.proton.ProtonConnection>> connectionResultHandler)
        Connects to a server.
        Parameters:
        options - The client options to use for connecting. If null default options will be used.
        username - The username to use for authenticating to the server using SASL PLAIN. If null, the default username defined for this factory will be used.
        password - The password to use for authenticating to the server using SASL PLAIN. If null, the default password defined for this factory will be used.
        containerId - The container id to be advertised to the remove peer. If null, a generated container id will be used.
        closeHandler - The handler to invoke when an AMQP Close frame is received from the server (may be null).
        disconnectHandler - The handler to invoke when the connection to the server is lost unexpectedly (may be null).
        connectionResultHandler - The callback to invoke with the outcome of the connection attempt.
        Throws:
        NullPointerException - if the result handler is null.
      • newConnectionFactory

        static ConnectionFactory newConnectionFactory​(io.vertx.core.Vertx vertx,
                                                      ClientConfigProperties clientConfigProperties)
        Create a new ConnectionFactory using the default implementation.

        Note: Instances of ClientConfigProperties are not thread safe and not immutable. They must not be modified after calling this method.

        Parameters:
        vertx - The vertx instance to use. Must not be null.
        clientConfigProperties - The client properties to use. Must not be null.
        Returns:
        A new instance of a connection factory.
      • createContainerId

        static String createContainerId​(String name,
                                        String serverRole,
                                        UUID uuid)
        Creates a container id to be advertised to the remote peer.
        Parameters:
        name - The name part. If null, the string 'null' will be used.
        serverRole - The server role part. If null, that part will be omitted.
        uuid - The unique identifier to use. If null, a random UUID will be used.
        Returns:
        The container id.