|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activemq.ActiveMQConnection
A Connection
object is a client's active connection to its JMS
provider. It typically allocates provider resources outside the Java virtual
machine (JVM).
Connections support concurrent use.
A connection serves several purposes:
ConnectionMetaData
object.
ExceptionListener
object.
Because the creation of a connection involves setting up authentication and communication, a connection is a relatively heavyweight object. Most clients will do all their messaging with a single connection. Other more advanced applications may use several connections. The JMS API does not architect a reason for using multiple connections; however, there may be operational reasons for doing so.
A JMS client typically creates a connection, one or more sessions, and a number of message producers and consumers. When a connection is created, it is in stopped mode. That means that no messages are being delivered.
It is typical to leave the connection in stopped mode until setup is complete
(that is, until all message consumers have been created). At that point, the
client calls the connection's start
method, and messages begin
arriving at the connection's consumers. This setup convention minimizes any
client confusion that may result from asynchronous message delivery while the
client is still in the process of setting itself up.
A connection can be started immediately, and the setup can be done afterwards. Clients that do this must be prepared to handle asynchronous message delivery while they are still in the process of setting up.
A message producer can send messages while a connection is stopped.
This class is also aTopicConnection
. A TopicConnection
object is an active connection to a publish/subscribe JMS provider. A client
uses a TopicConnection
object to create one or more TopicSession
objects for producing and consuming messages.
A TopicConnection
can be used to create a TopicSession
,
from which specialized topic-related objects can be created. A more general,
and recommended approach is to use the Connection
object.
This class is also a
QueueConnection
. A A QueueConnection
object is an active connection to a point-to-point JMS provider. A client
uses a QueueConnection
object to create one or more QueueSession
objects for producing and consuming messages.
A QueueConnection
can be used to create a QueueSession
,
from which specialized queue-related objects can be created. A more general,
and recommended, approach is to use the Connection
object.
A QueueConnection
cannot be used to create objects specific to
the publish/subscribe domain. The createDurableConnectionConsumer
method inherits from Connection
, but must throw an IllegalStateException
if used from QueueConnection
. // *
Connection
,
ConnectionFactory
,
QueueConnection
,
TopicConnection
,
TopicConnectionFactory
,
QueueConnection
,
QueueConnectionFactory
Field Summary | |
protected String |
clientID
|
static String |
DEFAULT_BROKER_URL
Default URL for the ActiveMQ Broker |
static String |
DEFAULT_PASSWORD
Default Password for the Connection |
static String |
DEFAULT_URL
Default client URL. |
static String |
DEFAULT_USER
Default UserName for the Connection |
protected IdGenerator |
handleIdGenerator
|
protected IdGenerator |
packetIdGenerator
|
protected boolean |
useAsyncSend
Should we use an async send for persistent non transacted messages ? |
Constructor Summary | |
protected |
ActiveMQConnection(ActiveMQConnectionFactory factory,
String theUserName,
String thePassword)
|
|
ActiveMQConnection(ActiveMQConnectionFactory factory,
String theUserName,
String thePassword,
TransportChannel transportChannel)
Constructs a connection from an existing TransportChannel and user/password. |
Method Summary | |
protected void |
addConnectionConsumer(ActiveMQConnectionConsumer connectionConsumer)
Add a ConnectionConsumer |
protected void |
addMessageDispatcher(ActiveMQMessageDispatcher messageDispatch)
Add a Message dispatcher to receive messages from the Broker |
protected void |
addSession(ActiveMQSession session)
Used internally for adding Sessions to the Connection |
protected void |
addToTransientConsumedRedeliverCache(ActiveMQMessage message)
|
void |
asyncSendPacket(Packet packet)
send a Packet through the Connection - for internal use only |
void |
asyncSendPacket(Packet packet,
boolean doSendWhileReconnecting)
send a Packet through the Connection - for internal use only |
void |
capacityChanged(CapacityMonitorEvent event)
CapacityMonitorEventListener implementation called when the capacity of a CapacityService changes |
void |
changeUserInfo(String theUserName,
String thePassword)
Changes the associated username/password that is associated with this connection. |
void |
checkClientIDWasManuallySpecified()
Ensures that the clientID was manually specified and not auto-generated. |
protected void |
checkClosed()
simply throws an exception if the Connection is already closed |
void |
cleanup()
Cleans up this connection so that it's state is as if the connection was just created. |
protected void |
clearMessagesInProgress()
|
void |
close()
Closes the connection. |
protected void |
closeTemporaryDestinations()
|
void |
consume(Packet packet)
Implementation of the PacketListener interface - consume a packet |
ConnectionConsumer |
createConnectionConsumer(Destination destination,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
Creates a connection consumer for this connection (optional operation). |
ConnectionConsumer |
createConnectionConsumer(Destination destination,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages,
boolean noLocal)
Creates a connection consumer for this connection (optional operation). |
ConnectionConsumer |
createConnectionConsumer(Queue queue,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
Creates a connection consumer for this connection (optional operation). |
ConnectionConsumer |
createConnectionConsumer(Topic topic,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
Creates a connection consumer for this connection (optional operation). |
ConnectionConsumer |
createDurableConnectionConsumer(Topic topic,
String subscriptionName,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
Create a durable connection consumer for this connection (optional operation). |
ConnectionConsumer |
createDurableConnectionConsumer(Topic topic,
String subscriptionName,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages,
boolean noLocal)
Create a durable connection consumer for this connection (optional operation). |
QueueSession |
createQueueSession(boolean transacted,
int acknowledgeMode)
Creates a QueueSession object. |
Session |
createSession(boolean transacted,
int acknowledgeMode)
Creates a Session object. |
Session |
createSession(boolean transacted,
int acknowledgeMode,
boolean optimizedDispatch)
Creates a Session object. |
TopicSession |
createTopicSession(boolean transacted,
int acknowledgeMode)
Creates a TopicSession object. |
void |
destroyDestination(ActiveMQDestination destination)
Tells the broker to destroy a destination. |
protected void |
doReconnect()
|
protected short |
generateSessionId()
|
ConcurrentHashMap |
getAssemblies()
|
String |
getClientID()
Gets the client identifier for this connection. |
int |
getConnectionMemoryLimit()
Get the current value for the maximum amount of memory this Connection should use for buffered inbound messages |
JMSConnectionStatsImpl |
getConnectionStats()
|
ExceptionListener |
getExceptionListener()
Gets the ExceptionListener object for this connection. |
ByteArrayFragmentation |
getFragmentation()
|
String |
getInitializedClientID()
Returns the clientID of the connection, forcing one to be generated if one has not yet been configured |
protected MemoryBoundedQueue |
getMemoryBoundedQueue(String name)
|
int |
getMessageCompressionLevel()
|
int |
getMessageCompressionLimit()
|
int |
getMessageCompressionStrategy()
|
int |
getMessageFragmentationLimit()
|
ConnectionMetaData |
getMetaData()
Gets the metadata for this connection. |
protected int |
getNextConsumerNumber()
|
ActiveMQPrefetchPolicy |
getPrefetchPolicy()
|
String |
getResourceManagerId()
|
int |
getSendCloseTimeout()
|
int |
getSendConnectionInfoTimeout()
|
StatsImpl |
getStats()
|
TransportChannel |
getTransportChannel()
|
protected void |
handleAsyncException(JMSException jmsEx)
Used for handling async exceptions |
boolean |
isCachingEnabled()
|
boolean |
isCopyMessageOnSend()
|
boolean |
isDisableTimeStampsByDefault()
|
boolean |
isDoMessageCompression()
|
boolean |
isDoMessageFragmentation()
|
boolean |
isInternalConnection()
|
boolean |
isJ2EEcompliant()
|
boolean |
isOptimizedMessageDispatch()
|
boolean |
isPrepareMessageBodyOnSend()
Causes pre-serialization of messages before send By default this is on |
boolean |
isQuickClose()
|
protected boolean |
isStarted()
|
boolean |
isUseAsyncSend()
|
static ActiveMQConnection |
makeConnection()
A static helper method to create a new connection |
static ActiveMQConnection |
makeConnection(String uri)
A static helper method to create a new connection |
static ActiveMQConnection |
makeConnection(String user,
String password,
String uri)
A static helper method to create a new connection |
void |
onException(JMSException jmsEx)
|
protected void |
removeConnectionConsumer(ActiveMQConnectionConsumer connectionConsumer)
Remove a ConnectionConsumer |
protected void |
removeMessageDispatcher(ActiveMQMessageDispatcher messageDispatcher)
Remove a Message dispatcher |
protected void |
removeSession(ActiveMQSession session)
Used interanlly for removing Sessions from a Connection |
protected void |
replayTransientConsumedRedeliveredMessages(ActiveMQSession session,
ActiveMQMessageConsumer consumer)
|
protected void |
sendConnectionInfoToBroker()
|
protected void |
sendConnectionInfoToBroker(int timeout,
boolean forceResend,
boolean closing)
Send the ConnectionInfo to the Broker |
void |
setCachingEnabled(boolean cachingEnabled)
|
void |
setClientID(String newClientID)
Sets the client identifier for this connection. |
void |
setConnectionMemoryLimit(int newMemoryLimit)
Set the maximum amount of memory this Connection should use for buffered inbound messages |
void |
setCopyMessageOnSend(boolean copyMessageOnSend)
|
void |
setDisableTimeStampsByDefault(boolean disableTimeStampsByDefault)
|
void |
setDoMessageCompression(boolean doMessageCompression)
|
void |
setDoMessageFragmentation(boolean doMessageFragmentation)
|
void |
setExceptionListener(ExceptionListener listener)
Sets an exception listener for this connection. |
void |
setInternalConnection(boolean internalConnection)
|
void |
setJ2EEcompliant(boolean ecompliant)
|
void |
setMessageCompressionLevel(int messageCompressionLevel)
|
void |
setMessageCompressionLimit(int messageCompressionLimit)
|
void |
setMessageCompressionStrategy(int messageCompressionStrategy)
|
void |
setMessageFragmentationLimit(int messageFragmentationLimit)
|
void |
setOptimizedMessageDispatch(boolean optimizedMessageDispatch)
|
void |
setPrefetchPolicy(ActiveMQPrefetchPolicy prefetchPolicy)
|
void |
setPrepareMessageBodyOnSend(boolean prePrepareMessageOnSend)
Causes pre-serialization of messages before send By default this is on |
void |
setQuickClose(boolean quickClose)
|
void |
setSendCloseTimeout(int sendCloseTimeout)
|
void |
setSendConnectionInfoTimeout(int sendConnectionInfoTimeout)
|
void |
setUseAsyncSend(boolean useAsyncSend)
|
void |
start()
Starts (or restarts) a connection's delivery of incoming messages. |
protected void |
startAdvisoryForTempDestination(Destination d)
|
protected void |
startTemporaryDestination(ActiveMQDestination dest)
|
void |
statusChanged(TransportStatusEvent event)
handle disconnect/reconnect events |
void |
stop()
Temporarily stops a connection's delivery of incoming messages. |
protected void |
stopAdvisoryForTempDestination(ActiveMQDestination d)
|
protected void |
stopTemporaryDestination(ActiveMQDestination dest)
|
void |
syncSendPacket(Packet packet)
send a Packet through a Connection - for internal use only |
void |
syncSendPacket(Packet packet,
int timeout)
Send a packet through a Connection - for internal use only |
Receipt |
syncSendRequest(Packet packet)
|
void |
terminateBrokerVM()
Tells the broker to terminate its VM. |
protected void |
validateDestination(ActiveMQDestination dest)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String DEFAULT_USER
public static final String DEFAULT_BROKER_URL
public static final String DEFAULT_URL
DEFAULT_BROKER_URL
,
Constant Field Valuespublic static final String DEFAULT_PASSWORD
protected String clientID
protected IdGenerator handleIdGenerator
protected IdGenerator packetIdGenerator
protected boolean useAsyncSend
Constructor Detail |
public ActiveMQConnection(ActiveMQConnectionFactory factory, String theUserName, String thePassword, TransportChannel transportChannel) throws JMSException
factory
- theUserName
- the users namethePassword
- the passwordtransportChannel
- the transport channel to communicate with the server
JMSException
protected ActiveMQConnection(ActiveMQConnectionFactory factory, String theUserName, String thePassword)
Method Detail |
public static ActiveMQConnection makeConnection() throws JMSException
JMSException
public static ActiveMQConnection makeConnection(String uri) throws JMSException
uri
-
JMSException
public static ActiveMQConnection makeConnection(String user, String password, String uri) throws JMSException
user
- password
- uri
-
JMSException
public StatsImpl getStats()
getStats
in interface StatsCapable
public JMSConnectionStatsImpl getConnectionStats()
public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
Session
object.
createSession
in interface Connection
transacted
- indicates whether the session is transactedacknowledgeMode
- indicates whether the consumer or the client will acknowledge
any messages it receives; ignored if the session is
transacted. Legal values are
Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
, and
Session.DUPS_OK_ACKNOWLEDGE
.
JMSException
- if the Connection
object fails to create a
session due to some internal error or lack of support for the
specific transaction and acknowledgement mode.Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
,
Session.DUPS_OK_ACKNOWLEDGE
public Session createSession(boolean transacted, int acknowledgeMode, boolean optimizedDispatch) throws JMSException
Session
object.
transacted
- indicates whether the session is transactedacknowledgeMode
- indicates whether the consumer or the client will acknowledge
any messages it receives; ignored if the session is
transacted. Legal values are
Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
, and
Session.DUPS_OK_ACKNOWLEDGE
.optimizedDispatch
-
JMSException
- if the Connection
object fails to create a
session due to some internal error or lack of support for the
specific transaction and acknowledgement mode.Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
,
Session.DUPS_OK_ACKNOWLEDGE
public String getClientID() throws JMSException
This value is specific to the JMS provider. It is either preconfigured by
an administrator in a ConnectionFactory
object or assigned
dynamically by the application by calling the setClientID
method.
getClientID
in interface Connection
JMSException
- if the JMS provider fails to return the client ID for this
connection due to some internal error.public void setClientID(String newClientID) throws JMSException
The preferred way to assign a JMS client's client identifier is for it to
be configured in a client-specific ConnectionFactory
object and transparently assigned to the Connection
object
it creates.
Alternatively, a client can set a connection's client identifier using a
provider-specific value. The facility to set a connection's client
identifier explicitly is not a mechanism for overriding the identifier
that has been administratively configured. It is provided for the case
where no administratively specified identifier exists. If one does exist,
an attempt to change it by setting it must throw an IllegalStateException
.
If a client sets the client identifier explicitly, it must do so
immediately after it creates the connection and before any other action
on the connection is taken. After this point, setting the client
identifier is a programming error that should throw an IllegalStateException
.
The purpose of the client identifier is to associate a connection and its objects with a state maintained on behalf of the client by a provider. The only such state identified by the JMS API is that required to support durable subscriptions.
If another connection with the same clientID
is already
running when this method is called, the JMS provider should detect the
duplicate ID and throw an InvalidClientIDException
.
setClientID
in interface Connection
newClientID
- the unique client identifier
JMSException
- if the JMS provider fails to set the client ID for this
connection due to some internal error.
InvalidClientIDException
- if the JMS client specifies an invalid or duplicate client
ID.
IllegalStateException
- if the JMS client attempts to set a connection's client ID at
the wrong time or when it has been administratively
configured.public ConnectionMetaData getMetaData() throws JMSException
getMetaData
in interface Connection
JMSException
- if the JMS provider fails to get the connection metadata for
this connection.ConnectionMetaData
public ExceptionListener getExceptionListener() throws JMSException
ExceptionListener
object for this connection. Not
every Connection
has an ExceptionListener
associated with it.
getExceptionListener
in interface Connection
ExceptionListener
for this connection, or
null. if no ExceptionListener
is associated with
this connection.
JMSException
- if the JMS provider fails to get the ExceptionListener
for this connection.Connection.setExceptionListener(ExceptionListener)
public void setExceptionListener(ExceptionListener listener) throws JMSException
If a JMS provider detects a serious problem with a connection, it informs
the connection's ExceptionListener
, if one has been
registered. It does this by calling the listener's onException
method, passing it a JMSException
object
describing the problem.
An exception listener allows a client to be notified of a problem asynchronously. Some connections only consume messages, so they would have no other way to learn their connection has failed.
A connection serializes execution of its ExceptionListener
.
A JMS provider should attempt to resolve connection problems itself before it notifies the client of them.
setExceptionListener
in interface Connection
listener
- the exception listener
JMSException
- if the JMS provider fails to set the exception listener for
this connection.public void start() throws JMSException
start
on a connection that has already been started is
ignored.
start
in interface Connection
JMSException
- if the JMS provider fails to start message delivery due to
some internal error.Connection.stop()
protected boolean isStarted()
public void stop() throws JMSException
start
method. When
the connection is stopped, delivery to all the connection's message
consumers is inhibited: synchronous receives block, and messages are not
delivered to message listeners.
This call blocks until receives and/or message listeners in progress have completed.
Stopping a connection has no effect on its ability to send messages. A
call to stop
on a connection that has already been stopped
is ignored.
A call to stop
must not return until delivery of messages
has paused. This means that a client can rely on the fact that none of
its message listeners will be called and that all threads of control
waiting for receive
calls to return will not return with a
message until the connection is restarted. The receive timers for a
stopped connection continue to advance, so receives may time out while
the connection is stopped.
If message listeners are running when stop
is invoked, the
stop
call must wait until all of them have returned before
it may return. While these message listeners are completing, they must
have the full services of the connection available to them.
stop
in interface Connection
JMSException
- if the JMS provider fails to stop message delivery due to
some internal error.Connection.start()
public void close() throws JMSException
Since a provider typically allocates significant resources outside the JVM on behalf of a connection, clients should close these resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.
There is no need to close the sessions, producers, and consumers of a closed connection.
Closing a connection causes all temporary destinations to be deleted.
When this method is invoked, it should not return until message
processing has been shut down in an orderly fashion. This means that all
message listeners that may have been running have returned, and that all
pending receives have returned. A close terminates all pending message
receives on the connection's sessions' consumers. The receives may return
with a message or with null, depending on whether there was a message
available at the time of the close. If one or more of the connection's
sessions' message listeners is processing a message at the time when
connection close
is invoked, all the facilities of the
connection and its sessions must remain available to those listeners
until they return control to the JMS provider.
Closing a connection causes any of its sessions' transactions in progress
to be rolled back. In the case where a session's work is coordinated by
an external transaction manager, a session's commit
and
rollback
methods are not used and the result of a closed
session's work is determined later by the transaction manager. Closing a
connection does NOT force an acknowledgment of client-acknowledged
sessions.
Invoking the acknowledge
method of a received message from
a closed connection's session must throw an IllegalStateException
.
Closing a closed connection must NOT throw an exception.
close
in interface Connection
JMSException
- if the JMS provider fails to close the connection due to some
internal error. For example, a failure to release resources
or to close a socket connection can cause this exception to
be thrown.public void terminateBrokerVM() throws JMSException
JMSException
protected void checkClosed() throws JMSException
JMSException
public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
createConnectionConsumer
in interface Connection
destination
- the destination to accessmessageSelector
- only messages with properties matching the message selector
expression are delivered. A value of null or an empty string
indicates that there is no message selector for the message
consumer.sessionPool
- the server session pool to associate with this connection
consumermaxMessages
- the maximum number of messages that can be assigned to a
server session at one time
JMSException
- if the Connection
object fails to create a
connection consumer due to some internal error or invalid
arguments for sessionPool
and messageSelector
.
InvalidDestinationException
- if an invalid destination is specified.
InvalidSelectorException
- if the message selector is invalid.ConnectionConsumer
public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages, boolean noLocal) throws JMSException
destination
- the destination to accessmessageSelector
- only messages with properties matching the message selector
expression are delivered. A value of null or an empty string
indicates that there is no message selector for the message
consumer.sessionPool
- the server session pool to associate with this connection
consumermaxMessages
- the maximum number of messages that can be assigned to a
server session at one timenoLocal
- set true if you want to filter out messages published locally
JMSException
- if the Connection
object fails to create a
connection consumer due to some internal error or invalid
arguments for sessionPool
and messageSelector
.
InvalidDestinationException
- if an invalid destination is specified.
InvalidSelectorException
- if the message selector is invalid.ConnectionConsumer
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
createDurableConnectionConsumer
in interface Connection
topic
- topic to accesssubscriptionName
- durable subscription namemessageSelector
- only messages with properties matching the message selector
expression are delivered. A value of null or an empty string
indicates that there is no message selector for the message
consumer.sessionPool
- the server session pool to associate with this durable
connection consumermaxMessages
- the maximum number of messages that can be assigned to a
server session at one time
JMSException
- if the Connection
object fails to create a
connection consumer due to some internal error or invalid
arguments for sessionPool
and messageSelector
.
InvalidDestinationException
- if an invalid destination is specified.
InvalidSelectorException
- if the message selector is invalid.ConnectionConsumer
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages, boolean noLocal) throws JMSException
topic
- topic to accesssubscriptionName
- durable subscription namemessageSelector
- only messages with properties matching the message selector
expression are delivered. A value of null or an empty string
indicates that there is no message selector for the message
consumer.sessionPool
- the server session pool to associate with this durable
connection consumermaxMessages
- the maximum number of messages that can be assigned to a
server session at one timenoLocal
- set true if you want to filter out messages published locally
JMSException
- if the Connection
object fails to create a
connection consumer due to some internal error or invalid
arguments for sessionPool
and messageSelector
.
InvalidDestinationException
- if an invalid destination is specified.
InvalidSelectorException
- if the message selector is invalid.ConnectionConsumer
public void consume(Packet packet)
consume
in interface PacketListener
packet
- -
the Packet to consumePacketListener.consume(org.activemq.message.Packet)
public void onException(JMSException jmsEx)
onException
in interface ExceptionListener
ExceptionListener.onException(javax.jms.JMSException)
public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
TopicSession
object.
createTopicSession
in interface TopicConnection
transacted
- indicates whether the session is transactedacknowledgeMode
- indicates whether the consumer or the client will acknowledge
any messages it receives; ignored if the session is
transacted. Legal values are
Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
, and
Session.DUPS_OK_ACKNOWLEDGE
.
JMSException
- if the TopicConnection
object fails to create
a session due to some internal error or lack of support for
the specific transaction and acknowledgement mode.Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
,
Session.DUPS_OK_ACKNOWLEDGE
public ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
createConnectionConsumer
in interface TopicConnection
topic
- the topic to accessmessageSelector
- only messages with properties matching the message selector
expression are delivered. A value of null or an empty string
indicates that there is no message selector for the message
consumer.sessionPool
- the server session pool to associate with this connection
consumermaxMessages
- the maximum number of messages that can be assigned to a
server session at one time
JMSException
- if the TopicConnection
object fails to create
a connection consumer due to some internal error or invalid
arguments for sessionPool
and messageSelector
.
InvalidDestinationException
- if an invalid topic is specified.
InvalidSelectorException
- if the message selector is invalid.ConnectionConsumer
public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException
QueueSession
object.
createQueueSession
in interface QueueConnection
transacted
- indicates whether the session is transactedacknowledgeMode
- indicates whether the consumer or the client will acknowledge
any messages it receives; ignored if the session is
transacted. Legal values are
Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
, and
Session.DUPS_OK_ACKNOWLEDGE
.
JMSException
- if the QueueConnection
object fails to create
a session due to some internal error or lack of support for
the specific transaction and acknowledgement mode.Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
,
Session.DUPS_OK_ACKNOWLEDGE
public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
createConnectionConsumer
in interface QueueConnection
queue
- the queue to accessmessageSelector
- only messages with properties matching the message selector
expression are delivered. A value of null or an empty string
indicates that there is no message selector for the message
consumer.sessionPool
- the server session pool to associate with this connection
consumermaxMessages
- the maximum number of messages that can be assigned to a
server session at one time
JMSException
- if the QueueConnection
object fails to create
a connection consumer due to some internal error or invalid
arguments for sessionPool
and messageSelector
.
InvalidDestinationException
- if an invalid queue is specified.
InvalidSelectorException
- if the message selector is invalid.ConnectionConsumer
public void checkClientIDWasManuallySpecified() throws JMSException
JMSException
public void statusChanged(TransportStatusEvent event)
statusChanged
in interface TransportStatusEventListener
event
- public void asyncSendPacket(Packet packet) throws JMSException
packet
-
JMSException
public void asyncSendPacket(Packet packet, boolean doSendWhileReconnecting) throws JMSException
packet
- doSendWhileReconnecting
-
JMSException
public void syncSendPacket(Packet packet) throws JMSException
packet
-
JMSException
public void syncSendPacket(Packet packet, int timeout) throws JMSException
packet
- timeout
-
JMSException
public Receipt syncSendRequest(Packet packet) throws JMSException
JMSException
public ActiveMQPrefetchPolicy getPrefetchPolicy()
public void setPrefetchPolicy(ActiveMQPrefetchPolicy prefetchPolicy)
prefetchPolicy
- The prefetchPolicy to set.public int getSendCloseTimeout()
public void setSendCloseTimeout(int sendCloseTimeout)
public int getSendConnectionInfoTimeout()
public void setSendConnectionInfoTimeout(int sendConnectionInfoTimeout)
public TransportChannel getTransportChannel()
public String getInitializedClientID() throws JMSException
JMSException
protected void addSession(ActiveMQSession session) throws JMSException
session
-
JMSException
protected void removeSession(ActiveMQSession session) throws JMSException
session
-
JMSException
protected void addConnectionConsumer(ActiveMQConnectionConsumer connectionConsumer) throws JMSException
connectionConsumer
-
JMSException
protected void removeConnectionConsumer(ActiveMQConnectionConsumer connectionConsumer)
connectionConsumer
- protected void addMessageDispatcher(ActiveMQMessageDispatcher messageDispatch) throws JMSException
messageDispatch
-
JMSException
- if an internal errorprotected void removeMessageDispatcher(ActiveMQMessageDispatcher messageDispatcher)
messageDispatcher
- protected void handleAsyncException(JMSException jmsEx)
jmsEx
- protected void sendConnectionInfoToBroker() throws JMSException
JMSException
protected void sendConnectionInfoToBroker(int timeout, boolean forceResend, boolean closing) throws JMSException
timeout
-
JMSException
public void setConnectionMemoryLimit(int newMemoryLimit)
newMemoryLimit
- the new memory limit in bytespublic int getConnectionMemoryLimit()
public void capacityChanged(CapacityMonitorEvent event)
capacityChanged
in interface CapacityMonitorEventListener
event
- protected int getNextConsumerNumber()
protected short generateSessionId()
protected MemoryBoundedQueue getMemoryBoundedQueue(String name)
protected void doReconnect()
public boolean isUseAsyncSend()
public void setUseAsyncSend(boolean useAsyncSend)
useAsyncSend
- The useAsyncSend to set.public boolean isCachingEnabled()
public void setCachingEnabled(boolean cachingEnabled)
cachingEnabled
- The cachingEnabled to set.public boolean isJ2EEcompliant()
public void setJ2EEcompliant(boolean ecompliant)
ecompliant
- The j2EEcompliant to set.public boolean isInternalConnection()
public void setInternalConnection(boolean internalConnection)
internalConnection
- The internalConnection to set.public boolean isDoMessageCompression()
public void setDoMessageCompression(boolean doMessageCompression)
doMessageCompression
- The doMessageCompression to set.public boolean isDoMessageFragmentation()
public void setDoMessageFragmentation(boolean doMessageFragmentation)
doMessageFragmentation
- The doMessageFragmentation to set.public int getMessageCompressionLevel()
public void setMessageCompressionLevel(int messageCompressionLevel)
messageCompressionLevel
- The messageCompressionLevel to set.public int getMessageCompressionLimit()
public void setMessageCompressionLimit(int messageCompressionLimit)
messageCompressionLimit
- The messageCompressionLimit to set.public int getMessageCompressionStrategy()
public void setMessageCompressionStrategy(int messageCompressionStrategy)
messageCompressionStrategy
- The messageCompressionStrategy to set.public int getMessageFragmentationLimit()
public void setMessageFragmentationLimit(int messageFragmentationLimit)
messageFragmentationLimit
- The messageFragmentationLimit to set.public boolean isDisableTimeStampsByDefault()
public void setDisableTimeStampsByDefault(boolean disableTimeStampsByDefault)
disableTimeStampsByDefault
- The disableTimeStampsByDefault to set.public boolean isPrepareMessageBodyOnSend()
public void setPrepareMessageBodyOnSend(boolean prePrepareMessageOnSend)
prePrepareMessageOnSend
- The prePrepareMessageOnSend to set.public boolean isCopyMessageOnSend()
public void setCopyMessageOnSend(boolean copyMessageOnSend)
copyMessageOnSend
- The copyMessageOnSend to set.public boolean isQuickClose()
public void setQuickClose(boolean quickClose)
quickClose
- The quickClose to set.public boolean isOptimizedMessageDispatch()
public void setOptimizedMessageDispatch(boolean optimizedMessageDispatch)
optimizedMessageDispatch
- The optimizedMessageDispatch to set.protected void clearMessagesInProgress()
public void destroyDestination(ActiveMQDestination destination) throws JMSException
destination
-
JMSException
public void cleanup() throws JMSException
JMSException
public void changeUserInfo(String theUserName, String thePassword) throws JMSException
IllegalStateException
- if the connection is in used.
JMSException
protected void addToTransientConsumedRedeliverCache(ActiveMQMessage message)
protected void replayTransientConsumedRedeliveredMessages(ActiveMQSession session, ActiveMQMessageConsumer consumer) throws JMSException
JMSException
protected void startTemporaryDestination(ActiveMQDestination dest) throws JMSException
JMSException
protected void stopTemporaryDestination(ActiveMQDestination dest) throws JMSException
JMSException
protected void closeTemporaryDestinations() throws JMSException
JMSException
protected void startAdvisoryForTempDestination(Destination d) throws JMSException
JMSException
protected void stopAdvisoryForTempDestination(ActiveMQDestination d) throws JMSException
JMSException
protected final void validateDestination(ActiveMQDestination dest) throws JMSException
JMSException
public String getResourceManagerId() throws JMSException
JMSException
public ByteArrayFragmentation getFragmentation()
public ConcurrentHashMap getAssemblies()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |