Interface ClientSession
- All Superinterfaces:
AutoCloseable, XAResource
Only a single thread may be used to operate on the session and its child producers and consumers, other than close() methods which may be called from another thread. Setting a MessageHandler on a consumer renders the session, and all its child producers and consumers, to be dedicated to the session-wide handler delivery thread of control.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInformation returned by a binding querystatic interfaceInformation returned by a queue query -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJust likeJMS_SESSION_IDENTIFIER_PROPERTYthis is used to identify the ClientID over JMS Session.static final StringThis is used to identify a ClientSession as used by the JMS Layer The JMS Layer will add this through Meta-data, so the server or management layers can identify session created over core API purely or through the JMS LayerFields inherited from interface XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFailoverListener(FailoverEventListener listener) Adds a FailoverEventListener to the session which is notified if a failover event occurs on the session.voidaddFailureListener(SessionFailureListener listener) Adds a FailureListener to the session which is notified if a failure occurs on the session.voidaddMetaData(String key, String data) Attach any metadata to the session.addressQuery(SimpleString address) Queries information on a binding.voidaddUniqueMetaData(String key, String data) Attach any metadata to the session.voidclose()Closes the session.voidcommit()Commits the current transaction, blocking.voidcommit(boolean block) Commits the current transaction.voidcreateAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) Create Address with a single initial routing typevoidcreateAddress(SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated) Deprecated.voidcreateAddress(SimpleString address, RoutingType routingType, boolean autoCreated) Create Address with a single initial routing typecreateConsumer(String queueName) Creates a ClientConsumer to consume messages from the queue with the given name.createConsumer(String queueName, boolean browseOnly) Creates a ClientConsumer to consume or browse messages from the queue with the given name.createConsumer(String queueName, String filter) Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.createConsumer(String queueName, String filter, boolean browseOnly) Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.createConsumer(String queueName, String filter, int windowSize, int maxRate, boolean browseOnly) Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.createConsumer(SimpleString queueName) Creates a ClientConsumer to consume message from the queue with the given name.createConsumer(SimpleString queueName, boolean browseOnly) Creates a ClientConsumer to consume or browse messages from the queue with the given name.createConsumer(SimpleString queueName, SimpleString filter) Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.createConsumer(SimpleString queueName, SimpleString filter, boolean browseOnly) Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.createConsumer(SimpleString queueName, SimpleString filter, int priority, boolean browseOnly) Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.createConsumer(SimpleString queueName, SimpleString filter, int windowSize, int maxRate, boolean browseOnly) Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.createConsumer(SimpleString queueName, SimpleString filter, int priority, int windowSize, int maxRate, boolean browseOnly) Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.createMessage(boolean durable) Creates a ClientMessage.createMessage(byte type, boolean durable) Creates a ClientMessage.createMessage(byte type, boolean durable, long expiration, long timestamp, byte priority) Creates a ClientMessage.Creates a producer with no default address.createProducer(String address) Creates a producer which sends messages to the given addresscreateProducer(SimpleString address) Creates a producer which sends messages to the given addresscreateProducer(SimpleString address, int rate) Creates a producer which sends messages to the given addressvoidcreateQueue(String address, String queueName) Deprecated.voidcreateQueue(String address, String queueName, boolean durable) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(String address, String queueName, String filter, boolean durable) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(String address, String queueName, String filter, boolean durable, boolean autoCreated) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(String address, RoutingType routingType, String queueName) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(String address, RoutingType routingType, String queueName, boolean durable) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(QueueConfiguration queueConfiguration) This method creates a queue based on theQueueConfigurationinput.voidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, SimpleString queueName) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, SimpleString queueName, boolean durable) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, SimpleString queueName, boolean autoCreated, QueueAttributes queueAttributes) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateSharedQueue(QueueConfiguration queueConfiguration) This method is essentially the same ascreateQueue(QueueConfiguration)with a few key exceptions.voidcreateSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) Deprecated.usecreateSharedQueue(QueueConfiguration)insteadvoidcreateSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable) Deprecated.usecreateSharedQueue(QueueConfiguration)insteadvoidcreateSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) Deprecated.usecreateSharedQueue(QueueConfiguration)insteadvoidcreateSharedQueue(SimpleString address, SimpleString queueName, boolean durable) Deprecated.usecreateSharedQueue(QueueConfiguration)insteadvoidcreateSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) Deprecated.usecreateSharedQueue(QueueConfiguration)insteadvoidcreateSharedQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable) Deprecated.usecreateSharedQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(String address, String queueName) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(String address, String queueName, String filter) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(String address, RoutingType routingType, String queueName) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(String address, RoutingType routingType, String queueName, String filter) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(SimpleString address, SimpleString queueName) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) Deprecated.usecreateQueue(QueueConfiguration)insteadvoidcreateTemporaryQueue(SimpleString address, SimpleString queueName, SimpleString filter) Deprecated.usecreateQueue(QueueConfiguration)insteadvoiddeleteQueue(String queueName) Deletes the queue.voiddeleteQueue(SimpleString queueName) Deletes the queue.Returns theClientSessionFactoryused to created thisClientSession.intReturns the server'sincrementingVersion.Returns the XAResource associated to the session.booleanReturnstrueif the session automatically commit its transaction every time a message is acknowledged by a ClientConsumer created by this session,falseelse.booleanReturns whether the session will automatically commit its transaction every time a message is sent by a ClientProducer created by this session,falseelse.booleanReturnstrueif the session's ClientConsumer block when they acknowledge a message,falseelse.booleanisClosed()Returnstrueif the session is closed,falseelse.booleanReturnstrueif the current transaction has been flagged to rollback,falseelse.booleanisXA()Returnstrueif the session supports XA,falseelse.queueQuery(SimpleString queueName) Queries information on a queue.booleanremoveFailoverListener(FailoverEventListener listener) Removes a FailoverEventListener to the session.booleanremoveFailureListener(SessionFailureListener listener) Removes a FailureListener to the session.voidrollback()Rolls back the current transaction.voidrollback(boolean considerLastMessageAsDelivered) Rolls back the current transaction.Sets aSendAcknowledgementHandlerfor this session.start()Starts the session.voidstop()Stops the session.Methods inherited from interface XAResource
commit, end, forget, getTransactionTimeout, isSameRM, prepare, recover, rollback, setTransactionTimeout, start
-
Field Details
-
JMS_SESSION_IDENTIFIER_PROPERTY
This is used to identify a ClientSession as used by the JMS Layer The JMS Layer will add this through Meta-data, so the server or management layers can identify session created over core API purely or through the JMS Layer- See Also:
-
JMS_SESSION_CLIENT_ID_PROPERTY
Just likeJMS_SESSION_IDENTIFIER_PROPERTYthis is used to identify the ClientID over JMS Session. However this is only used when the JMS Session.clientID is set (which is optional). With this property management tools and the server can identify the jms-client-id used over JMS- See Also:
-
-
Method Details
-
start
Starts the session. The session must be started before ClientConsumers created by the session can consume messages from the queue.- Throws:
ActiveMQException- if an exception occurs while starting the session
-
stop
Stops the session. ClientConsumers created by the session can not consume messages when the session is stopped.- Throws:
ActiveMQException- if an exception occurs while stopping the session
-
close
Closes the session.- Specified by:
closein interfaceAutoCloseable- Throws:
ActiveMQException- if an exception occurs while closing the session
-
isClosed
boolean isClosed()Returnstrueif the session is closed,falseelse.- Returns:
trueif the session is closed,falseelse
-
addFailureListener
Adds a FailureListener to the session which is notified if a failure occurs on the session.- Parameters:
listener- the listener to add
-
removeFailureListener
Removes a FailureListener to the session.- Parameters:
listener- the listener to remove- Returns:
trueif the listener was removed,falseelse
-
addFailoverListener
Adds a FailoverEventListener to the session which is notified if a failover event occurs on the session.- Parameters:
listener- the listener to add
-
removeFailoverListener
Removes a FailoverEventListener to the session.- Parameters:
listener- the listener to remove- Returns:
trueif the listener was removed,falseelse
-
getVersion
int getVersion()Returns the server'sincrementingVersion.- Returns:
- the server's
incrementingVersion
-
createAddress
void createAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException Create Address with a single initial routing type- Throws:
ActiveMQException
-
createAddress
@Deprecated void createAddress(SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException Deprecated.Create Address with a single initial routing type- Throws:
ActiveMQException
-
createAddress
void createAddress(SimpleString address, RoutingType routingType, boolean autoCreated) throws ActiveMQException Create Address with a single initial routing type- Throws:
ActiveMQException
-
createQueue
This method creates a queue based on theQueueConfigurationinput. SeeQueueConfigurationfor more details on configuration specifics.Some static defaults will be enforced for properties which are not set on the
QueueConfiguration:transient:falsetemporary:falsedurable:trueautoCreated:falseinternal:falseconfigurationManaged:falsemaxConsumers:ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers()purgeOnNoConsumers:ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers()
exclusivegroupRebalancegroupBucketsgroupFirstKeylastValuelastValueKeynonDestructiveconsumersBeforeDispatchdelayBeforeDispatchringSizeroutingTypeautoCreateAddressautoDelete(only set if queue was auto-created)autoDeleteDelayautoDeleteMessageCount
- Parameters:
queueConfiguration- the configuration to use when creating the queue- Throws:
ActiveMQException
-
createQueue
@Deprecated void createQueue(SimpleString address, SimpleString queueName, boolean durable) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuedurable- whether the queue is durable or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(String address, String queueName, boolean durable) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuedurable- whether the queue is durable or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue non-durable queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue non-durable queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(String address, String queueName, String filter, boolean durable) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporaryqueue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or notautoCreated- whether to mark this queue as autoCreated or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(String address, String queueName, String filter, boolean durable, boolean autoCreated) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporaryqueue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or notautoCreated- whether to mark this queue as autoCreated or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(SimpleString address, SimpleString queueName) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(SimpleString address, SimpleString queueName, SimpleString filter) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue with a filter.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuefilter- only messages which match this filter will be put in the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(String address, String queueName, String filter) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue with a filter.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuefilter- only messages which match this filter will be put in the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuedurable- whether the queue is durable or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(String address, RoutingType routingType, String queueName, boolean durable) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuedurable- whether the queue is durable or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue non-durable queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue non-durable queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporaryqueue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or notautoCreated- whether to mark this queue as autoCreated or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or notautoCreated- whether to mark this queue as autoCreated or notmaxConsumers- how many concurrent consumers will be allowed on this queuepurgeOnNoConsumers- whether to delete the contents of the queue when the last consumer disconnects- Throws:
ActiveMQException
-
createQueue
@Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or notautoCreated- whether to mark this queue as autoCreated or notmaxConsumers- how many concurrent consumers will be allowed on this queuepurgeOnNoConsumers- whether to delete the contents of the queue when the last consumer disconnectsexclusive- whether the queue should be exclusivelastValue- whether the queue should be lastValue- Throws:
ActiveMQException
-
createQueue
@Deprecated void createQueue(SimpleString address, SimpleString queueName, boolean autoCreated, QueueAttributes queueAttributes) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporary queue.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queueautoCreated- whether to mark this queue as autoCreated or notqueueAttributes- attributes for the queue- Throws:
ActiveMQException
-
createQueue
@Deprecated void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporaryqueue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or notautoCreated- whether to mark this queue as autoCreated or not- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createQueue
@Deprecated void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporaryqueue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or notautoCreated- whether to mark this queue as autoCreated or notmaxConsumers- how many concurrent consumers will be allowed on this queuepurgeOnNoConsumers- whether to delete the contents of the queue when the last consumer disconnects- Throws:
ActiveMQException
-
createQueue
@Deprecated void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a non-temporaryqueue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuedurable- whether the queue is durable or notautoCreated- whether to mark this queue as autoCreated or notmaxConsumers- how many concurrent consumers will be allowed on this queuepurgeOnNoConsumers- whether to delete the contents of the queue when the last consumer disconnectsexclusive- whether the queue should be exclusivelastValue- whether the queue should be lastValue- Throws:
ActiveMQException
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue with a filter.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queuemaxConsumers- how many concurrent consumers will be allowed on this queuepurgeOnNoConsumers- whether to delete the contents of the queue when the last consumer disconnectsexclusive- if the queue is exclusive queuelastValue- if the queue is last value queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue with a filter.- Parameters:
address- the queue will be bound to this addressqueueName- the name of the queuequeueAttributes- attributes for the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue with a filter.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
createTemporaryQueue
@Deprecated void createTemporaryQueue(String address, RoutingType routingType, String queueName, String filter) throws ActiveMQException Deprecated.usecreateQueue(QueueConfiguration)insteadCreates a temporary queue with a filter.- Parameters:
address- the queue will be bound to this addressroutingType- the routing type for this queue, MULTICAST or ANYCASTqueueName- the name of the queuefilter- only messages which match this filter will be put in the queue- Throws:
ActiveMQException- in an exception occurs while creating the queue
-
deleteQueue
Deletes the queue.- Parameters:
queueName- the name of the queue to delete- Throws:
ActiveMQException- if there is no queue for the given name or if the queue has consumers
-
deleteQueue
Deletes the queue.- Parameters:
queueName- the name of the queue to delete- Throws:
ActiveMQException- if there is no queue for the given name or if the queue has consumers
-
createConsumer
Creates a ClientConsumer to consume message from the queue with the given name.- Parameters:
queueName- name of the queue to consume messages from- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
Creates a ClientConsumer to consume messages from the queue with the given name.- Parameters:
queueName- name of the queue to consume messages from- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.- Parameters:
queueName- name of the queue to consume messages fromfilter- only messages which match this filter will be consumed- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.- Parameters:
queueName- name of the queue to consume messages fromfilter- only messages which match this filter will be consumed- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
Creates a ClientConsumer to consume or browse messages from the queue with the given name.If
browseOnlyistrue, the ClientConsumer will receive the messages from the queue but they will not be consumed (the messages will remain in the queue). Note that paged messages will not be in the queue, and will therefore not be visible ifbrowseOnlyistrue.If
browseOnlyisfalse, the ClientConsumer will behave like consume the messages from the queue and the messages will effectively be removed from the queue.- Parameters:
queueName- name of the queue to consume messages frombrowseOnly- whether the ClientConsumer will only browse the queue or consume messages.- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
Creates a ClientConsumer to consume or browse messages from the queue with the given name.If
browseOnlyistrue, the ClientConsumer will receive the messages from the queue but they will not be consumed (the messages will remain in the queue). Note that paged messages will not be in the queue, and will therefore not be visible ifbrowseOnlyistrue.If
browseOnlyisfalse, the ClientConsumer will behave like consume the messages from the queue and the messages will effectively be removed from the queue.- Parameters:
queueName- name of the queue to consume messages frombrowseOnly- whether the ClientConsumer will only browse the queue or consume messages.- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
ClientConsumer createConsumer(String queueName, String filter, boolean browseOnly) throws ActiveMQException Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.If
browseOnlyistrue, the ClientConsumer will receive the messages from the queue but they will not be consumed (the messages will remain in the queue). Note that paged messages will not be in the queue, and will therefore not be visible ifbrowseOnlyistrue.If
browseOnlyisfalse, the ClientConsumer will behave like consume the messages from the queue and the messages will effectively be removed from the queue.- Parameters:
queueName- name of the queue to consume messages fromfilter- only messages which match this filter will be consumedbrowseOnly- whether the ClientConsumer will only browse the queue or consume messages.- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
ClientConsumer createConsumer(SimpleString queueName, SimpleString filter, boolean browseOnly) throws ActiveMQException Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.If
browseOnlyistrue, the ClientConsumer will receive the messages from the queue but they will not be consumed (the messages will remain in the queue). Note that paged messages will not be in the queue, and will therefore not be visible ifbrowseOnlyistrue.If
browseOnlyisfalse, the ClientConsumer will behave like consume the messages from the queue and the messages will effectively be removed from the queue.- Parameters:
queueName- name of the queue to consume messages fromfilter- only messages which match this filter will be consumedbrowseOnly- whether the ClientConsumer will only browse the queue or consume messages.- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
ClientConsumer createConsumer(SimpleString queueName, SimpleString filter, int priority, boolean browseOnly) throws ActiveMQException Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.If
browseOnlyistrue, the ClientConsumer will receive the messages from the queue but they will not be consumed (the messages will remain in the queue). Note that paged messages will not be in the queue, and will therefore not be visible ifbrowseOnlyistrue.If
browseOnlyisfalse, the ClientConsumer will behave like consume the messages from the queue and the messages will effectively be removed from the queue.- Parameters:
queueName- name of the queue to consume messages fromfilter- only messages which match this filter will be consumedpriority- the consumer prioritybrowseOnly- whether the ClientConsumer will only browse the queue or consume messages.- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
ClientConsumer createConsumer(SimpleString queueName, SimpleString filter, int windowSize, int maxRate, boolean browseOnly) throws ActiveMQException Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.If
browseOnlyistrue, the ClientConsumer will receive the messages from the queue but they will not be consumed (the messages will remain in the queue). Note that paged messages will not be in the queue, and will therefore not be visible ifbrowseOnlyistrue.If
browseOnlyisfalse, the ClientConsumer will behave like consume the messages from the queue and the messages will effectively be removed from the queue.- Parameters:
queueName- name of the queue to consume messages fromfilter- only messages which match this filter will be consumedwindowSize- the consumer window sizemaxRate- the maximum rate to consume messagesbrowseOnly- whether the ClientConsumer will only browse the queue or consume messages.- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
ClientConsumer createConsumer(SimpleString queueName, SimpleString filter, int priority, int windowSize, int maxRate, boolean browseOnly) throws ActiveMQException Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.If
browseOnlyistrue, the ClientConsumer will receive the messages from the queue but they will not be consumed (the messages will remain in the queue). Note that paged messages will not be in the queue, and will therefore not be visible ifbrowseOnlyistrue.If
browseOnlyisfalse, the ClientConsumer will behave like consume the messages from the queue and the messages will effectively be removed from the queue.- Parameters:
queueName- name of the queue to consume messages fromfilter- only messages which match this filter will be consumedpriority- the consumer prioritywindowSize- the consumer window sizemaxRate- the maximum rate to consume messagesbrowseOnly- whether the ClientConsumer will only browse the queue or consume messages.- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createConsumer
ClientConsumer createConsumer(String queueName, String filter, int windowSize, int maxRate, boolean browseOnly) throws ActiveMQException Creates a ClientConsumer to consume or browse messages matching the filter from the queue with the given name.If
browseOnlyistrue, the ClientConsumer will receive the messages from the queue but they will not be consumed (the messages will remain in the queue). Note that paged messages will not be in the queue, and will therefore not be visible ifbrowseOnlyistrue.If
browseOnlyisfalse, the ClientConsumer will behave like consume the messages from the queue and the messages will effectively be removed from the queue.- Parameters:
queueName- name of the queue to consume messages fromfilter- only messages which match this filter will be consumedwindowSize- the consumer window sizemaxRate- the maximum rate to consume messagesbrowseOnly- whether the ClientConsumer will only browse the queue or consume messages.- Returns:
- a ClientConsumer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientConsumer
-
createProducer
Creates a producer with no default address. Address must be specified every time a message is sent- Returns:
- a ClientProducer
- Throws:
ActiveMQException- See Also:
-
createProducer
Creates a producer which sends messages to the given address- Parameters:
address- the address to send messages to- Returns:
- a ClientProducer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientProducer
-
createProducer
Creates a producer which sends messages to the given address- Parameters:
address- the address to send messages to- Returns:
- a ClientProducer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientProducer
-
createProducer
Creates a producer which sends messages to the given address- Parameters:
address- the address to send messages torate- the producer rate- Returns:
- a ClientProducer
- Throws:
ActiveMQException- if an exception occurs while creating the ClientProducer
-
createMessage
Creates a ClientMessage.- Parameters:
durable- whether the created message is durable or not- Returns:
- a ClientMessage
-
createMessage
Creates a ClientMessage.- Parameters:
type- type of the messagedurable- whether the created message is durable or not- Returns:
- a ClientMessage
-
createMessage
ClientMessage createMessage(byte type, boolean durable, long expiration, long timestamp, byte priority) Creates a ClientMessage.- Parameters:
type- type of the messagedurable- whether the created message is durable or notexpiration- the message expirationtimestamp- the message timestamppriority- the message priority (between 0 and 9 inclusive)- Returns:
- a ClientMessage
-
queueQuery
Queries information on a queue.- Parameters:
queueName- the name of the queue to query- Returns:
- a QueueQuery containing information on the given queue
- Throws:
ActiveMQException- if an exception occurs while querying the queue
-
addressQuery
Queries information on a binding.- Parameters:
address- the address of the biding to query- Returns:
- an AddressQuery containing information on the binding attached to the given address
- Throws:
ActiveMQException- if an exception occurs while querying the binding
-
getXAResource
XAResource getXAResource()Returns the XAResource associated to the session.- Returns:
- the XAResource associated to the session
-
isXA
boolean isXA()Returnstrueif the session supports XA,falseelse.- Returns:
trueif the session supports XA,falseelse
-
commit
Commits the current transaction, blocking.- Throws:
ActiveMQException- if an exception occurs while committing the transaction
-
commit
Commits the current transaction.- Parameters:
block- if the commit will be blocking or not.- Throws:
ActiveMQException- if an exception occurs while committing the transaction
-
rollback
Rolls back the current transaction.- Throws:
ActiveMQException- if an exception occurs while rolling back the transaction
-
rollback
Rolls back the current transaction.- Parameters:
considerLastMessageAsDelivered- the first message on deliveringMessage Buffer is considered as delivered- Throws:
ActiveMQException- if an exception occurs while rolling back the transaction
-
isRollbackOnly
boolean isRollbackOnly()Returnstrueif the current transaction has been flagged to rollback,falseelse.- Returns:
trueif the current transaction has been flagged to rollback,falseelse
-
isAutoCommitSends
boolean isAutoCommitSends()Returns whether the session will automatically commit its transaction every time a message is sent by a ClientProducer created by this session,falseelse.- Returns:
- whether the session will automatically commit its transaction every time a message is sent by a
ClientProducer created by this session,
falseelse
-
isAutoCommitAcks
boolean isAutoCommitAcks()Returnstrueif the session automatically commit its transaction every time a message is acknowledged by a ClientConsumer created by this session,falseelse.- Returns:
trueif the session automatically commit its transaction every time a message is acknowledged by a ClientConsumer created by this session,falseelse
-
isBlockOnAcknowledge
boolean isBlockOnAcknowledge()Returnstrueif the session's ClientConsumer block when they acknowledge a message,falseelse.- Returns:
trueif the session's ClientConsumer block when they acknowledge a message,falseelse
-
setSendAcknowledgementHandler
Sets aSendAcknowledgementHandlerfor this session.- Parameters:
handler- a SendAcknowledgementHandler- Returns:
- this ClientSession
-
addMetaData
Attach any metadata to the session.- Throws:
ActiveMQException
-
addUniqueMetaData
Attach any metadata to the session. Throws an exception if there's already a metadata available. You can use this metadata to ensure that there is no other session with the same meta-data you are passing as an argument. This is useful to simulate unique client-ids, where you may want to avoid multiple instances of your client application connected.- Throws:
ActiveMQException
-
getSessionFactory
ClientSessionFactory getSessionFactory()Returns theClientSessionFactoryused to created thisClientSession.- Returns:
- the
ClientSessionFactoryused to created thisClientSession
-
createQueue(QueueConfiguration)instead