|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mqe.MQe | +--com.ibm.mqe.MQeEnumeration
This class is used to hold a collection of WebSphere MQ Everyplace message objects. It allows the messages to be enumerated in an identical manner to the standard Java Enumeration class.
Implements java.util.Enumeration.
Field Summary |
Constructor Summary | |
MQeEnumeration(java.util.Enumeration enumeration)
Simple constructor. |
|
MQeEnumeration(java.util.Enumeration enumeration,
long lockID,
java.lang.String queueManager,
java.lang.String queue)
Constrctor to enumerate messages of the given QueueManager, Queue and the LockId of the browseWithLock. |
Method Summary | |
long |
getLockId()
Returns the lockID associated with this group of messages, if one exists. |
MQeMsgObject |
getNextMessage(MQeAttribute attribute,
long confirmID)
Deprecated. This method has been deprecated because of the ambiguity in its use. The functionality that this method provides is available through other API calls. The calls used will depend upon whether the enumeration was generated for justUIDs and whether a destructive read (message is removed from queue) or non destuctive read (message remains on queue) is required. - If the enumeration was generated as a result of a browse with the justUID flag set to false, then the nextElement method returns a copy of the message (non destructive read). If a destructive read is required, the message can be used as a filter to perform a getMessage or deleteMessage call. - If the enumeration was generated as a result of a browse with the justUID flag set to true, then the nextElement method returns an MQeFields instance which can be used to perform a destuructive getMessage or a non-destructive browseMessages. |
java.lang.String |
getQueueManagerName()
Returns the name of the queue manager that owns the queue from which the messages contained in the enumeration were browsed. |
java.lang.String |
getQueueName()
Returns the name of the queue from which the messages contained in the enumeration were browsed. |
Methods inherited from class com.ibm.mqe.MQe |
abbreviate, alias, asciiToByte, byteToAscii, byteToHex, byteToHex, byteToInt, byteToLong, byteToShort, byteToUnicode, fileSeparator, getEventLogHandler, hexToAscii, hexToByte, intToByte, isCLDC, loadClass, loadObject, log, setEventLogHandler, setLoader, sliceByteArray, type, unicodeToByte, uniqueValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Enumeration |
hasMoreElements, nextElement |
Constructor Detail |
public MQeEnumeration(java.util.Enumeration enumeration)
Simple constructor.
public MQeEnumeration(java.util.Enumeration enumeration, long lockID, java.lang.String queueManager, java.lang.String queue)
Constrctor to enumerate messages of the given QueueManager, Queue and the LockId of the browseWithLock.
enumeration
- The enumeration of messages of message UID'slockID
- The lock ID of a browseWithLock was usedqueueManager
- The name of the target queue managerqueue
- The name of the target queueMethod Detail |
public long getLockId()
Returns the lockID associated with this group of messages, if one exists.
If a there is a lockID associated with the group of messages contained in this enumeration, it is returned by this method. The lockID is only set if this enumeration is the result of a browseMessagesAndLock operation.
Otherwise this method returns a dummy value of "-1".
// Lock all msgs on this queue long lockId = 0; MQeEnumeration msgEnum = null; try { MQeQueueManager QMgr = new MQeQueueManager(); msgEnum = QMgr.browseMessagesAndLock(null, "MyQueue", null, null, 0, false); } catch (Exception e) { System.err.println("Failure ! " + e.toString()); } lockId = msgEnum.getLockId(); // get the Lock Id return lockId;
public java.lang.String getQueueManagerName()
Returns the name of the queue manager that owns the queue from which the messages contained in the enumeration were browsed.
getQueueName()
MQeEnumeration msgEnum = null; MQeMsgObject msg = null; String QMgrName = " "; try { MQeQueueManager QMgr = new MQeQueueManager(); msgEnum = QMgr.browseMessages("RemoteQMgr", "RemoteQueue", null, null, false); while (msgEnum.hasMoreElements()) { // get message msg = (MQeMsgObject) msgEnum.nextElement(); //msg =msgEnum.getNextMessage(null,MQe.uniqueValue()); // confirm get QMgr.confirmGetMessage(msgEnum.getQueueManagerName(), msgEnum.getQueueName(), msg.getMsgUIDFields()); QMgrName = msgEnum.getQueueManagerName(); } } catch (Exception e) { System.err.println("Failure ! " + e.toString()); } return QMgrName;
public java.lang.String getQueueName()
Returns the name of the queue from which the messages contained in the enumeration were browsed.
getQueueManagerName()
MQeEnumeration msgEnum = null; MQeMsgObject msg = null; String QName = " "; try { MQeQueueManager QMgr = new MQeQueueManager(); msgEnum = QMgr.browseMessages("RemoteQMgr", "RemoteQueue", null, null, false); while (msgEnum.hasMoreElements()) { // get message msg = (MQeMsgObject) msgEnum.nextElement(); //msg =msgEnum.getNextMessage(null,MQe.uniqueValue()); // confirm get QMgr.confirmGetMessage(msgEnum.getQueueManagerName(), msgEnum.getQueueName(), msg.getMsgUIDFields()); QName = msgEnum.getQueueName(); } } catch (Exception e) { System.err.println("Failure ! " + e.toString()); } return QName;
public MQeMsgObject getNextMessage(MQeAttribute attribute, long confirmID) throws java.lang.Exception
Returns the next message in the enumeration.
attribute
- An MQeAttribute object used to decode the message
if it was encoded.confirmID
- A confirmId to use if the getMessage is to be issued
specifying a confirmID.
Note:This method will issue a getMessage to the target system i.e. retrieve the the message if this enumeration was the result of browse that requested just UID's. In other words the behaviour is defferent depending on how the browse request was issued.
MQeException
- Except_NotSupported
java.lang.Exception
MQeEnumeration msgEnum = null; MQeMsgObject msg = null; try { MQeQueueManager QMgr = new MQeQueueManager(); msgEnum = QMgr.browseMessages("RemoteQMgr", "RemoteQueue", null, null, false); while (msgEnum.hasMoreElements()) { // get message msg = (MQeMsgObject) msgEnum.nextElement(); //msg =msgEnum.getNextMessage(null,MQe.uniqueValue()); // confirm get QMgr.confirmGetMessage(msgEnum.getQueueManagerName(), msgEnum.getQueueName(), msg.getMsgUIDFields()); } } catch (Exception e) { System.err.println("Failure ! " + e.toString()); } return msg;
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |