Package org.apache.qpid.protonj2.client
Interface Client
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
ClientInstance
public interface Client extends java.lang.AutoCloseableThe Container that hosts AMQP Connections
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes all currently openConnectioninstances created by this client.java.util.concurrent.Future<Client>closeAsync()Closes all currently openConnectioninstances created by this client.Connectionconnect(java.lang.String host)Connect to the specified host, using the default port, without credentials and with all connection options set to their defaults.Connectionconnect(java.lang.String host, int port)Connect to the specified host and port, without credentials and with all connection options set to their defaults.Connectionconnect(java.lang.String host, int port, ConnectionOptions options)Connect to the specified host and port, with given connection options.Connectionconnect(java.lang.String host, ConnectionOptions options)Connect to the specified host, using the default port, without credentials and with all connection options set to their defaults.java.lang.StringcontainerId()static Clientcreate()static Clientcreate(ClientOptions options)Create a newClientinstance using provided configuration options.
-
-
-
Method Detail
-
create
static Client create(ClientOptions options)
Create a newClientinstance using provided configuration options.- Parameters:
options- The configuration options to use when creating the client.- Returns:
- a new
Clientinstance configured using the provided options.
-
containerId
java.lang.String containerId()
- Returns:
- the container id assigned to this
Clientinstance.
-
close
void close()
Closes all currently openConnectioninstances created by this client.This method blocks and waits for each connection to close in turn using the configured close timeout of the
ConnectionOptionsthat the connection was created with.- Specified by:
closein interfacejava.lang.AutoCloseable
-
closeAsync
java.util.concurrent.Future<Client> closeAsync()
Closes all currently openConnectioninstances created by this client.This method blocks and waits for each connection to be closed in turn using the configured close timeout of the
ConnectionOptionsthat the connection was created with.- Returns:
- a
Futurethat will be completed when all open connections have closed.
-
connect
Connection connect(java.lang.String host, int port) throws ClientException
Connect to the specified host and port, without credentials and with all connection options set to their defaults.- Parameters:
host- the host to connect toport- the port to connect to- Returns:
- connection, establishment not yet completed
- Throws:
ClientException- if theClientis closed or an error occurs during connect.
-
connect
Connection connect(java.lang.String host, int port, ConnectionOptions options) throws ClientException
Connect to the specified host and port, with given connection options.- Parameters:
host- the host to connect toport- the port to connect tooptions- options to use when creating the connection.- Returns:
- connection, establishment not yet completed
- Throws:
ClientException- if theClientis closed or an error occurs during connect.
-
connect
Connection connect(java.lang.String host) throws ClientException
Connect to the specified host, using the default port, without credentials and with all connection options set to their defaults.- Parameters:
host- the host to connect to- Returns:
- connection, establishment not yet completed
- Throws:
ClientException- if theClientis closed or an error occurs during connect.
-
connect
Connection connect(java.lang.String host, ConnectionOptions options) throws ClientException
Connect to the specified host, using the default port, without credentials and with all connection options set to their defaults.- Parameters:
host- the host to connect tooptions- options to use when creating the connection.- Returns:
- connection, establishment not yet completed
- Throws:
ClientException- if theClientis closed or an error occurs during connect.
-
-