com.ibm.as400.access

Class MessageQueue

  • java.lang.Object
    • com.ibm.as400.access.MessageQueue
  • All Implemented Interfaces:
    java.io.Serializable


    public class MessageQueue
    extends java.lang.Object
    implements java.io.Serializable
    Represents a message queue object on the system. If no message queue path is set, then the default is CURRENT, which represents the current user's message queue. If necessary, the name of the message queue will be retrieved from the current user's user profile.

    QueuedMessage objects have many attributes. Only some of these attribute values are set, depending on how a QueuedMessage object is created. The following is a list of attributes whose values are set on QueuedMessage objects returned in a list of messages:

    • alert option
    • date sent
    • default reply
    • message file
    • message help
    • message ID
    • message key
    • message queue
    • message severity
    • message text
    • message type
    • reply status
    • sender job name
    • sender job number
    • sender job user name
    • if the system release is V5R3M0 or greater, sending current user
    • sending program name

    The following is a list of attributes whose values are set on objects returned by receive():

    • alert option
    • date sent
    • message file
    • message help
    • message ID
    • message key
    • message queue
    • message severity
    • message text
    • message type
    • sender job name
    • sender job number
    • sender job user name
    • sending program name
    • substitution data
    See Also:
    QueuedMessage, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String ALL
      Constant referring to all messages in the message queue.
      static java.lang.String ANY
      Constant referring to any message in the message queue.
      static java.lang.String BYKEY
      Constant referring to a message identified by a key.
      static java.lang.String COMPLETION
      Constant referring to completion messages.
      static java.lang.String COPY
      Constant referring to the sender's copy of a previously sent inquiry message.
      static java.lang.String CURRENT
      Constant referring to the current user's message queue.
      static java.lang.String DIAGNOSTIC
      Constant referring to diagnostic messages.
      static java.lang.String FIRST
      Constant referring to the first message in the message queue.
      static java.lang.String INFORMATIONAL
      Constant referring to informational messages.
      static java.lang.String INQUIRY
      Constant referring to inquiry messages.
      static java.lang.String KEEP_UNANSWERED
      Constant referring to all messages in the message queue except unanswered inquiry and unanswered senders' copy messages.
      static java.lang.String LAST
      Constant referring to the last message in the message queue.
      static java.lang.String MESSAGES_NEED_REPLY
      Constant referring to messages that need a reply.
      static java.lang.String MESSAGES_NO_NEED_REPLY
      Constant referring to messages that do not need a reply.
      static java.lang.String NEW
      Constant referring to all new messages in the message queue.
      static byte[] NEWEST
      Constant referring to the message key for the newest message in the queue.
      static java.lang.String NEXT
      Constant referring to the next message in the message queue.
      static java.lang.String OLD
      Constant referring to all old messages in the message queue.
      static byte[] OLDEST
      Constant referring to the message key for the oldest message in the queue.
      static java.lang.String PREVIOUS
      Constant referring to the previous message in the message queue.
      static java.lang.String REMOVE
      Constant indicating that the message should be removed from the message queue.
      static java.lang.String REPLY
      Constant referring to the reply to an inquiry message.
      static java.lang.String SAME
      Constant indicating that the message should remain in the message queue without changing its new or old designation.
      static java.lang.String SENDERS_COPY_NEED_REPLY
      Constant referring to the sender's copies of messages that need replies.
    • Constructor Summary

      Constructors 
      Constructor and Description
      MessageQueue()
      Constructs a MessageQueue object.
      MessageQueue(AS400 system)
      Constructs a MessageQueue object.
      MessageQueue(AS400 system, java.lang.String path)
      Constructs a MessageQueue object.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
      Adds a PropertyChangeListener.
      void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Adds a VetoableChangeListener.
      void close()
      Closes the message list on the system.
      protected void finalize()
      Closes the list on the system when this object is garbage collected.
      int getHelpTextFormatting()
      Returns the status of help text formatting.
      int getLength()
      Returns the number of messages in the list.
      boolean getListDirection()
      Returns the list direction.
      java.util.Enumeration getMessages()
      Returns the list of messages in the message queue.
      QueuedMessage[] getMessages(int listOffset, int number)
      Returns a subset of the list of messages in the message queue.
      java.lang.String getPath()
      Returns the fully qualified integrated file system path name of the message queue, or CURRENT to refer to the user's default message queue.
      java.lang.String getSelection()
      Deprecated. 
      Use isSelectMessagesNeedReply(), isSelectMessagesNoNeedReply(), and isSelectSendersCopyMessagesNeedReply() instead. The value returned by this method may not accurately reflect the actual selection criteria used to filter the list of messages.
      int getSeverity()
      Returns the severity of the messages which are returned.
      boolean getSort()
      Returns whether or not messages will be sorted when ALL is specified for the selection criteria.
      AS400 getSystem()
      Returns the system object representing the system on which the message queue exists.
      byte[] getUserStartingMessageKey()
      Returns the user starting message key, if one has been set.
      byte[] getWorkstationStartingMessageKey()
      Returns the workstation starting message key, if one has been set.
      boolean isSelectMessagesNeedReply()
      Returns whether or not messages that need a reply are included in the list of returned messages.
      boolean isSelectMessagesNoNeedReply()
      Returns whether or not messages that do not need a reply are included in the list of returned messages.
      boolean isSelectSendersCopyMessagesNeedReply()
      Returns whether or not sender's copy messages that need a reply are included in the list of returned messages.
      void load()
      Loads the list of messages on the system.
      QueuedMessage receive(byte[] messageKey)
      Receives a message from the message queue by key.
      QueuedMessage receive(byte[] messageKey, int waitTime, java.lang.String messageAction, java.lang.String messageType)
      Receives a message from the message queue.
      void remove()
      Remove all messages from the message queue.
      void remove(byte[] messageKey)
      Removes a message from the message queue.
      void remove(java.lang.String messageType)
      Remove messages from the message queue.
      void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
      Removes the PropertyChangeListener.
      void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Removes the VetoableChangeListener.
      void reply(byte[] messageKey, java.lang.String replyText)
      Replies to and removes a message.
      void reply(byte[] messageKey, java.lang.String replyText, boolean remove)
      Replies to and removes a message if requested.
      void sendInformational(java.lang.String messageText)
      Sends an informational message to the message queue.
      void sendInformational(java.lang.String messageID, java.lang.String messageFile)
      Sends an informational message to the message queue.
      void sendInformational(java.lang.String messageID, java.lang.String messageFile, byte[] substitutionData)
      Sends an informational message to the message queue.
      byte[] sendInquiry(java.lang.String messageText, java.lang.String replyMessageQueue)
      Sends an inquiry message to the message queue.
      byte[] sendInquiry(java.lang.String messageID, java.lang.String messageFile, byte[] substitutionData, java.lang.String replyMessageQueue)
      Sends an inquiry message to the message queue.
      byte[] sendInquiry(java.lang.String messageID, java.lang.String messageFile, java.lang.String replyMessageQueue)
      Sends an inquiry message to the message queue.
      void setHelpTextFormatting(int helpTextFormatting)
      Sets the help text formatting value.
      void setListDirection(boolean listDirection)
      Sets the list direction.
      void setPath(java.lang.String path)
      Sets the fully qualified integrated file system path name of the message queue.
      void setSelection(java.lang.String selection)
      void setSelectMessagesNeedReply(boolean selectMessagesNeedReply)
      Sets whether or not to include messages that need a reply in the returned list of messages.
      void setSelectMessagesNoNeedReply(boolean selectMessagesNoNeedReply)
      Sets whether or not to include messages that do not need a reply in the returned list of messages.
      void setSelectSendersCopyMessagesNeedReply(boolean selectSendersCopyMessagesNeedReply)
      Sets whether or not to include sender's copy messages that need a reply in the returned list of messages.
      void setSeverity(int severity)
      Sets the severity of the messages which are returned.
      void setSort(boolean sort)
      Sets whether the list should be sorted by message type when ALL messages are selected for retrieval.
      void setSystem(AS400 system)
      Sets the system.
      void setUserStartingMessageKey(byte[] userStartingMessageKey)
      Sets the starting message key used to begin searching for messages to list from the corresponding entry in the message queue.
      void setWorkstationStartingMessageKey(byte[] workstationStartingMessageKey)
      Sets the starting message key used to begin searching for messages to list from the corresponding entry in the message queue.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ALL

        public static final java.lang.String ALL
        Constant referring to all messages in the message queue.
        See Also:
        Constant Field Values
      • ANY

        public static final java.lang.String ANY
        Constant referring to any message in the message queue.
        See Also:
        Constant Field Values
      • BYKEY

        public static final java.lang.String BYKEY
        Constant referring to a message identified by a key.
        See Also:
        Constant Field Values
      • COMPLETION

        public static final java.lang.String COMPLETION
        Constant referring to completion messages.
        See Also:
        Constant Field Values
      • COPY

        public static final java.lang.String COPY
        Constant referring to the sender's copy of a previously sent inquiry message.
        See Also:
        Constant Field Values
      • CURRENT

        public static final java.lang.String CURRENT
        Constant referring to the current user's message queue.
        See Also:
        Constant Field Values
      • DIAGNOSTIC

        public static final java.lang.String DIAGNOSTIC
        Constant referring to diagnostic messages.
        See Also:
        Constant Field Values
      • FIRST

        public static final java.lang.String FIRST
        Constant referring to the first message in the message queue.
        See Also:
        Constant Field Values
      • INFORMATIONAL

        public static final java.lang.String INFORMATIONAL
        Constant referring to informational messages.
        See Also:
        Constant Field Values
      • INQUIRY

        public static final java.lang.String INQUIRY
        Constant referring to inquiry messages.
        See Also:
        Constant Field Values
      • KEEP_UNANSWERED

        public static final java.lang.String KEEP_UNANSWERED
        Constant referring to all messages in the message queue except unanswered inquiry and unanswered senders' copy messages.
        See Also:
        Constant Field Values
      • LAST

        public static final java.lang.String LAST
        Constant referring to the last message in the message queue.
        See Also:
        Constant Field Values
      • MESSAGES_NEED_REPLY

        public static final java.lang.String MESSAGES_NEED_REPLY
        Constant referring to messages that need a reply.
        See Also:
        Constant Field Values
      • MESSAGES_NO_NEED_REPLY

        public static final java.lang.String MESSAGES_NO_NEED_REPLY
        Constant referring to messages that do not need a reply.
        See Also:
        Constant Field Values
      • NEW

        public static final java.lang.String NEW
        Constant referring to all new messages in the message queue. New messages are those that have not been received.
        See Also:
        Constant Field Values
      • NEWEST

        public static final byte[] NEWEST
        Constant referring to the message key for the newest message in the queue.
      • NEXT

        public static final java.lang.String NEXT
        Constant referring to the next message in the message queue.
        See Also:
        Constant Field Values
      • OLD

        public static final java.lang.String OLD
        Constant referring to all old messages in the message queue. Old messages are those that have already been received.
        See Also:
        Constant Field Values
      • OLDEST

        public static final byte[] OLDEST
        Constant referring to the message key for the oldest message in the queue.
      • PREVIOUS

        public static final java.lang.String PREVIOUS
        Constant referring to the previous message in the message queue.
        See Also:
        Constant Field Values
      • REMOVE

        public static final java.lang.String REMOVE
        Constant indicating that the message should be removed from the message queue.
        See Also:
        Constant Field Values
      • REPLY

        public static final java.lang.String REPLY
        Constant referring to the reply to an inquiry message.
        See Also:
        Constant Field Values
      • SAME

        public static final java.lang.String SAME
        Constant indicating that the message should remain in the message queue without changing its new or old designation.
        See Also:
        Constant Field Values
      • SENDERS_COPY_NEED_REPLY

        public static final java.lang.String SENDERS_COPY_NEED_REPLY
        Constant referring to the sender's copies of messages that need replies.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MessageQueue

        public MessageQueue(AS400 system)
        Constructs a MessageQueue object. The message queue path defaults to CURRENT.
        Parameters:
        system - The system object representing the system on which the message queue exists.
        See Also:
        setPath(java.lang.String)
      • MessageQueue

        public MessageQueue(AS400 system,
                    java.lang.String path)
        Constructs a MessageQueue object.
        Parameters:
        system - The system object representing the system on which the message queue exists.
        path - The fully qualified integrated file system path name of the message queue, or CURRENT to refer to the user's default message queue.
    • Method Detail

      • addPropertyChangeListener

        public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
        Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed.
        Parameters:
        listener - The listener.
        See Also:
        removePropertyChangeListener(java.beans.PropertyChangeListener)
      • addVetoableChangeListener

        public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
        Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange() method will be called each time the value of any constrained property is changed.
        Parameters:
        listener - The listener.
        See Also:
        removeVetoableChangeListener(java.beans.VetoableChangeListener)
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Closes the list on the system when this object is garbage collected.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • getHelpTextFormatting

        public int getHelpTextFormatting()
        Returns the status of help text formatting. Possible values are:
        Returns:
        The status of help text formatting.
        See Also:
        setHelpTextFormatting(int)
      • getLength

        public int getLength()
        Returns the number of messages in the list. This method implicitly calls load().
        Returns:
        The number of messages, or 0 if no list was retrieved.
        See Also:
        load()
      • getListDirection

        public boolean getListDirection()
        Returns the list direction.
        Returns:
        true if the messages are listed in order from oldest to newest; false if the messages are listed in order from newest to oldest.
        See Also:
        setListDirection(boolean)
      • getMessages

        public java.util.Enumeration getMessages()
                                          throws AS400SecurityException,
                                                 ErrorCompletingRequestException,
                                                 java.lang.InterruptedException,
                                                 java.io.IOException,
                                                 ObjectDoesNotExistException
        Returns the list of messages in the message queue. The enumeration retrieves the messages in blocks of 1000. If this does not yield the desired performance or memory usage, please use the getMessages() that returns an array of QueuedMessage objects and accepts a list offset and length. If an error occurs while the Enumeration is loading the next block of messages, a NoSuchElementException will be thrown while the real error will be logged to Trace.ERROR.
        Returns:
        An Enumeration of QueuedMessage objects.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
      • getMessages

        public QueuedMessage[] getMessages(int listOffset,
                                  int number)
                                    throws AS400SecurityException,
                                           ErrorCompletingRequestException,
                                           java.lang.InterruptedException,
                                           java.io.IOException,
                                           ObjectDoesNotExistException
        Returns a subset of the list of messages in the message queue. This method allows the user to retrieve the message list from the system in pieces. If a call to load() is made (either implicitly or explicitly), then the messages at a given list offset will change, so a subsequent call to getMessages() with the same listOffset and number will most likely not return the same QueuedMessages as the previous call.
        Parameters:
        listOffset - The offset in the list of messages (0-based). This value must be greater than or equal to 0 and less than the list length; or specify -1 to retrieve all of the messages.
        number - The number of messages to retrieve out of the list, starting at the specified listOffset. This value must be greater than or equal to 0 and less than or equal to the list length. If the listOffset is -1, this parameter is ignored.
        Returns:
        The array of retrieved QueuedMessage objects. The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
        See Also:
        QueuedMessage
      • getPath

        public java.lang.String getPath()
        Returns the fully qualified integrated file system path name of the message queue, or CURRENT to refer to the user's default message queue.
        Returns:
        The fully qualified integrated file system path name of the message queue, or CURRENT to refer to the user's default message queue.
        See Also:
        setPath(java.lang.String)
      • getSeverity

        public int getSeverity()
        Returns the severity of the messages which are returned.
        Returns:
        The severity of the messages which are returned.
        See Also:
        setSeverity(int)
      • getSort

        public boolean getSort()
        Returns whether or not messages will be sorted when ALL is specified for the selection criteria. The default is false.
        Returns:
        true if messages will be sorted by message type; false otherwise.
        See Also:
        setSort(boolean)
      • getSystem

        public AS400 getSystem()
        Returns the system object representing the system on which the message queue exists.
        Returns:
        The system object representing the system on which the message queue exists. If the system has not been set, null is returned.
      • getUserStartingMessageKey

        public byte[] getUserStartingMessageKey()
        Returns the user starting message key, if one has been set.
        Returns:
        The key, or null if none has been set.
        See Also:
        setUserStartingMessageKey(byte[])
      • getWorkstationStartingMessageKey

        public byte[] getWorkstationStartingMessageKey()
        Returns the workstation starting message key, if one has been set.
        Returns:
        The key, or null if none has been set.
        See Also:
        setWorkstationStartingMessageKey(byte[])
      • isSelectMessagesNeedReply

        public boolean isSelectMessagesNeedReply()
        Returns whether or not messages that need a reply are included in the list of returned messages. If all three message selection getters return true, it is the equivalent of all messages being included in the list of returned messages. By default, all messages are returned, so this method returns true.
        Returns:
        true if messages that need a reply are included in the list of returned messages; false if messages that need a reply are excluded from the list of returned messages.
        See Also:
        isSelectMessagesNoNeedReply(), isSelectSendersCopyMessagesNeedReply(), setSelectMessagesNeedReply(boolean)
      • isSelectMessagesNoNeedReply

        public boolean isSelectMessagesNoNeedReply()
        Returns whether or not messages that do not need a reply are included in the list of returned messages. If all three message selection getters return true, it is the equivalent of all messages being included in the list of returned messages. By default, all messages are returned, so this method returns true.
        Returns:
        true if messages that do not need a reply are included in the list of returned messages; false if messages that do not need a reply are excluded from the list of returned messages.
        See Also:
        isSelectMessagesNeedReply(), isSelectSendersCopyMessagesNeedReply(), setSelectMessagesNoNeedReply(boolean)
      • isSelectSendersCopyMessagesNeedReply

        public boolean isSelectSendersCopyMessagesNeedReply()
        Returns whether or not sender's copy messages that need a reply are included in the list of returned messages. If all three message selection getters return true, it is the equivalent of all messages being included in the list of returned messages. By default, all messages are returned, so this method returns true.
        Returns:
        true if sender's copy messages that need a reply are included in the list of returned messages; false if sender's copy messages that need a reply are excluded from the list of returned messages.
        See Also:
        isSelectMessagesNeedReply(), isSelectMessagesNoNeedReply(), setSelectSendersCopyMessagesNeedReply(boolean)
      • load

        public void load()
                  throws AS400SecurityException,
                         ErrorCompletingRequestException,
                         java.lang.InterruptedException,
                         java.io.IOException,
                         ObjectDoesNotExistException
        Loads the list of messages on the system. This method informs the system to build a list of messages given the previously added attributes to select, retrieve, and sort. This method blocks until the system returns the total number of messages it has compiled. A subsequent call to getMessages() will retrieve the actual message information and attributes for each message in the list from the system.

        This method updates the list length.

        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
        See Also:
        getLength()
      • receive

        public QueuedMessage receive(byte[] messageKey,
                            int waitTime,
                            java.lang.String messageAction,
                            java.lang.String messageType)
                              throws AS400SecurityException,
                                     ErrorCompletingRequestException,
                                     java.lang.InterruptedException,
                                     java.io.IOException,
                                     ObjectDoesNotExistException
        Receives a message from the message queue. See the list of QueuedMessage attribute values which are set on a received message.
        Parameters:
        messageKey - The message key, or null if no message key is needed.
        waitTime - The number of seconds to wait for the message to arrive in the queue so it can be received. If the message is not received within the specified wait time, null is returned. Special values are:
        • 0 - Do not wait for the message. If the message is not in the queue and you specified a message key, null is returned.
        • -1 - Wait until the message arrives in the queue and is received, no matter how long it takes. The system has no limit for the wait time.
        messageAction - The action to take after the message is received. Valid values are:
        • OLD - Keep the message in the message queue and mark it as an old message. You can receive the message again only by using the message key or by specifying the message type NEXT, PREVIOUS, FIRST, or LAST.
        • REMOVE - Remove the message from the message queue. The message key is no longer valid, so you cannot receive the message again.
        • SAME - Keep the message in the message queue without changing its new or old designation. SAME lets you receive the message again later without using the message key.
        messageType - The type of message to return. Valid values are:
        • ANY - Receives a message of any type except sender's copy. The message key is optional.
        • COMPLETION - Receives a completion message. The message key is optional.
        • COPY - Receives the sender's copy of a previously sent inquiry message. The message key is required.
        • DIAGNOSTIC - Receives a diagnostic message. The message key is optional.
        • FIRST - Receives the first new or old message in the queue. The message key is disallowed.
        • INFORMATIONAL - Receives an informational message. The message key is optional.
        • INQUIRY - Receives an inquiry message. If the action is REMOVE and a reply to the inquiry message has not been sent yet, the default reply is automatically sent when the inquiry message is received. The message key is optional.
        • LAST - Receives the last new or old message in the queue. The message key is disallowed.
        • NEXT - Receives the next new or old message after the message with the specified key. You can use the special value TOP for the message key. TOP designates the message at the top of the message queue. The message key is required.
        • PREVIOUS - Receives the new or old message before the message with the specified key. The message key is required.
        • REPLY - Receives the reply to an inquiry message. For the message key, you can use the key to the sender's copy of the inquiry or notify message. The message key is optional.
        Returns:
        The queued message, or null if the message can not be received.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
        See Also:
        QueuedMessage.getKey()
      • remove

        public void remove(java.lang.String messageType)
                    throws AS400SecurityException,
                           ErrorCompletingRequestException,
                           java.lang.InterruptedException,
                           java.io.IOException,
                           ObjectDoesNotExistException
        Remove messages from the message queue.
        Parameters:
        messageType - The type of message to remove. Valid values are:
        • ALL - All messages in the message queue.
        • KEEP_UNANSWERED - All messages in the message queue except unanswered inquiry and unanswered senders' copy messages.
        • NEW - All new messages in the message queue. New messages are those that have not been received.
        • OLD - All old messages in the message queue. Old messages are those that have already been received.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
      • removePropertyChangeListener

        public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
        Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done.
        Parameters:
        listener - The listener object.
      • removeVetoableChangeListener

        public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
        Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done.
        Parameters:
        listener - The listener object.
      • reply

        public void reply(byte[] messageKey,
                 java.lang.String replyText,
                 boolean remove)
                   throws AS400SecurityException,
                          ErrorCompletingRequestException,
                          java.lang.InterruptedException,
                          java.io.IOException,
                          ObjectDoesNotExistException
        Replies to and removes a message if requested.
        Parameters:
        messageKey - The message key.
        replyText - The reply. To send the default reply stored in the message description, use blanks for this parameter.
        remove - true to remove the inquiry message and the reply from the message queue after the reply is sent, false to keep the inquiry message and the reply after the reply is sent.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
      • sendInformational

        public void sendInformational(java.lang.String messageID,
                             java.lang.String messageFile,
                             byte[] substitutionData)
                               throws AS400SecurityException,
                                      ErrorCompletingRequestException,
                                      java.lang.InterruptedException,
                                      java.io.IOException,
                                      ObjectDoesNotExistException
        Sends an informational message to the message queue.
        Parameters:
        messageID - The message ID.
        messageFile - The integrated file system path name of the message file.
        substitutionData - The substitution data for the message, or null if none.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
      • sendInquiry

        public byte[] sendInquiry(java.lang.String messageID,
                         java.lang.String messageFile,
                         java.lang.String replyMessageQueue)
                           throws AS400SecurityException,
                                  ErrorCompletingRequestException,
                                  java.lang.InterruptedException,
                                  java.io.IOException,
                                  ObjectDoesNotExistException
        Sends an inquiry message to the message queue.
        Parameters:
        messageID - The message ID.
        messageFile - The integrated file system path name of the message file.
        replyMessageQueue - The integrated file system path name of the reply message queue.
        Returns:
        The message key.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
      • sendInquiry

        public byte[] sendInquiry(java.lang.String messageID,
                         java.lang.String messageFile,
                         byte[] substitutionData,
                         java.lang.String replyMessageQueue)
                           throws AS400SecurityException,
                                  ErrorCompletingRequestException,
                                  java.lang.InterruptedException,
                                  java.io.IOException,
                                  ObjectDoesNotExistException
        Sends an inquiry message to the message queue.
        Parameters:
        messageID - The message ID.
        messageFile - The integrated file system path name of the message file.
        substitutionData - The substitution data for the message, or null if none.
        replyMessageQueue - The integrated file system path name of the reply message queue.
        Returns:
        The message key.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
      • sendInquiry

        public byte[] sendInquiry(java.lang.String messageText,
                         java.lang.String replyMessageQueue)
                           throws AS400SecurityException,
                                  ErrorCompletingRequestException,
                                  java.lang.InterruptedException,
                                  java.io.IOException,
                                  ObjectDoesNotExistException
        Sends an inquiry message to the message queue.
        Parameters:
        messageText - The message text.
        replyMessageQueue - The integrated file system path name of the reply message queue.
        Returns:
        The message key.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        ErrorCompletingRequestException - If an error occurs before the request is completed.
        java.lang.InterruptedException - If this thread is interrupted.
        java.io.IOException - If an error occurs while communicating with the system.
        ObjectDoesNotExistException - If the object does not exist on the system.
      • setHelpTextFormatting

        public void setHelpTextFormatting(int helpTextFormatting)
        Sets the help text formatting value. Possible values are:
        Parameters:
        helpTextFormatting - The help text formatting value.
      • setListDirection

        public void setListDirection(boolean listDirection)
        Sets the list direction.
        Parameters:
        listDirection - true to list the messages in order from oldest to newest; false to list the messages in order from newest to oldest. The default is true.
        See Also:
        getListDirection()
      • setSort

        public void setSort(boolean sort)
        Sets whether the list should be sorted by message type when ALL messages are selected for retrieval. If the selection criteria is set to something other than ALL, the sort setting is ignored.
        Parameters:
        sort - true to indicate the messages should be sorted; false to indicate no sorting should be performed on the message list.
        See Also:
        getSort()
      • setPath

        public void setPath(java.lang.String path)
                     throws java.beans.PropertyVetoException
        Sets the fully qualified integrated file system path name of the message queue. The default is CURRENT. The path cannot be changed if the MessageQueue object has established a connection to the system.
        Parameters:
        path - The fully qualified integrated file system path name of the message queue, or CURRENT to refer to the user's default message queue.
        Throws:
        java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.
      • setSelectMessagesNeedReply

        public void setSelectMessagesNeedReply(boolean selectMessagesNeedReply)
        Sets whether or not to include messages that need a reply in the returned list of messages. Passing true to all three message selection setters is equivalent to retrieving all the messages. By default, all messages are retrieved.
        Parameters:
        selectMessagesNeedReply - true to include messages that need a reply; false to exclude messages that need a reply.
        See Also:
        isSelectMessagesNeedReply(), setSelectMessagesNoNeedReply(boolean), setSelectSendersCopyMessagesNeedReply(boolean)
      • setSelectMessagesNoNeedReply

        public void setSelectMessagesNoNeedReply(boolean selectMessagesNoNeedReply)
        Sets whether or not to include messages that do not need a reply in the returned list of messages. Passing true to all three message selection setters is equivalent to retrieving all the messages. By default, all messages are retrieved.
        Parameters:
        selectMessagesNoNeedReply - true to include messages that do not need a reply; false to exclude messages that do not need a reply.
        See Also:
        isSelectMessagesNoNeedReply(), setSelectMessagesNeedReply(boolean), setSelectSendersCopyMessagesNeedReply(boolean)
      • setSelectSendersCopyMessagesNeedReply

        public void setSelectSendersCopyMessagesNeedReply(boolean selectSendersCopyMessagesNeedReply)
        Sets whether or not to include sender's copy messages that need a reply in the returned list of messages. Passing true to all three message selection setters is equivalent to retrieving all the messages. By default, all messages are retrieved.
        Parameters:
        selectSendersCopyMessagesNeedReply - true to include sender's copy messages that need a reply; false to exclude sender's copy messages that need a reply.
        See Also:
        isSelectSendersCopyMessagesNeedReply(), setSelectMessagesNeedReply(boolean), setSelectMessagesNoNeedReply(boolean)
      • setSeverity

        public void setSeverity(int severity)
                         throws java.beans.PropertyVetoException
        Sets the severity of the messages which are returned. All messages of the specified severity and greater are returned. The default is 0. This takes effect the next time that the list of queued messages is retrieved or refreshed.
        Parameters:
        severity - The severity of the messages to be returned. The value must be between 0 and 99, inclusive.
        Throws:
        java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.
        See Also:
        RMessageQueue.SEVERITY_CRITERIA
      • setSystem

        public void setSystem(AS400 system)
                       throws java.beans.PropertyVetoException
        Sets the system. This cannot be changed if the object has established a connection to the system.
        Parameters:
        system - The system object representing the system on which the message queue exists.
        Throws:
        java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.
      • setUserStartingMessageKey

        public void setUserStartingMessageKey(byte[] userStartingMessageKey)
        Sets the starting message key used to begin searching for messages to list from the corresponding entry in the message queue. Any valid message key will work, including NEWEST and OLDEST. If the key of a reply message is specified, the message search begins with the inquiry or sender's copy message associated with that reply, not the reply message itself.

        If the message queue is set to CURRENT, then the key represents the starting message key for the current user's user message queue.

        Parameters:
        userStartingMessageKey - The key. Specify null to set it back to the default, which will be OLDEST or NEWEST based on the list direction.
      • setWorkstationStartingMessageKey

        public void setWorkstationStartingMessageKey(byte[] workstationStartingMessageKey)
        Sets the starting message key used to begin searching for messages to list from the corresponding entry in the message queue. Any valid message key will work, including NEWEST and OLDEST. If the key of a reply message is specified, the message search begins with the inquiry or sender's copy message associated with that reply, not the reply message itself.

        If the message queue is set to CURRENT, then the key represents the starting message key for the current user's workstation message queue.

        Parameters:
        workstationStartingMessageKey - The key. Specify null to set it back to the default.