MessageQueue
instead, as this package may be removed in the future.public class RMessageQueue extends SystemResourceList
CURRENT
,
which represents the current user's message queue,
/QSYS.LIB/QUSRSYS.LIB/userID.MSGQ. The following selection IDs are supported:
FORMATTING_CHARACTERS
LIST_DIRECTION
REPLACEMENT_DATA
SELECTION_CRITERIA
SEVERITY_CRITERIA
SORT_CRITERIA
STARTING_USER_MESSAGE_KEY
STARTING_WORKSTATION_MESSAGE_KEY
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:
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_USER_NAME
SENDING_PROGRAM_NAME
receive()
:
ALERT_OPTION
DATE_SENT
MESSAGE_FILE
MESSAGE_HELP
MESSAGE_ID
MESSAGE_KEY
MESSAGE_SEVERITY
MESSAGE_TEXT
MESSAGE_TYPE
SENDER_JOB_NAME
SENDER_JOB_NUMBER
SENDER_USER_NAME
SENDING_PROGRAM_NAME
SUBSTITUTION_DATA
// 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();
RQueuedMessage
,
Serialized FormModifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL
Deprecated.
Constant referring to all messages in the message queue.
|
static java.lang.String |
ANY
Deprecated.
Constant referring to any message in the message queue.
|
static java.lang.String |
BYKEY
Deprecated.
Constant referring to a message identified by a key.
|
static java.lang.String |
COMPLETION
Deprecated.
Constant referring to completion messages.
|
static java.lang.String |
COPY
Deprecated.
Constant referring to the sender's copy of a previously sent
inquiry message.
|
static java.lang.String |
CURRENT
Deprecated.
Constant referring to the current user's message queue.
|
static java.lang.String |
DIAGNOSTIC
Deprecated.
Constant referring to diagnostic messages.
|
static java.lang.String |
FIRST
Deprecated.
Constant referring to the first message in the message queue.
|
static java.lang.String |
FORMATTING_CHARACTERS
Deprecated.
Selection ID for formatting characters.
|
static java.lang.String |
INFORMATIONAL
Deprecated.
Constant referring to informational messages.
|
static java.lang.String |
INQUIRY
Deprecated.
Constant referring to inquiry messages.
|
static java.lang.String |
KEEP_UNANSWERED
Deprecated.
Constant referring to all messages in the message queue
except unanswered inquiry and unanswered senders' copy messages.
|
static java.lang.String |
LAST
Deprecated.
Constant referring to the last message in the message queue.
|
static java.lang.String |
LIST_DIRECTION
Deprecated.
Selection ID for list direction.
|
static java.lang.String |
MESSAGES_NEED_REPLY
Deprecated.
Constant referring to messages that need a reply.
|
static java.lang.String |
MESSAGES_NO_NEED_REPLY
Deprecated.
Constant referring to messages that do not need a reply.
|
static java.lang.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 java.lang.String |
NEXT
Deprecated.
Constant referring to the next message in the message queue.
|
static java.lang.Integer |
NO_FORMATTING
Deprecated.
Constant indicating that message help text is not formatted.
|
static java.lang.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 java.lang.String |
PREVIOUS
Deprecated.
Constant referring to the previous message in the message queue.
|
static java.lang.String |
REMOVE
Deprecated.
Constant indicating that the message should be removed from
the message queue.
|
static java.lang.String |
REPLACEMENT_DATA
Deprecated.
Selection ID for replacement data.
|
static java.lang.String |
REPLY
Deprecated.
Constant referring to the reply to an inquiry message.
|
static java.lang.Integer |
RETURN_FORMATTING_CHARACTERS
Deprecated.
Constant indicating that message help text includes formatting characters.
|
static java.lang.String |
SAME
Deprecated.
Constant indicating that the message should remain in the
message queue without changing its new or old designation.
|
static java.lang.String |
SELECTION_CRITERIA
Deprecated.
Selection ID for selection criteria.
|
static java.lang.String |
SENDERS_COPY_NEED_REPLY
Deprecated.
Constant referring to the sender's copies of messages that
need replies.
|
static java.lang.String |
SEVERITY_CRITERIA
Deprecated.
Selection ID for severity criteria.
|
static java.lang.String |
SORT_CRITERIA
Deprecated.
Selection ID for sort criteria.
|
static java.lang.String |
STARTING_USER_MESSAGE_KEY
Deprecated.
Selection ID for starting user message key.
|
static java.lang.String |
STARTING_WORKSTATION_MESSAGE_KEY
Deprecated.
Selection ID for starting workstation message key.
|
static java.lang.Integer |
SUBSTITUTE_FORMATTING_CHARACTERS
Deprecated.
Constant indicating that message help text is formatted.
|
Constructor and Description |
---|
RMessageQueue()
Deprecated.
Constructs an RMessageQueue object.
|
RMessageQueue(AS400 system)
Deprecated.
Constructs an RMessageQueue object.
|
RMessageQueue(AS400 system,
java.lang.String path)
Deprecated.
Constructs an RMessageQueue object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
establishConnection()
Deprecated.
Establishes the connection to the system.
|
java.lang.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,
java.lang.String messageAction,
java.lang.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(java.lang.String messageType)
Deprecated.
Remove messages from the message queue.
|
void |
reply(byte[] messageKey,
java.lang.String replyText)
Deprecated.
Replies to and removes a message.
|
void |
reply(byte[] messageKey,
java.lang.String replyText,
boolean remove)
Deprecated.
Replies to a message.
|
void |
sendInformational(java.lang.String messageText)
Deprecated.
Sends an informational message to the message queue.
|
void |
sendInformational(java.lang.String messageID,
java.lang.String messageFile)
Deprecated.
Sends an informational message to the message queue.
|
void |
sendInformational(java.lang.String messageID,
java.lang.String messageFile,
byte[] substitutionData)
Deprecated.
Sends an informational message to the message queue.
|
byte[] |
sendInquiry(java.lang.String messageText,
java.lang.String replyMessageQueue)
Deprecated.
Sends an inquiry message to the message queue.
|
byte[] |
sendInquiry(java.lang.String messageID,
java.lang.String messageFile,
byte[] substitutionData,
java.lang.String replyMessageQueue)
Deprecated.
Sends an inquiry message to the message queue.
|
byte[] |
sendInquiry(java.lang.String messageID,
java.lang.String messageFile,
java.lang.String replyMessageQueue)
Deprecated.
Sends an inquiry message to the message queue.
|
void |
setPath(java.lang.String path)
Deprecated.
Sets the fully qualified integrated file system path name of the
message queue.
|
close, isBidiEnabled, isResourceAvailable, open, refreshContents, refreshStatus, resourceAt, setSelectionValue, waitForComplete, waitForResource
fireResourceAdded, getNumberOfPages, getPageSize, setNumberOfPages, setPageSize
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
public static final java.lang.String ALL
public static final java.lang.String ANY
public static final java.lang.String BYKEY
public static final java.lang.String COMPLETION
public static final java.lang.String COPY
public static final java.lang.String CURRENT
public static final java.lang.String DIAGNOSTIC
public static final java.lang.String FIRST
public static final java.lang.String INFORMATIONAL
public static final java.lang.String INQUIRY
public static final java.lang.String KEEP_UNANSWERED
public static final java.lang.String LAST
public static final java.lang.String MESSAGES_NEED_REPLY
public static final java.lang.String MESSAGES_NO_NEED_REPLY
public static final java.lang.String NEW
public static final byte[] NEWEST
public static final java.lang.String NEXT
public static final java.lang.String OLD
public static final byte[] OLDEST
public static final java.lang.String PREVIOUS
public static final java.lang.String REMOVE
public static final java.lang.String REPLY
public static final java.lang.String SAME
public static final java.lang.String SENDERS_COPY_NEED_REPLY
public static final java.lang.Integer NO_FORMATTING
public static final java.lang.Integer RETURN_FORMATTING_CHARACTERS
public static final java.lang.Integer SUBSTITUTE_FORMATTING_CHARACTERS
public static final java.lang.String FORMATTING_CHARACTERS
NO_FORMATTING
- Message help text is not formatted.
RETURN_FORMATTING_CHARACTERS
- Message help text includes formatting characters.
SUBSTITUTE_FORMATTING_CHARACTERS
- Message help text is formatted.
public static final java.lang.String LIST_DIRECTION
STARTING_USER_MESSAGE_KEY
and STARTING_WORKSTATION_MESSAGE_KEY
selections. Possible values are:
NEXT
- Returns messages that are newer than the messages specified for
the STARTING_USER_MESSAGE_KEY and STARTING_WORKSTATION_MESSAGE_KEY
selections.
PREVIOUS
- Returns messages that are older than the messages specified for
the STARTING_USER_MESSAGE_KEY and STARTING_WORKSTATION_MESSAGE_KEY
selections.
public static final java.lang.String REPLACEMENT_DATA
public static final java.lang.String SELECTION_CRITERIA
ALL
- All messages are listed.
MESSAGES_NEED_REPLY
- Only messages that need a reply are listed.
SENDERS_COPY_NEED_REPLY
- Only the sender's copy messages that need a reply are listed.
MESSAGES_NO_NEED_REPLY
- Only messages that do not need a reply are listed.
public static final java.lang.String SEVERITY_CRITERIA
public static final java.lang.String SORT_CRITERIA
SELECTION_CRITERIA
selection is
set to ALL
. The default is false.public static final java.lang.String STARTING_USER_MESSAGE_KEY
CURRENT
, then this selection represents
the starting message key for the current user's user message queue. Possible
values are:
OLDEST
- The first message to be returned is the oldest message in the queue.
NEWEST
- The first message to be returned is the newest message in the queue.
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.
public static final java.lang.String STARTING_WORKSTATION_MESSAGE_KEY
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:
OLDEST
- The first message to be returned is the oldest message in the queue.
NEWEST
- The first message to be returned is the newest message in the queue.
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.
public RMessageQueue()
public RMessageQueue(AS400 system)
system
- The system.protected void establishConnection() throws ResourceException
The method is called by the resource framework automatically when the connection needs to be established.
establishConnection
in class ResourceList
ResourceException
- If an error occurs.public java.lang.String getPath()
CURRENT
to refer to the user's default
message queue.CURRENT
to refer to the user's default
message queue.public RQueuedMessage receive(byte[] messageKey) throws ResourceException
messageKey
- The message key.ResourceException
- If an error occurs.RQueuedMessage.MESSAGE_KEY
public RQueuedMessage receive(byte[] messageKey, int waitTime, java.lang.String messageAction, java.lang.String messageType) throws ResourceException
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:
messageAction
- The action to take after the message is received. Valid values are:
messageType
- The type of message to return. Valid values are:
ResourceException
- If an error occurs.RQueuedMessage.MESSAGE_KEY
public void remove() throws ResourceException
ResourceException
- If an error occurs.public void remove(byte[] messageKey) throws ResourceException
messageKey
- The message key.ResourceException
- If an error occurs.public void remove(java.lang.String messageType) throws ResourceException
messageType
- The type of message to remove. Valid values are:
ResourceException
- If an error occurs.public void reply(byte[] messageKey, java.lang.String replyText) throws ResourceException
messageKey
- The message key.replyText
- The reply.ResourceException
- If an error occurs.public void reply(byte[] messageKey, java.lang.String replyText, boolean remove) throws ResourceException
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.ResourceException
- If an error occurs.public void sendInformational(java.lang.String messageID, java.lang.String messageFile) throws ResourceException
messageID
- The message ID.messageFile
- The integrated file system path name of the message file.ResourceException
- If an error occurs.public void sendInformational(java.lang.String messageID, java.lang.String messageFile, byte[] substitutionData) throws ResourceException
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.ResourceException
- If an error occurs.public void sendInformational(java.lang.String messageText) throws ResourceException
messageText
- The message text.ResourceException
- If an error occurs.public byte[] sendInquiry(java.lang.String messageID, java.lang.String messageFile, java.lang.String replyMessageQueue) throws ResourceException
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.ResourceException
- If an error occurs.public byte[] sendInquiry(java.lang.String messageID, java.lang.String messageFile, byte[] substitutionData, java.lang.String replyMessageQueue) throws ResourceException
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.ResourceException
- If an error occurs.public byte[] sendInquiry(java.lang.String messageText, java.lang.String replyMessageQueue) throws ResourceException
messageText
- The message text.replyMessageQueue
- The integrated file system path name of the reply message queue.ResourceException
- If an error occurs.public void setPath(java.lang.String path) throws java.beans.PropertyVetoException
CURRENT
. The path cannot be changed
if this object has already established a connection to 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.java.beans.PropertyVetoException
- If the change is vetoed.