public class JmsConnection extends Object implements AutoCloseable, javax.jms.Connection, javax.jms.TopicConnection, javax.jms.QueueConnection, ProviderListener
| Modifier | Constructor and Description |
|---|---|
protected |
JmsConnection(JmsConnectionInfo connectionInfo,
Provider provider) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addConnectionConsumer(JmsConsumerInfo consumerInfo,
JmsConnectionConsumer consumer) |
void |
addConnectionListener(JmsConnectionListener listener)
Adds a JmsConnectionListener so that a client can be notified of events in
the underlying connection and its state.
|
protected void |
addSession(JmsSessionInfo sessionInfo,
JmsSession session) |
protected void |
checkClosed() |
protected void |
checkClosedOrFailed() |
protected void |
checkConsumeFromTemporaryDestination(JmsTemporaryDestination destination) |
void |
close() |
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) |
javax.jms.Session |
createSession() |
javax.jms.Session |
createSession(boolean transacted,
int acknowledgeMode) |
javax.jms.Session |
createSession(int acknowledgeMode) |
javax.jms.ConnectionConsumer |
createSharedConnectionConsumer(javax.jms.Topic topic,
String subscriptionName,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages) |
javax.jms.ConnectionConsumer |
createSharedDurableConnectionConsumer(javax.jms.Topic topic,
String subscriptionName,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages) |
protected javax.jms.TemporaryQueue |
createTemporaryQueue() |
protected javax.jms.TemporaryTopic |
createTemporaryTopic() |
javax.jms.TopicSession |
createTopicSession(boolean transacted,
int acknowledgeMode) |
protected void |
deleteTemporaryDestination(JmsTemporaryDestination destination) |
String |
getClientID() |
long |
getCloseTimeout() |
URI |
getConfiguredURI() |
URI |
getConnectedURI() |
long |
getConnectTimeout() |
JmsDeserializationPolicy |
getDeserializationPolicy() |
javax.jms.ExceptionListener |
getExceptionListener() |
JmsConnectionId |
getId() |
JmsMessageFactory |
getMessageFactory() |
JmsMessageIDPolicy |
getMessageIDPolicy() |
javax.jms.ConnectionMetaData |
getMetaData() |
protected JmsConsumerId |
getNextConnectionConsumerId() |
protected JmsSessionId |
getNextSessionId() |
protected JmsTransactionId |
getNextTransactionId() |
String |
getPassword() |
JmsPrefetchPolicy |
getPrefetchPolicy() |
JmsPresettlePolicy |
getPresettlePolicy() |
String |
getQueuePrefix() |
JmsRedeliveryPolicy |
getRedeliveryPolicy() |
long |
getRequestTimeout() |
long |
getSendTimeout() |
protected int |
getSessionAcknowledgeMode(boolean transacted,
int acknowledgeMode) |
String |
getTopicPrefix() |
String |
getUsername() |
boolean |
isClosed() |
boolean |
isCloseLinksThatFailOnReconnect() |
boolean |
isConnected() |
protected boolean |
isExplicitClientID() |
boolean |
isFailed() |
boolean |
isForceAsyncAcks() |
boolean |
isForceAsyncSend() |
boolean |
isForceSyncSend() |
boolean |
isLocalMessageExpiry() |
boolean |
isLocalMessagePriority() |
boolean |
isPopulateJMSXUserID() |
boolean |
isReceiveLocalOnly() |
boolean |
isReceiveNoWaitLocalOnly() |
boolean |
isStarted() |
protected boolean |
isTemporaryDestinationDeleted(JmsDestination destination) |
boolean |
isUseDaemonThread() |
boolean |
isValidatePropertyNames() |
void |
onAsyncException(Throwable error)
Handles any asynchronous errors that occur from the JMS framework classes.
|
void |
onCompletedMessageSend(JmsOutboundMessageDispatch envelope)
Called when an outbound message dispatch that requested a completion callback
has reached a state where the send can be considered successful based on the QoS
level associated of the outbound message.
|
void |
onConnectionEstablished(URI remoteURI)
Called to indicate that the underlying connection to the Broker has been established
for the first time.
|
void |
onConnectionFailure(ProviderException ex)
Called to indicate that the underlying connection to the Broker has been lost and
the Provider will not perform any reconnect.
|
void |
onConnectionInterrupted(URI remoteURI)
Called from a fault tolerant Provider instance to signal that the underlying
connection to the Broker has been lost.
|
void |
onConnectionRecovered(Provider provider)
Called to indicate that a connection to the Broker has been reestablished and
that all recovery operations have succeeded and the connection will now be
transitioned to a recovered state.
|
void |
onConnectionRecovery(Provider provider)
Called to indicate that a connection to the Broker has been reestablished and
that notified listener should start to recover it's state.
|
void |
onConnectionRestored(URI remoteURI)
Called to signal that all recovery operations are now complete and the Provider
is again in a normal connected state.
|
void |
onException(Exception ex) |
void |
onException(javax.jms.JMSException ex) |
void |
onFailedMessageSend(JmsOutboundMessageDispatch envelope,
ProviderException cause)
Called when an outbound message dispatch that requested a completion callback
has reached a state where the send can be considered failed.
|
void |
onInboundMessage(JmsInboundMessageDispatch envelope)
Called when a new Message has arrived for a registered consumer.
|
void |
onProviderException(ProviderException cause)
Called to indicate that a some client operation caused or received an
error that is not considered fatal at the provider level.
|
void |
onResourceClosed(JmsResource resource,
ProviderException cause)
Called to indicate that a currently active resource has been closed
due to some error condition, management request or some other action.
|
protected void |
providerFailed(ProviderException cause) |
protected void |
removeConnectionConsumer(JmsConsumerInfo consumerInfo) |
boolean |
removeConnectionListener(JmsConnectionListener listener)
Removes a JmsConnectionListener that was previously registered.
|
protected void |
removeSession(JmsSessionInfo sessionInfo) |
void |
setClientID(String clientID) |
void |
setCloseLinksThatFailOnReconnect(boolean closeLinksThatFailOnReconnect) |
void |
setCloseTimeout(long closeTimeout) |
void |
setConnectTimeout(long connectTimeout) |
void |
setDeserializationPolicy(JmsDeserializationPolicy deserializationPolicy) |
void |
setExceptionListener(javax.jms.ExceptionListener listener) |
void |
setForceAsyncAcks(boolean forceAsyncAcks) |
void |
setForceAsyncSend(boolean forceAsyncSend) |
void |
setForceSyncSend(boolean alwaysSyncSend) |
void |
setLocalMessageExpiry(boolean localMessageExpiry) |
void |
setLocalMessagePriority(boolean localMessagePriority) |
void |
setMessageIDPolicy(JmsMessageIDPolicy messageIDPolicy) |
void |
setPopulateJMSXUserID(boolean populateJMSXUserID) |
void |
setPrefetchPolicy(JmsPrefetchPolicy prefetchPolicy) |
void |
setPresettlePolicy(JmsPresettlePolicy presettlePolicy) |
void |
setQueuePrefix(String queuePrefix) |
void |
setReceiveLocalOnly(boolean receiveLocalOnly) |
void |
setReceiveNoWaitLocalOnly(boolean receiveNoWaitLocalOnly) |
void |
setRedeliveryPolicy(JmsRedeliveryPolicy redeliveryPolicy) |
void |
setRequestTimeout(long requestTimeout) |
void |
setSendTimeout(long sendTimeout) |
void |
setTopicPrefix(String topicPrefix) |
void |
setValidatePropertyNames(boolean validatePropertyNames) |
protected void |
shutdown()
Called to free all Connection resources.
|
protected void |
shutdown(Exception cause)
Called to free all Connection resources.
|
void |
start() |
void |
stop() |
protected JmsConnection(JmsConnectionInfo connectionInfo, Provider provider) throws javax.jms.JMSException
javax.jms.JMSExceptionpublic void close()
throws javax.jms.JMSException
close in interface AutoCloseableclose in interface javax.jms.Connectionjavax.jms.JMSExceptionprotected void shutdown()
throws javax.jms.JMSException
javax.jms.JMSExceptionprotected void shutdown(Exception cause) throws javax.jms.JMSException
javax.jms.JMSExceptionpublic javax.jms.Session createSession()
throws javax.jms.JMSException
createSession in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.Session createSession(int acknowledgeMode)
throws javax.jms.JMSException
createSession in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.Session createSession(boolean transacted,
int acknowledgeMode)
throws javax.jms.JMSException
createSession in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic String getClientID() throws javax.jms.JMSException
getClientID in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionMetaData getMetaData()
throws javax.jms.JMSException
getMetaData in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void setClientID(String clientID) throws javax.jms.JMSException
setClientID 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 javax.jms.ConnectionConsumer createSharedConnectionConsumer(javax.jms.Topic topic,
String subscriptionName,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages)
throws javax.jms.JMSException
createSharedConnectionConsumer in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionConsumer createSharedDurableConnectionConsumer(javax.jms.Topic topic,
String subscriptionName,
String messageSelector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages)
throws javax.jms.JMSException
createSharedDurableConnectionConsumer in interface javax.jms.Connectionjavax.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 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.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 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.TopicSession createTopicSession(boolean transacted,
int acknowledgeMode)
throws javax.jms.JMSException
createTopicSession in interface javax.jms.TopicConnectionjavax.jms.JMSExceptionpublic javax.jms.QueueSession createQueueSession(boolean transacted,
int acknowledgeMode)
throws javax.jms.JMSException
createQueueSession in interface javax.jms.QueueConnectionjavax.jms.JMSExceptionpublic void onException(Exception ex)
public void onException(javax.jms.JMSException ex)
protected int getSessionAcknowledgeMode(boolean transacted,
int acknowledgeMode)
throws javax.jms.JMSException
javax.jms.JMSExceptionprotected void removeSession(JmsSessionInfo sessionInfo)
protected void addSession(JmsSessionInfo sessionInfo, JmsSession session)
protected void removeConnectionConsumer(JmsConsumerInfo consumerInfo)
protected void addConnectionConsumer(JmsConsumerInfo consumerInfo, JmsConnectionConsumer consumer)
protected javax.jms.TemporaryQueue createTemporaryQueue()
throws javax.jms.JMSException
javax.jms.JMSExceptionprotected javax.jms.TemporaryTopic createTemporaryTopic()
throws javax.jms.JMSException
javax.jms.JMSExceptionprotected void deleteTemporaryDestination(JmsTemporaryDestination destination) throws javax.jms.JMSException
javax.jms.JMSExceptionprotected void checkClosedOrFailed()
throws javax.jms.JMSException
javax.jms.JMSExceptionprotected void checkConsumeFromTemporaryDestination(JmsTemporaryDestination destination) throws javax.jms.JMSException
javax.jms.JMSExceptionprotected boolean isTemporaryDestinationDeleted(JmsDestination destination)
protected void checkClosed()
throws javax.jms.IllegalStateException
javax.jms.IllegalStateExceptionprotected JmsSessionId getNextSessionId()
protected JmsTransactionId getNextTransactionId()
protected JmsConsumerId getNextConnectionConsumerId()
protected boolean isExplicitClientID()
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 addConnectionListener(JmsConnectionListener listener)
listener - the new listener to add to the collection.public boolean removeConnectionListener(JmsConnectionListener listener)
listener - the listener to remove from the collection.public boolean isForceAsyncSend()
public void setForceAsyncSend(boolean forceAsyncSend)
public boolean isForceSyncSend()
public void setForceSyncSend(boolean alwaysSyncSend)
public String getTopicPrefix()
public void setTopicPrefix(String topicPrefix)
public String getQueuePrefix()
public void setQueuePrefix(String queuePrefix)
public boolean isValidatePropertyNames()
public void setValidatePropertyNames(boolean validatePropertyNames)
public JmsPrefetchPolicy getPrefetchPolicy()
public void setPrefetchPolicy(JmsPrefetchPolicy prefetchPolicy)
public JmsRedeliveryPolicy getRedeliveryPolicy()
public void setRedeliveryPolicy(JmsRedeliveryPolicy redeliveryPolicy)
public JmsPresettlePolicy getPresettlePolicy()
public void setPresettlePolicy(JmsPresettlePolicy presettlePolicy)
public JmsDeserializationPolicy getDeserializationPolicy()
public void setDeserializationPolicy(JmsDeserializationPolicy deserializationPolicy)
public boolean isReceiveLocalOnly()
public void setReceiveLocalOnly(boolean receiveLocalOnly)
public boolean isReceiveNoWaitLocalOnly()
public void setReceiveNoWaitLocalOnly(boolean receiveNoWaitLocalOnly)
public boolean isLocalMessagePriority()
public void setLocalMessagePriority(boolean localMessagePriority)
public long getCloseTimeout()
public void setCloseTimeout(long closeTimeout)
public long getConnectTimeout()
public void setConnectTimeout(long connectTimeout)
public long getSendTimeout()
public void setSendTimeout(long sendTimeout)
public long getRequestTimeout()
public void setRequestTimeout(long requestTimeout)
public URI getConfiguredURI()
public URI getConnectedURI()
public String getUsername()
public String getPassword()
public boolean isConnected()
public boolean isStarted()
public boolean isClosed()
public boolean isFailed()
public JmsConnectionId getId()
public JmsMessageFactory getMessageFactory()
public boolean isForceAsyncAcks()
public void setForceAsyncAcks(boolean forceAsyncAcks)
public boolean isLocalMessageExpiry()
public void setLocalMessageExpiry(boolean localMessageExpiry)
public JmsMessageIDPolicy getMessageIDPolicy()
public void setMessageIDPolicy(JmsMessageIDPolicy messageIDPolicy)
public boolean isPopulateJMSXUserID()
public void setPopulateJMSXUserID(boolean populateJMSXUserID)
public boolean isUseDaemonThread()
public boolean isCloseLinksThatFailOnReconnect()
public void setCloseLinksThatFailOnReconnect(boolean closeLinksThatFailOnReconnect)
public void onInboundMessage(JmsInboundMessageDispatch envelope)
ProviderListeneronInboundMessage in interface ProviderListenerenvelope - The dispatch object containing the message and delivery information.public void onCompletedMessageSend(JmsOutboundMessageDispatch envelope)
ProviderListeneronCompletedMessageSend in interface ProviderListenerenvelope - the original outbound message dispatch that is now complete.public void onFailedMessageSend(JmsOutboundMessageDispatch envelope, ProviderException cause)
ProviderListeneronFailedMessageSend in interface ProviderListenerenvelope - the original outbound message dispatch that should be treated as a failed send.cause - the exception that describes the cause of the failed send.public void onConnectionInterrupted(URI remoteURI)
ProviderListeneronConnectionInterrupted in interface ProviderListenerremoteURI - The URI of the Broker whose connection was lost.public void onConnectionRecovery(Provider provider) throws Exception
ProviderListeneronConnectionRecovery in interface ProviderListenerprovider - The new Provider instance that will become active after the state
has been recovered.Exception - if an error occurs during recovery attempt, this will fail
the Provider that's being used for recovery.public void onConnectionRecovered(Provider provider) throws Exception
ProviderListeneronConnectionRecovered in interface ProviderListenerprovider - The new Provider instance that will become active after the state
has been recovered.Exception - if an error occurs during recovery attempt, this will fail
the Provider that's being used for recovery.public void onConnectionRestored(URI remoteURI)
ProviderListeneronConnectionRestored in interface ProviderListenerremoteURI - The URI of the Broker that the client has now connected to.public void onConnectionEstablished(URI remoteURI)
ProviderListeneronConnectionEstablished in interface ProviderListenerremoteURI - The URI of the Broker that the client has now connected to.public void onConnectionFailure(ProviderException ex)
ProviderListeneronConnectionFailure in interface ProviderListenerex - The exception that indicates the cause of this Provider failure.public void onResourceClosed(JmsResource resource, ProviderException cause)
ProviderListeneronResourceClosed in interface ProviderListenerresource - the JmsResource instance that has been closed.cause - optional exception object that indicates the cause of the close.public void onProviderException(ProviderException cause)
ProviderListeneronProviderException in interface ProviderListenercause - the exception object that is being reported to the listener.public void onAsyncException(Throwable error)
error - The exception that triggered this error.protected void providerFailed(ProviderException cause)
Copyright © 2013–2019 The Apache Software Foundation. All rights reserved.