com.ibm.mq

Class MQQueue

  1. java.lang.Object
  2. extended bycom.ibm.mq.jmqi.JmqiObject
  3. extended bycom.ibm.mq.MQManagedObject
  4. extended bycom.ibm.mq.MQDestination
  5. extended bycom.ibm.mq.MQQueue

  1. public class MQQueue
  2. extends MQDestination

MQQueue provides inquire, set, put and get operations for WebSphere 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
Fields inherited from class com.ibm.mq.jmqi.JmqiObject
COMP_JM, COMP_JN, COMP_JO

Constructor Summary

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

Modifier and Type Method and Description
  1. void
close()
Closes the object.
  1. int
getCurrentDepth()
Gets the number of messages currently on the queue.
  1. int
getDefinitionType()
Indicates how the queue was defined.
  1. int
getInhibitGet()
Indicates whether get operations are allowed for this queue.
  1. int
getInhibitPut()
Indicates whether put operations are allowed for this queue.
  1. int
getMaximumDepth()
Gets the maximum number of messages that can exist on the queue at any one time.
  1. int
getMaximumMessageLength()
Gets the maximum length of the application data of a message on this queue.
  1. int
getOpenInputCount()
Gets the number of currently valid handles for removing messages from the queue.
  1. int
getOpenOutputCount()
Gets the number of currently valid handles for adding messages to the queue.
  1. int
getQueueType()
Gets the type of this queue.
  1. int
getShareability()
Indicates whether the queue can be opened multiple times for input.
  1. int
getTriggerControl()
Indicates whether trigger messages are written to an initiation queue.
  1. java.lang.String
getTriggerData()
Gets the data for the trigger message that is written to the initiation queue.
  1. int
getTriggerDepth()
Gets the number of messages that have to be on the queue to generate a trigger message.
  1. int
getTriggerMessagePriority()
Gets the message priority below which messages do not cause trigger messages.
  1. int
getTriggerType()
Indicates the conditions under which trigger messages are written.
  1. void
putForwardMessage(MQMessage message)
Put a message being forwarded onto the queue using default put message options and message as the original message
  1. void
putForwardMessage(MQMessage message,MQPutMessageOptions putMessageOptions)
Put a message being forwarded onto the queue using message as the original message
  1. void
putReplyMessage(MQMessage message)
Put a reply message onto the queue using default put message options and message as the original message
  1. void
putReplyMessage(MQMessage message,MQPutMessageOptions putMessageOptions)
Put a reply message onto the queue using message as the original message
  1. void
putReportMessage(MQMessage message)
Put a report message onto the queue using default put message options and message as the original message
  1. void
putReportMessage(MQMessage message,MQPutMessageOptions putMessageOptions)
Put a report message onto the queue using message as the original message
  1. void
setInhibitGet(int inhibit)
Controls whether get operations are allowed for this queue.
  1. void
setInhibitPut(int inhibit)
Controls whether put operations are allowed for this queue.
  1. void
setTriggerControl(int trigger)
Controls whether trigger messages are written to an initiation queue.
  1. void
setTriggerData(java.lang.String data)
Sets the data for the trigger message that is written to the initiation queue.
  1. void
setTriggerDepth(int depth)
Sets the number of messages that have to be on the queue to generate a trigger message.
  1. void
setTriggerMessagePriority(int priority)
Sets the message priority below which messages do not cause trigger messages.
  1. void
setTriggerType(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
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

MQQueue

  1. public MQQueue(MQQueueManager qMgr,
  2. java.lang.String queueName,
  3. int openOptions,
  4. java.lang.String queueManagerName,
  5. java.lang.String dynamicQueueName,
  6. java.lang.String alternateUserId)
  7. 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.
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 if MQC.MQOO_ALTERNATE_USER_AUTHORITYis specified in openOptions.
Throws:
MQException - if the queue cannot be opened.

Method Detail

putForwardMessage

  1. public void putForwardMessage(MQMessage message)
  2. throws MQException
  3. 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 fails
java.io.IOException - If there is an IO error

putForwardMessage

  1. public void putForwardMessage(MQMessage message,
  2. MQPutMessageOptions putMessageOptions)
  3. throws MQException
  4. java.io.IOException
Put a message being forwarded onto the queue using message as the original message
Parameters:
message - to be forwarded
putMessageOptions - for the MQPUT
Throws:
MQException - If the MQI call fails
java.io.IOException - If there is an IO error

putReplyMessage

  1. public void putReplyMessage(MQMessage message)
  2. throws MQException
  3. 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 fails
java.io.IOException - If there is an IO error

putReplyMessage

  1. public void putReplyMessage(MQMessage message,
  2. MQPutMessageOptions putMessageOptions)
  3. throws MQException
  4. 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 fails
java.io.IOException - If there is an IO error

putReportMessage

  1. public void putReportMessage(MQMessage message)
  2. throws MQException
  3. 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 fails
java.io.IOException - If there is an IO error

putReportMessage

  1. public void putReportMessage(MQMessage message,
  2. MQPutMessageOptions putMessageOptions)
  3. throws MQException
  4. java.io.IOException
Put a report message onto the queue using message as the original message
Parameters:
message - - Original Message
putMessageOptions - for MQPUT
Throws:
MQException - If the MQ call fails
java.io.IOException - If there is an IO error

close

  1. public void close()
  2. throws MQException
Closes 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:
Throws:
MQException - if the WebSphere MQ call fails.

getQueueType

  1. public int getQueueType()
  2. throws MQException
Gets the type of this queue.
Returns:
Throws:
MQException - if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.

getCurrentDepth

  1. public int getCurrentDepth()
  2. throws MQException
Gets 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

  1. public int getDefinitionType()
  2. throws MQException
Indicates how the queue was defined.
Returns:
Throws:
MQException - if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.

getMaximumDepth

  1. public int getMaximumDepth()
  2. throws MQException
Gets 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 MQException.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

  1. public int getMaximumMessageLength( )
  2. throws MQException
Gets 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 MQException.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

  1. public int getOpenInputCount()
  2. throws MQException
Gets 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 WebSphere 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

  1. public int getOpenOutputCount()
  2. throws MQException
Gets 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 WebSphere 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

  1. public int getShareability()
  2. throws MQException
Indicates whether the queue can be opened multiple times for input.
Returns:
Throws:
MQException - if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.

getInhibitPut

  1. public int getInhibitPut()
  2. throws MQException
Indicates whether put operations are allowed for this queue.
Returns:
Throws:
MQException - if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.

setInhibitPut

  1. public void setInhibitPut(int inhibit)
  2. throws MQException
Controls 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

  1. public int getInhibitGet()
  2. throws MQException
Indicates whether get operations are allowed for this queue.
Returns:
Throws:
MQException - if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.

setInhibitGet

  1. public void setInhibitGet(int inhibit)
  2. throws MQException
Controls 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

  1. public int getTriggerControl()
  2. throws MQException
Indicates 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

  1. public void setTriggerControl(int trigger)
  2. throws MQException
Controls 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

  1. public java.lang.String getTriggerData( )
  2. throws MQException
Gets 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

  1. public void setTriggerData(java.lang.String data)
  2. throws MQException
Sets 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 by MQC.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

  1. public int getTriggerDepth()
  2. throws MQException
Gets the number of messages that have to be on the queue to generate a trigger message. This applies when the trigger type is MQC.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

  1. public void setTriggerDepth(int depth)
  2. throws MQException
Sets the number of messages that have to be on the queue to generate a trigger message. This applies when trigger type is MQC.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

  1. public int getTriggerMessagePriority( )
  2. throws MQException
Gets 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

  1. public void setTriggerMessagePriority( int priority)
  2. throws MQException
Sets 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

  1. public int getTriggerType()
  2. throws MQException
Indicates the conditions under which trigger messages are written. Trigger messages are written as a result of messages arriving on this queue.
Returns:
Throws:
MQException - if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.

setTriggerType

  1. public void setTriggerType(int type)
  2. throws MQException
Sets the conditions under which trigger messages are written. Trigger messages are written as a result of messages arriving on this queue.
Parameters:
Throws:
MQException - if you call this method after you have closed the queue, to indicate that the queue is no longer accessible.