com.ibm.as400.resource
Class RMessageQueue

java.lang.Object
  extended by com.ibm.as400.resource.ResourceList
      extended by com.ibm.as400.resource.BufferedResourceList
          extended by com.ibm.as400.resource.SystemResourceList
              extended by com.ibm.as400.resource.RMessageQueue
All Implemented Interfaces:
Serializable

Deprecated. Use MessageQueue instead, as this package may be removed in the future.

public class RMessageQueue
extends SystemResourceList

The RMessageQueue class represents a message queue. If no message queue path is set, then the default is CURRENT, which represents the current user's message queue,

/QSYS.LIB/QUSRSYS.LIB/userID.MSGQ
.

The following selection IDs are supported:

Use one or more of these selection IDs with getSelectionValue() and setSelectionValue() to access the selection values for an RMessageQueue.

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

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

// Create an RMessageQueue object to represent a specific message queue.
AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
RMessageQueue messageQueue = new RMessageQueue(system, "/QSYS.LIB/MYLIB.LIB/MYMSGQ.MSG");

// Set the selection so that the list of messages includes // only messages that need a reply. messageQueue.setSelectionValue(RMessageQueue.SELECTION_CRITERIA, RMessageQueue.MESSAGES_NEED_REPLY);
// Open the list and wait for it to complete. messageQueue.open(); messageQueue.waitForComplete();
// Read and print the messages in the list. long numberOfMessages = messageQueue.getListLength(); for(long i = 0; i < numberOfMessages; ++i) { RQueuedMessage queuedMessage = (RQueuedMessage)messageQueue.resourceAt(i); System.out.println(queuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_TEXT)); }
// Close the list. messageQueue.close();

See Also:
RQueuedMessage, Serialized Form

Field Summary
static String ALL
          Deprecated. Constant referring to all messages in the message queue.
static String ANY
          Deprecated. Constant referring to any message in the message queue.
static String BYKEY
          Deprecated. Constant referring to a message identified by a key.
static String COMPLETION
          Deprecated. Constant referring to completion messages.
static String COPY
          Deprecated. Constant referring to the sender's copy of a previously sent inquiry message.
static String CURRENT
          Deprecated. Constant referring to the current user's message queue.
static String DIAGNOSTIC
          Deprecated. Constant referring to diagnostic messages.
static String FIRST
          Deprecated. Constant referring to the first message in the message queue.
static String FORMATTING_CHARACTERS
          Deprecated. Selection ID for formatting characters.
static String INFORMATIONAL
          Deprecated. Constant referring to informational messages.
static String INQUIRY
          Deprecated. Constant referring to inquiry messages.
static String KEEP_UNANSWERED
          Deprecated. Constant referring to all messages in the message queue except unanswered inquiry and unanswered senders' copy messages.
static String LAST
          Deprecated. Constant referring to the last message in the message queue.
static String LIST_DIRECTION
          Deprecated. Selection ID for list direction.
static String MESSAGES_NEED_REPLY
          Deprecated. Constant referring to messages that need a reply.
static String MESSAGES_NO_NEED_REPLY
          Deprecated. Constant referring to messages that do not need a reply.
static String NEW
          Deprecated. Constant referring to all new messages in the message queue.
static byte[] NEWEST
          Deprecated. Constant referring to the message key for the newest message in the queue.
static String NEXT
          Deprecated. Constant referring to the next message in the message queue.
static Integer NO_FORMATTING
          Deprecated. Constant indicating that message help text is not formatted.
static String OLD
          Deprecated. Constant referring to all old messages in the message queue.
static byte[] OLDEST
          Deprecated. Constant referring to the message key for the oldest message in the queue.
static String PREVIOUS
          Deprecated. Constant referring to the previous message in the message queue.
static String REMOVE
          Deprecated. Constant indicating that the message should be removed from the message queue.
static String REPLACEMENT_DATA
          Deprecated. Selection ID for replacement data.
static String REPLY
          Deprecated. Constant referring to the reply to an inquiry message.
static Integer RETURN_FORMATTING_CHARACTERS
          Deprecated. Constant indicating that message help text includes formatting characters.
static String SAME
          Deprecated. Constant indicating that the message should remain in the message queue without changing its new or old designation.
static String SELECTION_CRITERIA
          Deprecated. Selection ID for selection criteria.
static String SENDERS_COPY_NEED_REPLY
          Deprecated. Constant referring to the sender's copies of messages that need replies.
static String SEVERITY_CRITERIA
          Deprecated. Selection ID for severity criteria.
static String SORT_CRITERIA
          Deprecated. Selection ID for sort criteria.
static String STARTING_USER_MESSAGE_KEY
          Deprecated. Selection ID for starting user message key.
static String STARTING_WORKSTATION_MESSAGE_KEY
          Deprecated. Selection ID for starting workstation message key.
static Integer SUBSTITUTE_FORMATTING_CHARACTERS
          Deprecated. Constant indicating that message help text is formatted.
 
Constructor Summary
RMessageQueue()
          Deprecated. Constructs an RMessageQueue object.
RMessageQueue(AS400 system)
          Deprecated. Constructs an RMessageQueue object.
RMessageQueue(AS400 system, String path)
          Deprecated. Constructs an RMessageQueue object.
 
Method Summary
protected  void establishConnection()
          Deprecated. Establishes the connection to the system.
 String getPath()
          Deprecated. Returns the fully qualified integrated file system path name of the message queue, or CURRENT to refer to the user's default message queue.
 RQueuedMessage receive(byte[] messageKey)
          Deprecated. Receives a message from the message queue by key.
 RQueuedMessage receive(byte[] messageKey, int waitTime, String messageAction, String messageType)
          Deprecated. Receives a message from the message queue.
 void remove()
          Deprecated. Remove all messages from the message queue.
 void remove(byte[] messageKey)
          Deprecated. Removes a message from the message queue.
 void remove(String messageType)
          Deprecated. Remove messages from the message queue.
 void reply(byte[] messageKey, String replyText)
          Deprecated. Replies to and removes a message.
 void reply(byte[] messageKey, String replyText, boolean remove)
          Deprecated. Replies to a message.
 void sendInformational(String messageText)
          Deprecated. Sends an informational message to the message queue.
 void sendInformational(String messageID, String messageFile)
          Deprecated. Sends an informational message to the message queue.
 void sendInformational(String messageID, String messageFile, byte[] substitutionData)
          Deprecated. Sends an informational message to the message queue.
 byte[] sendInquiry(String messageText, String replyMessageQueue)
          Deprecated. Sends an inquiry message to the message queue.
 byte[] sendInquiry(String messageID, String messageFile, byte[] substitutionData, String replyMessageQueue)
          Deprecated. Sends an inquiry message to the message queue.
 byte[] sendInquiry(String messageID, String messageFile, String replyMessageQueue)
          Deprecated. Sends an inquiry message to the message queue.
 void setPath(String path)
          Deprecated. Sets the fully qualified integrated file system path name of the message queue.
 
Methods inherited from class com.ibm.as400.resource.SystemResourceList
close, isBidiEnabled, isResourceAvailable, open, refreshContents, refreshStatus, resourceAt, setSelectionValue, waitForComplete, waitForResource
 
Methods inherited from class com.ibm.as400.resource.BufferedResourceList
fireResourceAdded, getNumberOfPages, getPageSize, setNumberOfPages, setPageSize
 
Methods inherited from class com.ibm.as400.resource.ResourceList
addActiveStatusListener, addPropertyChangeListener, addResourceListListener, addVetoableChangeListener, arePropertiesFrozen, fireBusy, fireIdle, fireLengthChanged, fireListClosed, fireListCompleted, fireListInError, fireListOpened, firePropertyChange, fireVetoableChange, freezeProperties, getAttributeMetaData, getAttributeMetaData, getListLength, getPresentation, getSelectionMetaData, getSelectionMetaData, getSelectionValue, getSelectionValue, getSortMetaData, getSortMetaData, getSortOrder, getSortValue, getSystem, isComplete, isConnectionEstablished, isInError, isOpen, removeActiveStatusListener, removePropertyChangeListener, removeResourceListListener, removeVetoableChangeListener, resources, setAttributeMetaData, setPresentation, setSelectionValue, setSortOrder, setSortValue, setSystem, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL

public static final String ALL
Deprecated. 
Constant referring to all messages in the message queue.

See Also:
Constant Field Values

ANY

public static final String ANY
Deprecated. 
Constant referring to any message in the message queue.

See Also:
Constant Field Values

BYKEY

public static final String BYKEY
Deprecated. 
Constant referring to a message identified by a key.

See Also:
Constant Field Values

COMPLETION

public static final String COMPLETION
Deprecated. 
Constant referring to completion messages.

See Also:
Constant Field Values

COPY

public static final String COPY
Deprecated. 
Constant referring to the sender's copy of a previously sent inquiry message.

See Also:
Constant Field Values

CURRENT

public static final String CURRENT
Deprecated. 
Constant referring to the current user's message queue.

See Also:
Constant Field Values

DIAGNOSTIC

public static final String DIAGNOSTIC
Deprecated. 
Constant referring to diagnostic messages.

See Also:
Constant Field Values

FIRST

public static final String FIRST
Deprecated. 
Constant referring to the first message in the message queue.

See Also:
Constant Field Values

INFORMATIONAL

public static final String INFORMATIONAL
Deprecated. 
Constant referring to informational messages.

See Also:
Constant Field Values

INQUIRY

public static final String INQUIRY
Deprecated. 
Constant referring to inquiry messages.

See Also:
Constant Field Values

KEEP_UNANSWERED

public static final String KEEP_UNANSWERED
Deprecated. 
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 String LAST
Deprecated. 
Constant referring to the last message in the message queue.

See Also:
Constant Field Values

MESSAGES_NEED_REPLY

public static final String MESSAGES_NEED_REPLY
Deprecated. 
Constant referring to messages that need a reply.

See Also:
Constant Field Values

MESSAGES_NO_NEED_REPLY

public static final String MESSAGES_NO_NEED_REPLY
Deprecated. 
Constant referring to messages that do not need a reply.

See Also:
Constant Field Values

NEW

public static final String NEW
Deprecated. 
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
Deprecated. 
Constant referring to the message key for the newest message in the queue.


NEXT

public static final String NEXT
Deprecated. 
Constant referring to the next message in the message queue.

See Also:
Constant Field Values

OLD

public static final String OLD
Deprecated. 
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
Deprecated. 
Constant referring to the message key for the oldest message in the queue.


PREVIOUS

public static final String PREVIOUS
Deprecated. 
Constant referring to the previous message in the message queue.

See Also:
Constant Field Values

REMOVE

public static final String REMOVE
Deprecated. 
Constant indicating that the message should be removed from the message queue.

See Also:
Constant Field Values

REPLY

public static final String REPLY
Deprecated. 
Constant referring to the reply to an inquiry message.

See Also:
Constant Field Values

SAME

public static final String SAME
Deprecated. 
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 String SENDERS_COPY_NEED_REPLY
Deprecated. 
Constant referring to the sender's copies of messages that need replies.

See Also:
Constant Field Values

NO_FORMATTING

public static final Integer NO_FORMATTING
Deprecated. 
Constant indicating that message help text is not formatted.


RETURN_FORMATTING_CHARACTERS

public static final Integer RETURN_FORMATTING_CHARACTERS
Deprecated. 
Constant indicating that message help text includes formatting characters.


SUBSTITUTE_FORMATTING_CHARACTERS

public static final Integer SUBSTITUTE_FORMATTING_CHARACTERS
Deprecated. 
Constant indicating that message help text is formatted.


FORMATTING_CHARACTERS

public static final String FORMATTING_CHARACTERS
Deprecated. 
Selection ID for formatting characters. This identifies a Integer selection, which represents the type of message help text formatting. Possible values are: The default is NO_FORMATTING.

See Also:
Constant Field Values

LIST_DIRECTION

public static final String LIST_DIRECTION
Deprecated. 
Selection ID for list direction. This identifies a String selection, which represents the direction to list messages relative to the values specified for the STARTING_USER_MESSAGE_KEY and STARTING_WORKSTATION_MESSAGE_KEY selections. Possible values are: The default is NEXT.

See Also:
Constant Field Values

REPLACEMENT_DATA

public static final String REPLACEMENT_DATA
Deprecated. 
Selection ID for replacement data. This identifies a Boolean selection, which indicates whether to replace substitution data in message text. The default is true.

See Also:
Constant Field Values

SELECTION_CRITERIA

public static final String SELECTION_CRITERIA
Deprecated. 
Selection ID for selection criteria. This identifies a String selection, which represents the type of messages to be listed. Possible values are: The default is ALL.

See Also:
Constant Field Values

SEVERITY_CRITERIA

public static final String SEVERITY_CRITERIA
Deprecated. 
Selection ID for severity criteria. This identifies an Integer selection, which represents the minimum severity of a message to be included in the list. The value must be in the range 0 to 99. The default is 0.

See Also:
Constant Field Values

SORT_CRITERIA

public static final String SORT_CRITERIA
Deprecated. 
Selection ID for sort criteria. This identifies a Boolean selection, which indicates whether the list should be sorted by type if the SELECTION_CRITERIA selection is set to ALL. The default is false.

See Also:
Constant Field Values

STARTING_USER_MESSAGE_KEY

public static final String STARTING_USER_MESSAGE_KEY
Deprecated. 
Selection ID for starting user message key. This identifies a byte[] selection, which represents the message key used to begin searching for messages to list from the corresponding entry in the message queue. If the message queue path name is set to CURRENT, then this selection represents the starting message key for the current user's user message queue. Possible values are: The default is OLDEST.

If a value other than OLDEST or NEWEST is specified and a message with that key does not exist, an exception is thrown. If the key of a reply message is specified, the message search begins with the inquiry or sender's copy message that the reply with associated with, not the reply message itself.

See Also:
Constant Field Values

STARTING_WORKSTATION_MESSAGE_KEY

public static final String STARTING_WORKSTATION_MESSAGE_KEY
Deprecated. 
Selection ID for starting workstation message key. This identifies a byte[] selection, which represents the message key used to begin searching for messages to list from the corresponding entry in the message queue. If the message queue path name is set to CURRENT, then this selection represents the starting message key for the current user's workstation message queue. Otherwise, this selection has no effect. Possible values are: The default is OLDEST.

If a value other than OLDEST or NEWEST is specified and a message with that key does not exist, an exception is thrown. If the key of a reply message is specified, the message search begins with the inquiry or sender's copy message that the reply with associated with, not the reply message itself.

See Also:
Constant Field Values
Constructor Detail

RMessageQueue

public RMessageQueue()
Deprecated. 
Constructs an RMessageQueue object.


RMessageQueue

public RMessageQueue(AS400 system)
Deprecated. 
Constructs an RMessageQueue object.

Parameters:
system - The system.

RMessageQueue

public RMessageQueue(AS400 system,
                     String path)
Deprecated. 
Constructs an RMessageQueue object.

Parameters:
system - The system.
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

establishConnection

protected void establishConnection()
                            throws ResourceException
Deprecated. 
Establishes the connection to the system.

The method is called by the resource framework automatically when the connection needs to be established.

Overrides:
establishConnection in class ResourceList
Throws:
ResourceException - If an error occurs.

getPath

public String getPath()
Deprecated. 
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.

receive

public RQueuedMessage receive(byte[] messageKey)
                       throws ResourceException
Deprecated. 
Receives a message from the message queue by key. This method receives a message of any type except sender's copy. The message is removed from the message queue. See the list of RQueuedMessage attribute values which are set on a received message.

Parameters:
messageKey - The message key.
Returns:
The queued message, or null if the message can not be received.
Throws:
ResourceException - If an error occurs.
See Also:
RQueuedMessage.MESSAGE_KEY

receive

public RQueuedMessage receive(byte[] messageKey,
                              int waitTime,
                              String messageAction,
                              String messageType)
                       throws ResourceException
Deprecated. 
Receives a message from the message queue. See the list of RQueuedMessage 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:
ResourceException - If an error occurs.
See Also:
RQueuedMessage.MESSAGE_KEY

remove

public void remove()
            throws ResourceException
Deprecated. 
Remove all messages from the message queue.

Throws:
ResourceException - If an error occurs.

remove

public void remove(byte[] messageKey)
            throws ResourceException
Deprecated. 
Removes a message from the message queue.

Parameters:
messageKey - The message key.
Throws:
ResourceException - If an error occurs.

remove

public void remove(String messageType)
            throws ResourceException
Deprecated. 
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:
ResourceException - If an error occurs.

reply

public void reply(byte[] messageKey,
                  String replyText)
           throws ResourceException
Deprecated. 
Replies to and removes a message.

Parameters:
messageKey - The message key.
replyText - The reply.
Throws:
ResourceException - If an error occurs.

reply

public void reply(byte[] messageKey,
                  String replyText,
                  boolean remove)
           throws ResourceException
Deprecated. 
Replies to a message.

Parameters:
messageKey - The message key.
replyText - The reply.
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:
ResourceException - If an error occurs.

sendInformational

public void sendInformational(String messageID,
                              String messageFile)
                       throws ResourceException
Deprecated. 
Sends an informational message to the message queue.

Parameters:
messageID - The message ID.
messageFile - The integrated file system path name of the message file.
Throws:
ResourceException - If an error occurs.

sendInformational

public void sendInformational(String messageID,
                              String messageFile,
                              byte[] substitutionData)
                       throws ResourceException
Deprecated. 
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:
ResourceException - If an error occurs.

sendInformational

public void sendInformational(String messageText)
                       throws ResourceException
Deprecated. 
Sends an informational message to the message queue.

Parameters:
messageText - The message text.
Throws:
ResourceException - If an error occurs.

sendInquiry

public byte[] sendInquiry(String messageID,
                          String messageFile,
                          String replyMessageQueue)
                   throws ResourceException
Deprecated. 
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:
ResourceException - If an error occurs.

sendInquiry

public byte[] sendInquiry(String messageID,
                          String messageFile,
                          byte[] substitutionData,
                          String replyMessageQueue)
                   throws ResourceException
Deprecated. 
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:
ResourceException - If an error occurs.

sendInquiry

public byte[] sendInquiry(String messageText,
                          String replyMessageQueue)
                   throws ResourceException
Deprecated. 
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:
ResourceException - If an error occurs.

setPath

public void setPath(String path)
             throws PropertyVetoException
Deprecated. 
Sets the fully qualified integrated file system path name of the message queue. The default is CURRENT. The path cannot be changed if this object has already 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:
PropertyVetoException - If the change is vetoed.