Class SingleAmqpConnectionFactory
java.lang.Object
org.springframework.amqp.client.SingleAmqpConnectionFactory
- All Implemented Interfaces:
AmqpConnectionFactory,Aware,BeanFactoryAware,DisposableBean
public class SingleAmqpConnectionFactory
extends Object
implements AmqpConnectionFactory, BeanFactoryAware, DisposableBean
The
AmqpConnectionFactory implementation to hold a single, shared Connection instance.
If instance is created without a Client, it will be resolved from the BeanFactory on demand
internally from the getConnection() call.- Since:
- 4.1
- Author:
- Artem Bilan
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance based on aClientbean resolved from theBeanFactory.SingleAmqpConnectionFactory(org.apache.qpid.protonj2.client.Client protonjClient) -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()org.apache.qpid.protonj2.client.ConnectionvoidsetBeanFactory(BeanFactory beanFactory) setConnectionOptions(org.apache.qpid.protonj2.client.ConnectionOptions connectionOptions) Set aConnectionOptionsinstance.setPassword(String password) Set the password for the AMQP connection.setPort(int port) setUsername(String username) Set the username for the AMQP connection.
-
Constructor Details
-
SingleAmqpConnectionFactory
public SingleAmqpConnectionFactory()Create an instance based on aClientbean resolved from theBeanFactory. -
SingleAmqpConnectionFactory
public SingleAmqpConnectionFactory(org.apache.qpid.protonj2.client.Client protonjClient)
-
-
Method Details
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Throws:
BeansException
-
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.
-
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
-