Package org.springframework.amqp.client
Class SingleAmqpConnectionFactory
java.lang.Object
org.springframework.amqp.client.SingleAmqpConnectionFactory
- All Implemented Interfaces:
AmqpConnectionFactory,DisposableBean
public class SingleAmqpConnectionFactory
extends Object
implements AmqpConnectionFactory, DisposableBean
The
AmqpConnectionFactory implementation to hold a single, shared Connection instance.
If instance is created without a Client, a default client is used internally.- Since:
- 4.1
- Author:
- Artem Bilan
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance based on adefault client.SingleAmqpConnectionFactory(org.apache.qpid.protonj2.client.Client protonClient) Create an instance based on the providedClient. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()org.apache.qpid.protonj2.client.ConnectionsetConnectionOptions(org.apache.qpid.protonj2.client.ConnectionOptions connectionOptions) Set aConnectionOptionsinstance.setPassword(String password) Set the password for the AMQP connection.setPort(int port) setReconnectOptions(org.apache.qpid.protonj2.client.ReconnectOptions reconnectOptions) Set theReconnectOptionsfor the AMQP connection.setUsername(String username) Set the username for the AMQP connection.
-
Constructor Details
-
SingleAmqpConnectionFactory
public SingleAmqpConnectionFactory()Create an instance based on adefault client. -
SingleAmqpConnectionFactory
public SingleAmqpConnectionFactory(org.apache.qpid.protonj2.client.Client protonClient) Create an instance based on the providedClient.- Parameters:
protonClient- the client to use.
-
-
Method Details
-
setHost
-
setPort
-
setUsername
Set the username for the AMQP connection. The convenient top-level property of theConnectionOptions. If aConnectionOptionsis provided, the username has to be set over there.- Parameters:
username- the username to use.- Returns:
- the factory instance.
-
setPassword
Set the password for the AMQP connection. The convenient top-level property of theConnectionOptions. If aConnectionOptionsis provided, the password has to be set over there.- Parameters:
password- the password to use.- Returns:
- the factory instance.
-
setReconnectOptions
public SingleAmqpConnectionFactory setReconnectOptions(org.apache.qpid.protonj2.client.ReconnectOptions reconnectOptions) Set theReconnectOptionsfor the AMQP connection. The convenient top-level property for theConnectionOptions.reconnectOptions(). If aConnectionOptionsis provided expictily, theReconnectOptionshas to be set over there.- Parameters:
reconnectOptions- theReconnectOptionsto use.- Returns:
- the factory instance.
- See Also:
-
setConnectionOptions
public SingleAmqpConnectionFactory setConnectionOptions(org.apache.qpid.protonj2.client.ConnectionOptions connectionOptions) Set aConnectionOptionsinstance. Mutually exclusive withsetUsername(String)andsetPassword(String).- Parameters:
connectionOptions- to use.- Returns:
- the factory instance.
-
getConnection
public org.apache.qpid.protonj2.client.Connection getConnection()- Specified by:
getConnectionin interfaceAmqpConnectionFactory
-
destroy
public void destroy()- Specified by:
destroyin interfaceDisposableBean
-