Package com.ibm.mq

Class MQQueue

java.lang.Object
com.ibm.mq.jmqi.JmqiObject

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.

  • Constructor Details

  • Method Details

    • putForwardMessage

      public void putForwardMessage(MQMessage message) throws MQException, 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
      IOException - If there is an IO error
    • putForwardMessage

      public void putForwardMessage(MQMessage message, MQPutMessageOptions putMessageOptions) throws MQException, 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
      IOException - If there is an IO error
    • putReplyMessage

      public void putReplyMessage(MQMessage message) throws MQException, 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
      IOException - If there is an IO error
    • putReplyMessage

      public void putReplyMessage(MQMessage message, MQPutMessageOptions putMessageOptions) throws MQException, 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
      IOException - If there is an IO error
    • putReportMessage

      public void putReportMessage(MQMessage message) throws MQException, 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
      IOException - If there is an IO error
    • putReportMessage

      public void putReportMessage(MQMessage message, MQPutMessageOptions putMessageOptions) throws MQException, 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
      IOException - If there is an IO error
    • close

      public void close() 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:
      close in class MQManagedObject
      Throws:
      MQException - if the IBM MQ call fails.
    • getQueueType

      public int getQueueType() throws MQException
      Gets 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 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

      public int getDefinitionType() throws MQException
      Indicates 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 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 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 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 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 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 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 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 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 MQException
      Indicates 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 MQException
      Indicates 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 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

      public int getInhibitGet() throws MQException
      Indicates 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 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

      public int getTriggerControl() 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

      public void setTriggerControl(int trigger) 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

      public String getTriggerData() 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

      public void setTriggerData(String data) 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 CMQC.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 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 CMQC.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 MQException
      Sets the number of messages that have to be on the queue to generate a trigger message. This applies when trigger type is CMQC.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 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

      public void setTriggerMessagePriority(int priority) 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

      public int getTriggerType() 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:
      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 MQException
      Sets 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.