Class Queue
- java.lang.Object
-
- org.objectweb.joram.client.jms.admin.AdministeredObject
-
- org.objectweb.joram.client.jms.Destination
-
- org.objectweb.joram.client.jms.Queue
-
- All Implemented Interfaces:
Serializable,Destination,Queue,Referenceable,DestinationMBean,QueueMBean
- Direct Known Subclasses:
DeadMQueue,TemporaryQueue
public class Queue extends Destination implements Queue, QueueMBean
Implements thejavax.jms.Queueinterface.This is a proxy object a client uses to specify the destination of messages it is sending and the source of messages it receives.
The Queue class is a factory for Joram's Queue destination through the create static methods, the Queue object provides Joram specific administration and monitoring methods.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringDELIVERY_DELAYProperty allowing to fix DeliveryDelaystatic StringREDELIVERY_DELAYProperty allowing to fix RedeliveryDelayprivate static longserialVersionUIDdefine serialVersionUID for interoperability-
Fields inherited from class org.objectweb.joram.client.jms.Destination
ACQUISITION_QUEUE, ACQUISITION_TOPIC, adminName, agentId, ALIAS_QUEUE, CLUSTER_QUEUE, DEAD_MQUEUE, DISTRIBUTION_QUEUE, DISTRIBUTION_TOPIC, FTP_QUEUE, JMXBeanName, logger, QUEUE, QUEUE_TYPE, SCHEDULER_QUEUE, TEMPORARY, TOPIC, TOPIC_TYPE, wrapper
-
Fields inherited from class org.objectweb.joram.client.jms.admin.AdministeredObject
rand
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddClusteredQueue(Queue addedQueue)Adds a queue into the cluster this queue belongs to.voidaddRemoteDestination(String destId)Adds a destination to an alias queue's destinations' list.voidaddRemoteDestination(Queue remote)Adds a destination to an alias queue's destinations' list.voidclear()static Queuecreate()Administration method creating and deploying a queue on the local server.static Queuecreate(int serverId)Administration method creating and deploying a queue on a given server.static Queuecreate(int serverId, String name)Administration method creating and deploying (or retrieving) a queue on a given server with a given name.static Queuecreate(int serverId, String name, String className, Properties prop)Administration method creating and deploying (or retrieving) a queue on a given server.static Queuecreate(int serverId, String className, Properties prop)Administration method creating and deploying a queue on a given server.static Queuecreate(int serverId, Properties prop)Administration method creating and deploying a queue on a given server.static Queuecreate(String name)Administration method creating and deploying (or retrieving) a queue on the local server.static QueuecreateQueue(String agentId, String name)voiddeleteMessage(String msgId)voiddelRemoteDestination(String destId)Removes a destination from an alias queue's destinations' list.voiddelRemoteDestination(Queue remote)Removes a destination from an alias queue's destinations' list.intgetDeliveredMessages()Monitoring method returning the number of delivered messages since the queue's creation.MessagegetMessage(String msgId)Returns a copy of the message.StringgetMessageDigest(String msgId)PropertiesgetMessageHeader(String msgId)String[]getMessageIds()Returns the identifiers of all messages in this queue.PropertiesgetMessageProperties(String msgId)intgetNbMaxMsg()Monitoring method returning the nbMaxMsg of this queue, -1 if no limit.intgetPendingMessages()Monitoring method returning the number of pending messages on this queue.intgetPendingRequests()Monitoring method returning the number of pending requests on this queue.String[]getQueueClusterElements()Returns the reference of the queues that belong to the cluster.StringgetQueueName()API method.intgetThreshold()Monitoring method returning the threshold of this queue, -1 if not set.MessagereadMessage(String msgId)Deprecated.Since Joram 5.2 use getMessage.voidregisterAsDefaultDMQ()Sets the current queue as the default DMQ for the local server.voidregisterAsDefaultDMQ(int serverId)Sets the current queue as the default DMQ for the given server.voidremoveClusteredQueue(Queue removedQueue)Deprecated.voidremoveFromCluster()Removes this queue from the cluster it belongs to.voidsendDestinationsWeights(int[] weights)Set weights for each remote destination of this alias queue.voidsetDeliveryDelay(int deliveryDelay)Set deliveryDelay attribute.voidsetNbMaxMsg(int nbMaxMsg)Administration method setting nbMaxMsg for this queue.voidsetPause(boolean pause)Stops / Resumes the message delivery.org.objectweb.joram.shared.admin.AdminReplysetProperties(Properties prop)Administration method to set properties.voidsetRedeliveryDelay(int redeliveryDelay)Set redeliveryDelay attribute.voidsetSyncExceptionOnFull(boolean syncExceptionOnFull)Administration method setting syncExceptionOnFull for this queue.voidsetThreshold(int threshold)Administration method setting or unsetting the threshold for this queue.StringtoString()Returns a String image of the queue.-
Methods inherited from class org.objectweb.joram.client.jms.Destination
addInterceptor, addInterceptors, addReader, addWriter, check, checkId, delete, doCreate, doRequest, equals, fromReference, getAdminName, getDMQ, getDMQId, getInterceptors, getJMXBeanName, getName, getReaderList, getReaders, getStatistic, getStatistics, getStatistics, getType, getWrapper, getWriterList, getWriters, hashCode, isFreelyReadable, isFreelyWriteable, isQueue, isTopic, newInstance, registerMBean, removeInterceptors, removeReader, removeWriter, replaceInterceptor, replaceInterceptor, scale, setDMQ, setDMQId, setFreelyReadable, setFreelyWriteable, setFreeReading, setFreeWriting, setReader, setWrapper, setWriter, toReference, toXml, unregisterMBean, unsetFreeReading, unsetFreeWriting, unsetReader, unsetWriter
-
Methods inherited from class org.objectweb.joram.client.jms.admin.AdministeredObject
getReference
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.objectweb.joram.client.jms.DestinationMBean
addInterceptors, addReader, addWriter, delete, getAdminName, getDMQId, getInterceptors, getName, getReaderList, getStatistic, getStatistics, getWriterList, isFreelyReadable, isFreelyWriteable, isQueue, isTopic, removeInterceptors, removeReader, removeWriter, setDMQId, setFreelyReadable, setFreelyWriteable
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
REDELIVERY_DELAY
public static final String REDELIVERY_DELAY
Property allowing to fix RedeliveryDelay- See Also:
- Constant Field Values
-
DELIVERY_DELAY
public static final String DELIVERY_DELAY
Property allowing to fix DeliveryDelay- See Also:
- Constant Field Values
-
-
Method Detail
-
toString
public String toString()
Returns a String image of the queue.
-
getQueueName
public String getQueueName() throws JMSException
API method. Gets the The Joram's internal unique identifier of this queue.- Specified by:
getQueueNamein interfaceQueue- Returns:
- The Joram's internal unique identifier.
- Throws:
JMSException- Actually never thrown.
-
create
public static Queue create() throws ConnectException, AdminException
Administration method creating and deploying a queue on the local server.The request fails if the destination deployment fails server side.
Be careful this method use the static AdminModule connection.
- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
create
public static Queue create(int serverId) throws ConnectException, AdminException
Administration method creating and deploying a queue on a given server.The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.
Be careful this method use the static AdminModule connection.
- Parameters:
serverId- The identifier of the server where deploying the queue.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
create
public static Queue create(String name) throws ConnectException, AdminException
Administration method creating and deploying (or retrieving) a queue on the local server. First a destination with the specified name is searched on the given server, if it does not exist it is created. In any case, its provider-specific address is returned.The request fails if the destination deployment fails server side.
Be careful this method use the static AdminModule connection.
- Parameters:
name- The queue name.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
create
public static Queue create(int serverId, String name) throws ConnectException, AdminException
Administration method creating and deploying (or retrieving) a queue on a given server with a given name. First a destination with the specified name is searched on the given server, if it does not exist it is created. In any case, its provider-specific address is returned.The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.
Be careful this method use the static AdminModule connection.
- Parameters:
serverId- The identifier of the server where deploying the queue.name- The queue name.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
create
public static Queue create(int serverId, Properties prop) throws ConnectException, AdminException
Administration method creating and deploying a queue on a given server. It creates a Joram's standard queue.The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.
Be careful this method use the static AdminModule connection.
- Parameters:
serverId- The identifier of the server where deploying the queue.prop- The queue properties.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
create
public static Queue create(int serverId, String className, Properties prop) throws ConnectException, AdminException
Administration method creating and deploying a queue on a given server.The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.
Be careful this method use the static AdminModule connection.
- Parameters:
serverId- The identifier of the server where deploying the queue.className- The queue class name.prop- The queue properties.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
create
public static Queue create(int serverId, String name, String className, Properties prop) throws ConnectException, AdminException
Administration method creating and deploying (or retrieving) a queue on a given server. First a destination with the specified name is searched on the given server, if it does not exist it is created. In any case, its provider-specific address is returned.The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.
Be careful this method use the static AdminModule connection.
- Parameters:
serverId- The identifier of the server where deploying the queue.name- The name of the queue.className- The MOM's queue class name.prop- The queue properties.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
setThreshold
public void setThreshold(int threshold) throws ConnectException, AdminExceptionAdministration method setting or unsetting the threshold for this queue.The request fails if the queue is deleted server side.
- Specified by:
setThresholdin interfaceQueueMBean- Parameters:
threshold- The threshold value to be set (-1 for unsetting previous value).- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
getThreshold
public int getThreshold() throws ConnectException, AdminExceptionMonitoring method returning the threshold of this queue, -1 if not set.The request fails if the queue is deleted server side.
- Specified by:
getThresholdin interfaceQueueMBean- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
setNbMaxMsg
public void setNbMaxMsg(int nbMaxMsg) throws ConnectException, AdminExceptionAdministration method setting nbMaxMsg for this queue.The request fails if the queue is deleted server side.
- Specified by:
setNbMaxMsgin interfaceQueueMBean- Parameters:
nbMaxMsg- nb Max of Message (-1 no limit).- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
getNbMaxMsg
public int getNbMaxMsg() throws ConnectException, AdminExceptionMonitoring method returning the nbMaxMsg of this queue, -1 if no limit.The request fails if the queue is deleted server side.
- Specified by:
getNbMaxMsgin interfaceQueueMBean- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
setSyncExceptionOnFull
public void setSyncExceptionOnFull(boolean syncExceptionOnFull) throws ConnectException, AdminExceptionAdministration method setting syncExceptionOnFull for this queue.The request fails if the queue is deleted server side.
- Parameters:
syncExceptionOnFull- true, throws an exception on sending message on full destination.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
getPendingMessages
public int getPendingMessages() throws ConnectException, AdminExceptionMonitoring method returning the number of pending messages on this queue.The request fails if the queue is deleted server side.
- Specified by:
getPendingMessagesin interfaceQueueMBean- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
getPendingRequests
public int getPendingRequests() throws ConnectException, AdminExceptionMonitoring method returning the number of pending requests on this queue.The request fails if the queue is deleted server side.
- Specified by:
getPendingRequestsin interfaceQueueMBean- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
getDeliveredMessages
public int getDeliveredMessages() throws ConnectException, AdminExceptionMonitoring method returning the number of delivered messages since the queue's creation.The request fails if the queue is deleted server side.
- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
getMessageIds
public String[] getMessageIds() throws AdminException, ConnectException
Returns the identifiers of all messages in this queue.- Specified by:
getMessageIdsin interfaceQueueMBean- Returns:
- The identifiers of all messages in this queue.
- Throws:
AdminExceptionConnectException- See Also:
QueueMBean.getMessageIds()
-
getMessage
public Message getMessage(String msgId) throws AdminException, ConnectException, JMSException
Returns a copy of the message.- Parameters:
msgId- The identifier of the message.- Returns:
- The message
- Throws:
AdminExceptionConnectExceptionJMSException
-
readMessage
public Message readMessage(String msgId) throws AdminException, ConnectException, JMSException
Deprecated.Since Joram 5.2 use getMessage.Returns a copy of the message.- Parameters:
msgId- The identifier of the message.- Returns:
- The message
- Throws:
AdminExceptionConnectExceptionJMSException
-
getMessageDigest
public String getMessageDigest(String msgId) throws AdminException, ConnectException, JMSException
- Specified by:
getMessageDigestin interfaceQueueMBean- Throws:
AdminExceptionConnectExceptionJMSException
-
getMessageHeader
public Properties getMessageHeader(String msgId) throws AdminException, ConnectException, JMSException
- Specified by:
getMessageHeaderin interfaceQueueMBean- Throws:
AdminExceptionConnectExceptionJMSException
-
getMessageProperties
public Properties getMessageProperties(String msgId) throws AdminException, ConnectException, JMSException
- Specified by:
getMessagePropertiesin interfaceQueueMBean- Throws:
AdminExceptionConnectExceptionJMSException
-
deleteMessage
public void deleteMessage(String msgId) throws AdminException, ConnectException
- Specified by:
deleteMessagein interfaceQueueMBean- Throws:
AdminExceptionConnectException
-
clear
public void clear() throws AdminException, ConnectException- Specified by:
clearin interfaceQueueMBean- Throws:
AdminExceptionConnectException
-
addClusteredQueue
public void addClusteredQueue(Queue addedQueue) throws ConnectException, AdminException
Adds a queue into the cluster this queue belongs to. If this queue doesn't belong to a cluster then a cluster is created by clustering this queue with the added queue.The request fails if one or both of the queues are deleted, or can't belong to a cluster.
- Parameters:
addedQueue- queue added to the cluster- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
removeClusteredQueue
public void removeClusteredQueue(Queue removedQueue) throws ConnectException, AdminException
Deprecated.Removes a queue from the cluster this queue belongs to.The request fails if the queue does not exist or is not part of any cluster.
- Parameters:
removedQueue- queue removed from the cluster- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
removeFromCluster
public void removeFromCluster() throws ConnectException, AdminExceptionRemoves this queue from the cluster it belongs to.The request fails if the queue does not exist or is not part of any cluster.
- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
getQueueClusterElements
public String[] getQueueClusterElements() throws ConnectException, AdminException
Returns the reference of the queues that belong to the cluster.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
registerAsDefaultDMQ
public void registerAsDefaultDMQ() throws ConnectException, AdminExceptionSets the current queue as the default DMQ for the local server.- Specified by:
registerAsDefaultDMQin interfaceQueueMBean- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
registerAsDefaultDMQ
public void registerAsDefaultDMQ(int serverId) throws ConnectException, AdminExceptionSets the current queue as the default DMQ for the given server.The request fails if the target server does not belong to the platform.
- Specified by:
registerAsDefaultDMQin interfaceQueueMBean- Parameters:
serverId- The identifier of the server.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
addRemoteDestination
public void addRemoteDestination(String destId) throws ConnectException, AdminException
Adds a destination to an alias queue's destinations' list.- Parameters:
destId- The internal name of remote destination- Throws:
ConnectExceptionAdminException
-
addRemoteDestination
public void addRemoteDestination(Queue remote) throws ConnectException, AdminException
Adds a destination to an alias queue's destinations' list.- Parameters:
remote- The remote queue to add- Throws:
ConnectExceptionAdminException
-
delRemoteDestination
public void delRemoteDestination(String destId) throws ConnectException, AdminException
Removes a destination from an alias queue's destinations' list.- Parameters:
destId- The internal name of remote destination- Throws:
ConnectExceptionAdminException
-
delRemoteDestination
public void delRemoteDestination(Queue remote) throws ConnectException, AdminException
Removes a destination from an alias queue's destinations' list.- Parameters:
remote- The remote queue to remove- Throws:
ConnectExceptionAdminException
-
sendDestinationsWeights
public void sendDestinationsWeights(int[] weights) throws ConnectException, AdminExceptionSet weights for each remote destination of this alias queue.- Parameters:
weights-- Throws:
ConnectExceptionAdminException
-
setRedeliveryDelay
public void setRedeliveryDelay(int redeliveryDelay) throws ConnectException, AdminExceptionSet redeliveryDelay attribute.- Parameters:
redeliveryDelay- The delay in seconds use to wait before re-delivering messages after a deny.- Throws:
ConnectExceptionAdminException
-
setDeliveryDelay
public void setDeliveryDelay(int deliveryDelay) throws ConnectException, AdminExceptionSet deliveryDelay attribute.- Parameters:
deliveryDelay- The minimum delay in milliseconds use to wait before delivering each message.- Throws:
ConnectExceptionAdminException
-
setPause
public void setPause(boolean pause) throws ConnectException, AdminExceptionStops / Resumes the message delivery.- Parameters:
pause- if true stops the message delivery, else resumes it.- Throws:
ConnectException- If the administration connection is closed or broken.AdminException- If the request fails.
-
setProperties
public org.objectweb.joram.shared.admin.AdminReply setProperties(Properties prop) throws ConnectException, AdminException
Administration method to set properties.- Overrides:
setPropertiesin classDestination- Parameters:
prop- the properties to update.- Returns:
- the admin reply
- Throws:
ConnectException- If the administration connection is closed or broken.AdminException- If the request fails.
-
-