Package org.eclipse.hono.connection
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 newConnectionFactory
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. Ifnull
default options will be used.closeHandler
- The handler to invoke when an AMQP Close frame is received from the server (may benull
).disconnectHandler
- The handler to invoke when the connection to the server is lost unexpectedly (may benull
).connectionResultHandler
- The callback to invoke with the outcome of the connection attempt.- Throws:
NullPointerException
- if the result handler isnull
.
-
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. Ifnull
default options will be used.username
- The username to use for authenticating to the server using SASL PLAIN. Ifnull
, the default username defined for this factory will be used.password
- The password to use for authenticating to the server using SASL PLAIN. Ifnull
, 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 benull
).disconnectHandler
- The handler to invoke when the connection to the server is lost unexpectedly (may benull
).connectionResultHandler
- The callback to invoke with the outcome of the connection attempt.- Throws:
NullPointerException
- if the result handler isnull
.
-
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. Ifnull
default options will be used.username
- The username to use for authenticating to the server using SASL PLAIN. Ifnull
, the default username defined for this factory will be used.password
- The password to use for authenticating to the server using SASL PLAIN. Ifnull
, the default password defined for this factory will be used.containerId
- The container id to be advertised to the remove peer. Ifnull
, a generated container id will be used.closeHandler
- The handler to invoke when an AMQP Close frame is received from the server (may benull
).disconnectHandler
- The handler to invoke when the connection to the server is lost unexpectedly (may benull
).connectionResultHandler
- The callback to invoke with the outcome of the connection attempt.- Throws:
NullPointerException
- if the result handler isnull
.
-
newConnectionFactory
static ConnectionFactory newConnectionFactory(io.vertx.core.Vertx vertx, ClientConfigProperties clientConfigProperties)
Create a newConnectionFactory
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 benull
.clientConfigProperties
- The client properties to use. Must not benull
.- 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. Ifnull
, the string 'null' will be used.serverRole
- The server role part. Ifnull
, that part will be omitted.uuid
- The unique identifier to use. Ifnull
, a random UUID will be used.- Returns:
- The container id.
-
-