public class AMQConnection extends Closeable implements CommonConnection, Referenceable
| Modifier and Type | Field and Description |
|---|---|
static String |
JNDI_ADDRESS_CONNECTION_URL |
| Constructor and Description |
|---|
AMQConnection(ConnectionURL connectionURL)
TODO Some horrible stuff going on here with setting exceptions to be non-null to detect if an exception
was thrown during the connection! Intention not clear.
|
AMQConnection(String connection) |
AMQConnection(String host,
int port,
String username,
String password,
String clientName,
String virtualHost) |
AMQConnection(String broker,
String username,
String password,
String clientName,
String virtualHost) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
attemptReconnection() |
boolean |
attemptReconnection(String host,
int port,
boolean useFailoverConfigOnFailure) |
void |
blockUntilNotFailingOver()
If failover is taking place this will block until it has completed.
|
void |
bytesReceived(long receivedBytes) |
void |
bytesSent(long writtenBytes) |
boolean |
channelLimitReached() |
void |
close()
Closes this object.
|
void |
close(long timeout) |
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Destination destination,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages) |
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Queue queue,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages) |
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Topic topic,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages) |
javax.jms.ConnectionConsumer |
createDurableConnectionConsumer(javax.jms.Topic topic,
String subscriptionName,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages) |
javax.jms.QueueSession |
createQueueSession(boolean transacted,
int acknowledgeMode)
Returns an AMQQueueSessionAdaptor which wraps an AMQSession and throws IllegalStateExceptions where specified in
the JMS spec
|
Session |
createSession(boolean transacted,
int acknowledgeMode) |
Session |
createSession(boolean transacted,
int acknowledgeMode,
int prefetch)
Create a session specifying the prefetch limit of messages.
|
Session |
createSession(boolean transacted,
int acknowledgeMode,
int prefetchHigh,
int prefetchLow)
Create a session specifying the prefetch limit of messages.
|
javax.jms.TopicSession |
createTopicSession(boolean transacted,
int acknowledgeMode)
Returns an AMQTopicSessionAdapter which wraps an AMQSession and throws IllegalStateExceptions where specified in
the JMS spec
|
void |
deregisterSession(int channelId) |
void |
exceptionReceived(Throwable cause)
Invoked by the AMQProtocolSession when a protocol session exception has occurred.
|
<T,E extends Exception> |
executeRetrySupport(FailoverProtectedOperation<T,E> operation) |
boolean |
failoverAllowed() |
void |
fireFailoverComplete()
Fires a failover complete event to the registered connection listener (if any).
|
boolean |
firePreFailover(boolean redirect)
Fire the preFailover event to the registered connection listener (if any)
|
boolean |
firePreResubscribe()
Fire the preResubscribe event to the registered connection listener (if any).
|
BrokerDetails |
getActiveBrokerDetails()
Get the details of the currently active broker
|
KeyStore |
getBrokerSuppliedTrustStore(String name) |
String |
getBrokerUUID() |
String |
getClientID() |
ConnectionListener |
getConnectionListener()
Get the connection listener that has been registered with this connection, if any
|
Long |
getConnectionNumber() |
ConnectionSettings |
getConnectionSettings() |
ConnectionURL |
getConnectionURL()
Returns connection url.
|
String |
getDefaultQueueExchangeName() |
String |
getDefaultTopicExchangeName() |
protected AMQConnectionDelegate |
getDelegate() |
javax.jms.ExceptionListener |
getExceptionListener() |
protected javax.jms.ExceptionListener |
getExceptionListenerNoCheck() |
Object |
getFailoverMutex()
In order to protect the consistency of the connection and its child sessions, consumers and producers, the
"failover mutex" must be held when doing any operations that could be corrupted during failover.
|
FailoverPolicy |
getFailoverPolicy() |
long |
getLastFailoverTime() |
long |
getMaximumChannelCount() |
long |
getMaximumFrameSize() |
long |
getMaxPrefetch()
Get the maximum number of messages that this connection can pre-fetch.
|
int |
getMessageCompressionThresholdSize() |
javax.jms.ConnectionMetaData |
getMetaData() |
int |
getNextChannelID() |
String |
getPassword() |
AMQProtocolHandler |
getProtocolHandler() |
ProtocolVersion |
getProtocolVersion() |
Reference |
getReference() |
AMQSession |
getSession(int channelId) |
ChannelToSessionMap |
getSessions() |
boolean |
getSyncAck()
Indicates whether we need to sync on every message ack
|
boolean |
getSyncPersistence()
Indicates whether persistent messages are synchronized
|
String |
getSyncPublish() |
String |
getTemporaryQueueExchangeName() |
String |
getTemporaryQueuePrefix() |
String |
getTemporaryTopicExchangeName() |
String |
getUsername() |
String |
getVirtualHost() |
boolean |
isConnected() |
boolean |
isFailingOver() |
boolean |
isMessageCompressionDesired() |
boolean |
isPopulateUserId() |
boolean |
isUseLegacyMapMessageFormat() |
boolean |
isUseLegacyStreamMessageFormat() |
protected void |
logConnected(SocketAddress localAddress,
SocketAddress remoteAddress) |
ProtocolVersion |
makeBrokerConnection(BrokerDetails brokerDetail) |
void |
performConnectionTask(Runnable task) |
void |
resubscribeSessions() |
void |
setClientID(String clientID) |
protected void |
setConnected(boolean connected) |
void |
setConnectionListener(ConnectionListener listener) |
void |
setConnectionSettings(ConnectionSettings connectionSettings) |
void |
setDefaultQueueExchangeName(String defaultQueueExchangeName) |
void |
setDefaultTopicExchangeName(String defaultTopicExchangeName) |
void |
setExceptionListener(javax.jms.ExceptionListener listener) |
void |
setFailoverPolicy(FailoverPolicy policy) |
void |
setMaximumChannelCount(long maximumChannelCount) |
void |
setMaximumFrameSize(long frameMax) |
void |
setTemporaryQueueExchangeName(String temporaryQueueExchangeName) |
void |
setTemporaryTopicExchangeName(String temporaryTopicExchangeName) |
void |
setUsername(String id) |
void |
start()
Start the connection, i.e.
|
boolean |
started() |
void |
stop() |
String |
toString() |
String |
toURL()
Returns stringified connection url.
|
boolean |
validateQueueOnSend() |
checkNotClosed, isClosed, isClosing, setClosed, setClosingclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisClosedpublic static final String JNDI_ADDRESS_CONNECTION_URL
public AMQConnection(String broker, String username, String password, String clientName, String virtualHost) throws QpidException, URLSyntaxException
broker - brokerdetailsusername - usernamepassword - passwordclientName - clientidvirtualHost - virtualhostQpidExceptionURLSyntaxExceptionpublic AMQConnection(String host, int port, String username, String password, String clientName, String virtualHost) throws QpidException, URLSyntaxException
QpidExceptionURLSyntaxExceptionpublic AMQConnection(String connection) throws QpidException, URLSyntaxException
QpidExceptionURLSyntaxExceptionpublic AMQConnection(ConnectionURL connectionURL) throws QpidException
QpidExceptionpublic boolean attemptReconnection(String host, int port, boolean useFailoverConfigOnFailure)
public boolean attemptReconnection()
public ProtocolVersion makeBrokerConnection(BrokerDetails brokerDetail) throws IOException, QpidException
IOExceptionQpidExceptionpublic <T,E extends Exception> T executeRetrySupport(FailoverProtectedOperation<T,E> operation) throws E extends Exception
E extends Exceptionpublic BrokerDetails getActiveBrokerDetails()
public boolean failoverAllowed()
public Session createSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSException
createSession in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic Session createSession(boolean transacted, int acknowledgeMode, int prefetch) throws javax.jms.JMSException
Connectionprefetch - the maximum number of messages to buffer in the client. This
applies as a total across all consumersjavax.jms.JMSExceptionpublic Session createSession(boolean transacted, int acknowledgeMode, int prefetchHigh, int prefetchLow) throws javax.jms.JMSException
ConnectionprefetchHigh - the maximum number of messages to buffer in the client.
This applies as a total across all consumersprefetchLow - the number of messages that must be in the buffer in the client to renable message flow.
This applies as a total across all consumersjavax.jms.JMSExceptionpublic KeyStore getBrokerSuppliedTrustStore(String name) throws javax.jms.JMSException
javax.jms.JMSExceptionpublic void setFailoverPolicy(FailoverPolicy policy)
public FailoverPolicy getFailoverPolicy()
public javax.jms.QueueSession createQueueSession(boolean transacted,
int acknowledgeMode)
throws javax.jms.JMSException
createQueueSession in interface javax.jms.QueueConnectiontransacted - acknowledgeMode - javax.jms.JMSExceptionpublic javax.jms.TopicSession createTopicSession(boolean transacted,
int acknowledgeMode)
throws javax.jms.JMSException
createTopicSession in interface javax.jms.TopicConnectiontransacted - acknowledgeMode - javax.jms.JMSExceptionpublic boolean channelLimitReached()
public String getClientID() throws javax.jms.JMSException
getClientID in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void setClientID(String clientID) throws javax.jms.JMSException
setClientID in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionMetaData getMetaData()
throws javax.jms.JMSException
getMetaData in interface javax.jms.Connectionjavax.jms.JMSExceptionprotected final javax.jms.ExceptionListener getExceptionListenerNoCheck()
public javax.jms.ExceptionListener getExceptionListener()
throws javax.jms.JMSException
getExceptionListener in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void setExceptionListener(javax.jms.ExceptionListener listener)
throws javax.jms.JMSException
setExceptionListener in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void start()
throws javax.jms.JMSException
start in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void stop()
throws javax.jms.JMSException
stop in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void close()
throws javax.jms.JMSException
Closeablepublic void close(long timeout)
throws javax.jms.JMSException
javax.jms.JMSExceptionpublic javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages)
throws javax.jms.JMSException
createConnectionConsumer in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Queue queue,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages)
throws javax.jms.JMSException
createConnectionConsumer in interface javax.jms.QueueConnectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Topic topic,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages)
throws javax.jms.JMSException
createConnectionConsumer in interface javax.jms.TopicConnectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic,
String subscriptionName,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages)
throws javax.jms.JMSException
createDurableConnectionConsumer in interface javax.jms.ConnectioncreateDurableConnectionConsumer in interface javax.jms.TopicConnectionjavax.jms.JMSExceptionpublic long getMaximumChannelCount()
throws javax.jms.JMSException
javax.jms.JMSExceptionpublic void setConnectionListener(ConnectionListener listener)
public ConnectionListener getConnectionListener()
Connectionpublic void setMaximumChannelCount(long maximumChannelCount)
public void setMaximumFrameSize(long frameMax)
public long getMaximumFrameSize()
public ChannelToSessionMap getSessions()
public String getUsername()
public void setUsername(String id)
public String getPassword()
public String getVirtualHost()
public final AMQProtocolHandler getProtocolHandler()
public final boolean started()
public final boolean isConnected()
protected final void setConnected(boolean connected)
public void bytesSent(long writtenBytes)
public void bytesReceived(long receivedBytes)
public boolean firePreFailover(boolean redirect)
redirect - true if this is the result of a redirect request rather than a connection errorpublic boolean firePreResubscribe()
throws javax.jms.JMSException
javax.jms.JMSExceptionpublic void fireFailoverComplete()
public final Object getFailoverMutex()
public void resubscribeSessions()
throws javax.jms.JMSException,
QpidException,
FailoverException
javax.jms.JMSExceptionQpidExceptionFailoverExceptionpublic void blockUntilNotFailingOver()
throws InterruptedException
InterruptedExceptionpublic void exceptionReceived(Throwable cause)
cause - the exceptionpublic void deregisterSession(int channelId)
public ConnectionURL getConnectionURL()
public String toURL()
AMQConnectionURL.toString() converts any password to asterisks.public Reference getReference() throws NamingException
getReference in interface ReferenceableNamingExceptionpublic String getDefaultTopicExchangeName()
public void setDefaultTopicExchangeName(String defaultTopicExchangeName)
public String getDefaultQueueExchangeName()
public void setDefaultQueueExchangeName(String defaultQueueExchangeName)
public String getTemporaryTopicExchangeName()
public String getTemporaryQueueExchangeName()
public void setTemporaryTopicExchangeName(String temporaryTopicExchangeName)
public void setTemporaryQueueExchangeName(String temporaryQueueExchangeName)
public void performConnectionTask(Runnable task)
public AMQSession getSession(int channelId)
public ProtocolVersion getProtocolVersion()
public String getBrokerUUID()
public boolean isFailingOver()
public long getMaxPrefetch()
public boolean getSyncPersistence()
public boolean getSyncAck()
public String getSyncPublish()
public boolean isPopulateUserId()
public boolean isMessageCompressionDesired()
public int getNextChannelID()
public boolean isUseLegacyMapMessageFormat()
public boolean isUseLegacyStreamMessageFormat()
public long getLastFailoverTime()
protected AMQConnectionDelegate getDelegate()
public Long getConnectionNumber()
protected void logConnected(SocketAddress localAddress, SocketAddress remoteAddress)
public boolean validateQueueOnSend()
public int getMessageCompressionThresholdSize()
public String getTemporaryQueuePrefix()
public void setConnectionSettings(ConnectionSettings connectionSettings)
public ConnectionSettings getConnectionSettings()
Copyright © 2006–2016 The Apache Software Foundation. All rights reserved.