public class AMQConnection extends Closeable implements CommonConnection, Referenceable, ClassLoadingAwareObjectInputStream.TrustedClassFilter
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 |
isTrusted(Class<?> clazz) |
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, setClosing
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isClosed
public 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
- virtualhostQpidException
URLSyntaxException
public AMQConnection(String host, int port, String username, String password, String clientName, String virtualHost) throws QpidException, URLSyntaxException
QpidException
URLSyntaxException
public AMQConnection(String connection) throws QpidException, URLSyntaxException
QpidException
URLSyntaxException
public AMQConnection(ConnectionURL connectionURL) throws QpidException
QpidException
public boolean attemptReconnection(String host, int port, boolean useFailoverConfigOnFailure)
public boolean attemptReconnection()
public ProtocolVersion makeBrokerConnection(BrokerDetails brokerDetail) throws IOException, QpidException
IOException
QpidException
public <T,E extends Exception> T executeRetrySupport(FailoverProtectedOperation<T,E> operation) throws E extends Exception
E extends Exception
public BrokerDetails getActiveBrokerDetails()
public boolean failoverAllowed()
public Session createSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSException
createSession
in interface javax.jms.Connection
javax.jms.JMSException
public Session createSession(boolean transacted, int acknowledgeMode, int prefetch) throws javax.jms.JMSException
Connection
prefetch
- the maximum number of messages to buffer in the client. This
applies as a total across all consumersjavax.jms.JMSException
public Session createSession(boolean transacted, int acknowledgeMode, int prefetchHigh, int prefetchLow) throws javax.jms.JMSException
Connection
prefetchHigh
- 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.JMSException
public KeyStore getBrokerSuppliedTrustStore(String name) throws javax.jms.JMSException
javax.jms.JMSException
public 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.QueueConnection
transacted
- acknowledgeMode
- javax.jms.JMSException
public javax.jms.TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSException
createTopicSession
in interface javax.jms.TopicConnection
transacted
- acknowledgeMode
- javax.jms.JMSException
public boolean channelLimitReached()
public String getClientID() throws javax.jms.JMSException
getClientID
in interface javax.jms.Connection
javax.jms.JMSException
public void setClientID(String clientID) throws javax.jms.JMSException
setClientID
in interface javax.jms.Connection
javax.jms.JMSException
public javax.jms.ConnectionMetaData getMetaData() throws javax.jms.JMSException
getMetaData
in interface javax.jms.Connection
javax.jms.JMSException
protected final javax.jms.ExceptionListener getExceptionListenerNoCheck()
public javax.jms.ExceptionListener getExceptionListener() throws javax.jms.JMSException
getExceptionListener
in interface javax.jms.Connection
javax.jms.JMSException
public void setExceptionListener(javax.jms.ExceptionListener listener) throws javax.jms.JMSException
setExceptionListener
in interface javax.jms.Connection
javax.jms.JMSException
public void start() throws javax.jms.JMSException
start
in interface javax.jms.Connection
javax.jms.JMSException
public void stop() throws javax.jms.JMSException
stop
in interface javax.jms.Connection
javax.jms.JMSException
public void close() throws javax.jms.JMSException
Closeable
public void close(long timeout) throws javax.jms.JMSException
javax.jms.JMSException
public 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.Connection
javax.jms.JMSException
public 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.QueueConnection
javax.jms.JMSException
public 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.TopicConnection
javax.jms.JMSException
public 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.Connection
createDurableConnectionConsumer
in interface javax.jms.TopicConnection
javax.jms.JMSException
public long getMaximumChannelCount() throws javax.jms.JMSException
javax.jms.JMSException
public void setConnectionListener(ConnectionListener listener)
public ConnectionListener getConnectionListener()
Connection
public 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.JMSException
public void fireFailoverComplete()
public final Object getFailoverMutex()
public void resubscribeSessions() throws javax.jms.JMSException, QpidException, FailoverException
javax.jms.JMSException
QpidException
FailoverException
public void blockUntilNotFailingOver() throws InterruptedException
InterruptedException
public 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 Referenceable
NamingException
public 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()
public boolean isTrusted(Class<?> clazz)
isTrusted
in interface ClassLoadingAwareObjectInputStream.TrustedClassFilter
Copyright © 2006–2016 The Apache Software Foundation. All rights reserved.