com.ibm.mq
Class MQQueue
- java.lang.Object
-
- com.ibm.mq.jmqi.JmqiObject
-
- com.ibm.mq.MQManagedObject
-
- com.ibm.mq.MQDestination
-
- com.ibm.mq.MQQueue
-
public class MQQueue extends MQDestination
MQQueue provides inquire, set, put and get operations for IBM MQ queues. The inquire and set capabilities are inherited from
MQManagedObject.Use
MQQueueManager.accessQueue()to gain access to an MQQueue object.
-
-
Field Summary
-
Fields inherited from class com.ibm.mq.MQManagedObject
alternateUserId, closeOptions, connectionReference, isOpen, name, openOptions
-
-
Constructor Summary
Constructors Constructor and Description MQQueue(MQQueueManager qMgr, java.lang.String queueName, int openOptions, java.lang.String queueManagerName, java.lang.String dynamicQueueName, java.lang.String alternateUserId)Public constructor which allows users to create MQQueue subclasses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Closes the object.intgetCurrentDepth()Gets the number of messages currently on the queue.intgetDefinitionType()Indicates how the queue was defined.intgetInhibitGet()Indicates whether get operations are allowed for this queue.intgetInhibitPut()Indicates whether put operations are allowed for this queue.intgetMaximumDepth()Gets the maximum number of messages that can exist on the queue at any one time.intgetMaximumMessageLength()Gets the maximum length of the application data of a message on this queue.intgetOpenInputCount()Gets the number of currently valid handles for removing messages from the queue.intgetOpenOutputCount()Gets the number of currently valid handles for adding messages to the queue.intgetQueueType()Gets the type of this queue.intgetShareability()Indicates whether the queue can be opened multiple times for input.intgetTriggerControl()Indicates whether trigger messages are written to an initiation queue.java.lang.StringgetTriggerData()Gets the data for the trigger message that is written to the initiation queue.intgetTriggerDepth()Gets the number of messages that have to be on the queue to generate a trigger message.intgetTriggerMessagePriority()Gets the message priority below which messages do not cause trigger messages.intgetTriggerType()Indicates the conditions under which trigger messages are written.voidputForwardMessage(MQMessage message)Put a message being forwarded onto the queue using default put message options and message as the original messagevoidputForwardMessage(MQMessage message, MQPutMessageOptions putMessageOptions)Put a message being forwarded onto the queue using message as the original messagevoidputReplyMessage(MQMessage message)Put a reply message onto the queue using default put message options and message as the original messagevoidputReplyMessage(MQMessage message, MQPutMessageOptions putMessageOptions)Put a reply message onto the queue using message as the original messagevoidputReportMessage(MQMessage message)Put a report message onto the queue using default put message options and message as the original messagevoidputReportMessage(MQMessage message, MQPutMessageOptions putMessageOptions)Put a report message onto the queue using message as the original messagevoidsetInhibitGet(int inhibit)Controls whether get operations are allowed for this queue.voidsetInhibitPut(int inhibit)Controls whether put operations are allowed for this queue.voidsetTriggerControl(int trigger)Controls whether trigger messages are written to an initiation queue.voidsetTriggerData(java.lang.String data)Sets the data for the trigger message that is written to the initiation queue.voidsetTriggerDepth(int depth)Sets the number of messages that have to be on the queue to generate a trigger message.voidsetTriggerMessagePriority(int priority)Sets the message priority below which messages do not cause trigger messages.voidsetTriggerType(int type)Sets the conditions under which trigger messages are written.-
Methods inherited from class com.ibm.mq.MQDestination
get, get, get, getCreationDateTime, getDestinationType, getQueueManagerCmdLevel, put, put, setQueueManagerCmdLevel
-
Methods inherited from class com.ibm.mq.MQManagedObject
getAlternateUserId, getAttributeString, getCloseOptions, getConnectionReference, getDescription, getName, getOpenOptions, getResolvedObjectString, getResolvedQName, getResolvedType, inquire, inquire, isOpen, set, setAttributeString, setCloseOptions
-
-
-
-
Constructor Detail
-
MQQueue
public MQQueue(MQQueueManager qMgr, java.lang.String queueName, int openOptions, java.lang.String queueManagerName, java.lang.String dynamicQueueName, java.lang.String alternateUserId) throws MQException
Public constructor which allows users to create MQQueue subclasses.- Parameters:
qMgr- the object which represents the queue manager on which the queue resides.queueName- name of the queue to open.openOptions- options which control the opening of the queue. Valid options are:CMQC.MQOO_ALTERNATE_USER_AUTHORITYCMQC.MQOO_BIND_AS_Q_DEFCMQC.MQOO_BIND_NOT_FIXEDCMQC.MQOO_BIND_ON_OPENCMQC.MQOO_BROWSECMQC.MQOO_FAIL_IF_QUIESCINGCMQC.MQOO_INPUT_AS_Q_DEFCMQC.MQOO_INPUT_SHAREDCMQC.MQOO_INPUT_EXCLUSIVECMQC.MQOO_INQUIRECMQC.MQOO_OUTPUTCMQC.MQOO_PASS_ALL_CONTEXTCMQC.MQOO_PASS_IDENTITY_CONTEXTCMQC.MQOO_SAVE_ALL_CONTEXTCMQC.MQOO_SETCMQC.MQOO_SET_ALL_CONTEXTCMQC.MQOO_SET_IDENTITY_CONTEXTCMQC.MQOO_RESOLVE_LOCAL_Q
If more than one option is required, the values can be combined using either the '+' or '|' operator.
queueManagerName- name of the queue manager on which the queue is defined. If it is blank or null the queue manager to which this MQQueueManager object is connected is used.dynamicQueueName- specifies the name of the dynamic queue to be created. It is ignored unless queueName specifies the name of a model queue, in which case it must not be blank or null. If the last non-blank character in the name is an asterisk (*), the queue manager replaces the asterisk with a string of characters that guarantees that the name generated for the queue is unique on this queue manager.alternateUserId- the alternative user ID used to check the authorization for the open ifCMQC.MQOO_ALTERNATE_USER_AUTHORITYis specified in openOptions.- Throws:
MQException- if the queue cannot be opened.
-
-
Method Detail
-
putForwardMessage
public void putForwardMessage(MQMessage message) throws MQException, java.io.IOException
Put a message being forwarded onto the queue using default put message options and message as the original message- Parameters:
message- to be forwarded- Throws:
MQException- If the MQI call failsjava.io.IOException- If there is an IO error
-
putForwardMessage
public void putForwardMessage(MQMessage message, MQPutMessageOptions putMessageOptions) throws MQException, java.io.IOException
Put a message being forwarded onto the queue using message as the original message- Parameters:
message- to be forwardedputMessageOptions- for the MQPUT- Throws:
MQException- If the MQI call failsjava.io.IOException- If there is an IO error
-
putReplyMessage
public void putReplyMessage(MQMessage message) throws MQException, java.io.IOException
Put a reply message onto the queue using default put message options and message as the original message- Parameters:
message- - Original Message.- Throws:
MQException- If the MQ call failsjava.io.IOException- If there is an IO error
-
putReplyMessage
public void putReplyMessage(MQMessage message, MQPutMessageOptions putMessageOptions) throws MQException, java.io.IOException
Put a reply message onto the queue using message as the original message- Parameters:
message- - Original Message.putMessageOptions- for MQPUT.- Throws:
MQException- If the MQ call failsjava.io.IOException- If there is an IO error
-
putReportMessage
public void putReportMessage(MQMessage message) throws MQException, java.io.IOException
Put a report message onto the queue using default put message options and message as the original message- Parameters:
message- - Original Message.- Throws:
MQException- If the MQ call failsjava.io.IOException- If there is an IO error
-
putReportMessage
public void putReportMessage(MQMessage message, MQPutMessageOptions putMessageOptions) throws MQException, java.io.IOException
Put a report message onto the queue using message as the original message- Parameters:
message- - Original MessageputMessageOptions- for MQPUT- Throws:
MQException- If the MQ call failsjava.io.IOException- If there is an IO error
-
close
public void close() throws MQExceptionCloses the object. No further operations on this object are permitted after it is closed. The behaviour of the close method can be altered by setting closeOptions.- Overrides:
closein classMQManagedObject- Throws:
MQException- if the IBM MQ call fails.
-
getQueueType
public int getQueueType() throws MQExceptionGets the type of this queue.- Returns:
- one of the following:
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getCurrentDepth
public int getCurrentDepth() throws MQExceptionGets the number of messages currently on the queue. This value is incremented during a put call and during backout of a get call. It is decremented during a non-browse get and during backout of a put call.- Returns:
- the number of messages.
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getDefinitionType
public int getDefinitionType() throws MQExceptionIndicates how the queue was defined.- Returns:
- one of the following:
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getMaximumDepth
public int getMaximumDepth() throws MQExceptionGets the maximum number of messages that can exist on the queue at any one time. An attempt to put a message to a queue that already contains this many messages fails with reason code MQConstants.MQRC_Q_FULL.- Returns:
- the maximum number of messages.
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getMaximumMessageLength
public int getMaximumMessageLength() throws MQExceptionGets the maximum length of the application data of a message on this queue. An attempt to put a message larger than this value fails with reason code MQConstants.MQRC_MSG_TOO_BIG_FOR_Q.- Returns:
- the maximum length.
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getOpenInputCount
public int getOpenInputCount() throws MQExceptionGets the number of currently valid handles for removing messages from the queue.- Returns:
- the total number of valid handles known to the local queue manager, not just those created by the IBM MQ Client for Java (using accessQueue()).
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getOpenOutputCount
public int getOpenOutputCount() throws MQExceptionGets the number of currently valid handles for adding messages to the queue.- Returns:
- the total number of valid handles known to the local queue manager, not just those created by the IBM MQ Client for Java (using accessQueue()).
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getShareability
public int getShareability() throws MQExceptionIndicates whether the queue can be opened multiple times for input.- Returns:
- one of the following:
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getInhibitPut
public int getInhibitPut() throws MQExceptionIndicates whether put operations are allowed for this queue.- Returns:
- one of the following:
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
setInhibitPut
public void setInhibitPut(int inhibit) throws MQExceptionControls whether put operations are allowed for this queue.- Parameters:
inhibit- the permissible values are:- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getInhibitGet
public int getInhibitGet() throws MQExceptionIndicates whether get operations are allowed for this queue.- Returns:
- one of the following:
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
setInhibitGet
public void setInhibitGet(int inhibit) throws MQExceptionControls whether get operations are allowed for this queue.- Parameters:
inhibit- the permissible values are:- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getTriggerControl
public int getTriggerControl() throws MQExceptionIndicates whether trigger messages are written to an initiation queue. This starts an application to service the queue.- Returns:
- the possible values are:
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
setTriggerControl
public void setTriggerControl(int trigger) throws MQExceptionControls whether trigger messages are written to an initiation queue. This starts an application to service the queue.- Parameters:
trigger- the permissible values are:- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getTriggerData
public java.lang.String getTriggerData() throws MQExceptionGets the data for the trigger message that is written to the initiation queue. The trigger message is written to the initiation queue when a message arrives on this one.- Returns:
- the data in free format.
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
setTriggerData
public void setTriggerData(java.lang.String data) throws MQExceptionSets the data for the trigger message that is written to the initiation queue. The trigger message is written to the initiation queue when a message arrives on this one.- Parameters:
data- sets the data in free-format. The maximum permissible length of the string is given byCMQC.MQ_TRIGGER_DATA_LENGTH.- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getTriggerDepth
public int getTriggerDepth() throws MQExceptionGets the number of messages that have to be on the queue to generate a trigger message. This applies when the trigger type isCMQC.MQTT_DEPTH.- Returns:
- the number of messages.
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
setTriggerDepth
public void setTriggerDepth(int depth) throws MQExceptionSets the number of messages that have to be on the queue to generate a trigger message. This applies when trigger type isCMQC.MQTT_DEPTH.- Parameters:
depth- the number of messages.- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getTriggerMessagePriority
public int getTriggerMessagePriority() throws MQExceptionGets the message priority below which messages do not cause trigger messages. That is, the queue manager ignores these messages when deciding whether to generate a trigger.- Returns:
- the message priority. 0 means that all messages contribute to the generation of trigger messages.
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
setTriggerMessagePriority
public void setTriggerMessagePriority(int priority) throws MQExceptionSets the message priority below which messages do not cause trigger messages. That is, the queue manager ignores these messages when deciding whether to generate a trigger.- Parameters:
priority- the message priority. 0 means that all messages contribute to the generation of trigger messages.- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
getTriggerType
public int getTriggerType() throws MQExceptionIndicates the conditions under which trigger messages are written. Trigger messages are written as a result of messages arriving on this queue.- Returns:
- the possible values are:
- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
setTriggerType
public void setTriggerType(int type) throws MQExceptionSets the conditions under which trigger messages are written. Trigger messages are written as a result of messages arriving on this queue.- Parameters:
type- the possible values are:- Throws:
MQException- if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.
-
-