Class AmqpConnection
- java.lang.Object
-
- org.apache.qpid.jms.provider.amqp.AmqpAbstractResource<JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>
-
- org.apache.qpid.jms.provider.amqp.AmqpConnection
-
- All Implemented Interfaces:
AmqpEventSink,AmqpResource,AmqpResourceParent
public class AmqpConnection extends AmqpAbstractResource<JmsConnectionInfo,org.apache.qpid.proton.engine.Connection> implements AmqpResourceParent
-
-
Field Summary
-
Fields inherited from class org.apache.qpid.jms.provider.amqp.AmqpAbstractResource
closeRequest, closeTimeoutTask
-
-
Constructor Summary
Constructors Constructor Description AmqpConnection(AmqpProvider provider, JmsConnectionInfo info, org.apache.qpid.proton.engine.Connection protonConnection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChildResource(AmqpResource resource)Adds the given resource as a child of this resource so that it's lifetime becomes managed by that of its parent.voidcreateSession(JmsSessionInfo sessionInfo, AsyncResult request)voidcreateTemporaryDestination(JmsTemporaryDestination destination, AsyncResult request)AmqpJmsMessageFactorygetAmqpMessageFactory()intgetAnonymousProducerCacheSize()intgetAnonymousProducerCacheTimeout()AmqpConnectionSessiongetConnectionSession()Retrieves the AmqpConnectionSession owned by this AmqpConnection.AmqpConnectionPropertiesgetProperties()Returns the connection properties for an established connection which defines the various capabilities and configuration options of the remote connection.AmqpProvidergetProvider()java.lang.StringgetQueuePrefix()java.net.URIgetRemoteURI()AmqpSessiongetSession(JmsSessionId sessionId)Retrieve the indicated Session instance from the list of active sessions.AmqpSubscriptionTrackergetSubTracker()AmqpTemporaryDestinationgetTemporaryDestination(JmsTemporaryDestination destination)java.lang.StringgetTopicPrefix()voidhandleResourceClosure(AmqpProvider provider, ProviderException cause)booleanisObjectMessageUsesAmqpTypes()voidprocessRemoteClose(AmqpProvider provider)Event handler for remote peer close of this resource.voidremoveChildResource(AmqpResource resource)Removes the given resource from the registered child resources managed by this one.java.util.concurrent.ScheduledFuture<?>schedule(java.lang.Runnable task, long delay)Allows a connection resource to schedule a task for future execution.java.util.concurrent.ScheduledFuture<?>scheduleWithFixedDelay(java.lang.Runnable task, long delay)Allows a connection resource to schedule a task for future execution which will start after the given delay and then repeat with a fixed delay between the end of one execution of the task and the beginning of the next execution.voidsetObjectMessageUsesAmqpTypes(boolean objectMessageUsesAmqpTypes)Configures the body type used in ObjectMessage instances that are sent from this connection.voidsetQueuePrefix(java.lang.String queuePrefix)voidsetTopicPrefix(java.lang.String topicPrefix)java.lang.StringtoString()voidunsubscribe(java.lang.String subscriptionName, AsyncResult request)-
Methods inherited from class org.apache.qpid.jms.provider.amqp.AmqpAbstractResource
close, closeOrDetachEndpoint, closeResource, getEndpoint, getLocalState, getParent, getRemoteState, getResourceInfo, isAwaitingClose, isClosed, isOpen, processDeliveryUpdates, processFlowUpdates, processRemoteDetach, processRemoteOpen
-
-
-
-
Constructor Detail
-
AmqpConnection
public AmqpConnection(AmqpProvider provider, JmsConnectionInfo info, org.apache.qpid.proton.engine.Connection protonConnection)
-
-
Method Detail
-
createSession
public void createSession(JmsSessionInfo sessionInfo, AsyncResult request)
-
createTemporaryDestination
public void createTemporaryDestination(JmsTemporaryDestination destination, AsyncResult request)
-
getTemporaryDestination
public AmqpTemporaryDestination getTemporaryDestination(JmsTemporaryDestination destination)
-
unsubscribe
public void unsubscribe(java.lang.String subscriptionName, AsyncResult request)
-
addChildResource
public void addChildResource(AmqpResource resource)
Description copied from interface:AmqpResourceParentAdds the given resource as a child of this resource so that it's lifetime becomes managed by that of its parent.- Specified by:
addChildResourcein interfaceAmqpResourceParent- Parameters:
resource- The AmqpResource that is a child of this one.
-
removeChildResource
public void removeChildResource(AmqpResource resource)
Description copied from interface:AmqpResourceParentRemoves the given resource from the registered child resources managed by this one.- Specified by:
removeChildResourcein interfaceAmqpResourceParent- Parameters:
resource- The AmqpResource that is no longer a child of this one.
-
handleResourceClosure
public void handleResourceClosure(AmqpProvider provider, ProviderException cause)
- Overrides:
handleResourceClosurein classAmqpAbstractResource<JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>
-
processRemoteClose
public void processRemoteClose(AmqpProvider provider) throws ProviderException
Description copied from interface:AmqpEventSinkEvent handler for remote peer close of this resource.- Specified by:
processRemoteClosein interfaceAmqpEventSink- Overrides:
processRemoteClosein classAmqpAbstractResource<JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>- Parameters:
provider- the AmqpProvider instance for easier access to fire events.- Throws:
ProviderException- if an error occurs while processing the update.
-
getRemoteURI
public java.net.URI getRemoteURI()
-
getProvider
public AmqpProvider getProvider()
- Specified by:
getProviderin interfaceAmqpResourceParent- Returns:
- a reference to the root AmqpProvider.
-
getQueuePrefix
public java.lang.String getQueuePrefix()
-
setQueuePrefix
public void setQueuePrefix(java.lang.String queuePrefix)
-
getTopicPrefix
public java.lang.String getTopicPrefix()
-
setTopicPrefix
public void setTopicPrefix(java.lang.String topicPrefix)
-
getSession
public AmqpSession getSession(JmsSessionId sessionId)
Retrieve the indicated Session instance from the list of active sessions.- Parameters:
sessionId- The JmsSessionId that's associated with the target session.- Returns:
- the AmqpSession associated with the given id.
-
getConnectionSession
public AmqpConnectionSession getConnectionSession()
Retrieves the AmqpConnectionSession owned by this AmqpConnection.- Returns:
- the AmqpConnectionSession owned by this AmqpConnection.
-
isObjectMessageUsesAmqpTypes
public boolean isObjectMessageUsesAmqpTypes()
- Returns:
- true if new ObjectMessage instance should default to using AMQP Typed bodies.
-
setObjectMessageUsesAmqpTypes
public void setObjectMessageUsesAmqpTypes(boolean objectMessageUsesAmqpTypes)
Configures the body type used in ObjectMessage instances that are sent from this connection.- Parameters:
objectMessageUsesAmqpTypes- the objectMessageUsesAmqpTypes value to set.
-
getAnonymousProducerCacheSize
public int getAnonymousProducerCacheSize()
- Returns:
- the configured max number of cached anonymous fallback producers to keep.
-
getAnonymousProducerCacheTimeout
public int getAnonymousProducerCacheTimeout()
- Returns:
- The configured time before a cache anonymous producer link is close due to inactivity.
-
getAmqpMessageFactory
public AmqpJmsMessageFactory getAmqpMessageFactory()
- Returns:
- the AMQP based JmsMessageFactory for this Connection.
-
getProperties
public AmqpConnectionProperties getProperties()
Returns the connection properties for an established connection which defines the various capabilities and configuration options of the remote connection. Prior to the establishment of a connection this method returns null.- Returns:
- the properties available for this connection or null if not connected.
-
getSubTracker
public AmqpSubscriptionTracker getSubTracker()
-
schedule
public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable task, long delay)Allows a connection resource to schedule a task for future execution.- Parameters:
task- The Runnable task to be executed after the given delay.delay- The delay in milliseconds to schedule the given task for execution.- Returns:
- a ScheduledFuture instance that can be used to cancel the task.
-
scheduleWithFixedDelay
public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable task, long delay)Allows a connection resource to schedule a task for future execution which will start after the given delay and then repeat with a fixed delay between the end of one execution of the task and the beginning of the next execution.- Parameters:
task- The Runnable task to be executed after the given delay.delay- The delay in milliseconds to schedule the given task for execution.- Returns:
- a ScheduledFuture instance that can be used to cancel the task.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-