public class SingleInstanceAmqpConnectionFactory extends Object implements AmqpConnectionFactory
AmqpConnectionFactory
implementation which creates only one connection instance. All
subsequent calls to newConnection()
method return instance created by the first call.Constructor and Description |
---|
SingleInstanceAmqpConnectionFactory(ConfiguredConnectionFactory configuredConnectionFactory,
SdkInternalConfiguration config,
SdkConnectionStatusListener connectionStatusListener,
WhoAmIReader whoAmIReader,
FirewallChecker firewallChecker,
TimeUtils timeUtils,
SslProtocolsProvider sslProtocolsProvider)
Initializes a new instance of the
SingleInstanceAmqpConnectionFactory class |
Modifier and Type | Method and Description |
---|---|
boolean |
canConnectionOpen()
Check if the connection can or should be opened
|
void |
close(boolean feedStopped)
Close the AMQP connection
|
com.rabbitmq.client.Connection |
getConnection()
Returns a
Connection instance representing connection to the AMQP broker |
long |
getConnectionStarted()
Get the timestamp when the connection started
|
boolean |
isConnectionHealthy()
Check if the connection is currently alive
|
@Inject public SingleInstanceAmqpConnectionFactory(ConfiguredConnectionFactory configuredConnectionFactory, SdkInternalConfiguration config, SdkConnectionStatusListener connectionStatusListener, WhoAmIReader whoAmIReader, FirewallChecker firewallChecker, TimeUtils timeUtils, SslProtocolsProvider sslProtocolsProvider)
SingleInstanceAmqpConnectionFactory
classconfiguredConnectionFactory
- A ConfiguredConnectionFactory
instance used to create the
Connection
instanceconfig
- A SdkInternalConfiguration
instance representing odds feed configurationconnectionStatusListener
- A SdkConnectionStatusListener
used to notify the
outside world when the connection is closedpublic com.rabbitmq.client.Connection getConnection()
Connection
instance representing connection to the AMQP brokergetConnection
in interface AmqpConnectionFactory
Connection
instance representing connection to the AMQP brokerpublic void close(boolean feedStopped) throws IOException
close
in interface AmqpConnectionFactory
feedStopped
- indication if feed was stoppedIOException
- if the connection couldn't be terminatedpublic boolean isConnectionHealthy()
AmqpConnectionFactory
isConnectionHealthy
in interface AmqpConnectionFactory
public long getConnectionStarted()
getConnectionStarted
in interface AmqpConnectionFactory
public boolean canConnectionOpen()
canConnectionOpen
in interface AmqpConnectionFactory
Copyright © 2016–2025. All rights reserved.