|
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.MQeFields | +--com.ibm.mqe.MQeMsgObject
The basic message object within MQe, used to convey information from one application to another, via a sequence of queue managers.
Such objects are used to hold data, or to contain the necessary logic to obtain the data to send from one WebSphere MQ Everyplace system to another.
Subclasses of this class can be used to hold additional characteristics, data or code.
The data in messages can be built up using the "put" operations inherited from the
MQeFields
ancestor class, and retrieved using the corresponding "get"
operations.
Some field names have pre-defined meaning, behaviour, or architected use:
Special fields defined in a message | |
---|---|
MQe.Msg_CorrelID
| User-defined contents and meaning. Filters using this field will be quicker. |
MQe.Msg_ExpireTime
| Controls when and if the message expires, and is removed from the system. |
MQe.Msg_MsgID
| User-defined contents and meaning. Filters using this field will be quicker. |
MQe.Msg_OriginQMgr
| Indicates which queue manager was used to send the message. Read-only. This field is used to form part of the message unique id (UID). |
MQe.Msg_Priority
| Indicates whether the message should be transmitted before or after others with different priorities. |
MQe.Msg_ReplyToQ
| If you want a reply to your message, this field can be used to hold the queue to which the response message is put. |
MQe.Msg_ReplyToQMgr
| If you want a reply to your message, this field can be used to hold the queue manager name to which the response message is put. |
MQe.Msg_Resend
| If there is a possibility that you are re-sending this message after a faliure then you must set this field in order to avoid duplicate messages existing on the MQe network. |
MQe.Msg_Style
| Can be used to indicate what style of message this is to the application which processes
this message. MQe.Msg_Style_Datagram , MQe.Msg_Style_Reply
or MQe.Msg_Style_Request are defined values.
|
MQe.Msg_Time
| Indicates when the message was created. Read-only. This field is used to form part of the message unique id (UID). |
Field Summary |
Fields inherited from class com.ibm.mqe.MQeFields |
ArraySeparator, TypeArrayElements, TypeAscii, TypeBoolean, TypeByte, TypeDouble, TypeFields, TypeFloat, TypeInt, TypeLong, TypeShort, TypeUnicode, TypeUnTyped |
Constructor Summary | |
MQeMsgObject()
This constructs an empty message object. |
|
MQeMsgObject(byte[] data)
With a byte array. |
|
MQeMsgObject(MQeMsgObject msg)
With an MQeMsgObject. |
Method Summary | |
MQeFields |
getMsgUIDFields()
Extracts the unique identifier for the message. |
java.lang.String |
getOriginQMgr()
Extracts the name of the origination queue manager (if present). |
long |
getTimeStamp()
Extracts the time the message object was created. |
void |
putOriginQMgr(java.lang.String queueManager)
Sets the messages originating queue manager name. |
void |
resetMsgUIDFields()
Resets the message objects Unique id. |
MQeMsgObject |
unwrapMsgObject(MQeAttribute attribute)
Unwraps a wrappered message object. |
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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MQeMsgObject() throws java.lang.Exception
This constructs an empty message object.
java.lang.InterruptedException
- If the thread is interrupted
java.lang.Exception
try { MQeMsgObject msg = new MQeMsgObject(); } catch (Exception e) { System.err.println("Failure ! " + e.toString()); }
public MQeMsgObject(byte[] data) throws java.lang.Exception
With a byte array. This restores a fields object from the supplied byte array.
Note: The objects must be of the same type.
data
- A byte array containing a dumped fields object.
MQeException
- Except_Type, Except_Data, Except_NotFound
java.lang.Exception
- anything thrown by attribute.decodeData()public MQeMsgObject(MQeMsgObject msg) throws java.lang.Exception
With an MQeMsgObject. This wrappers the supplied message into a new message object. This is normally used to wrapper messages that have attributes attached that force the data to be held encoded.
msg
- An MQeMsgObject to be "copied".
MQeException
- Except_Data, Except_NotAllowed, Except_Not_Found
java.lang.Exception
- Anything thrown by attribute.encodeData()try { MQeMsgObject MQeMsg = new MQeMsgObject(msg); } catch (Exception e) { System.err.println("Failure ! " + e.toString()); }
Method Detail |
public MQeFields getMsgUIDFields() throws java.lang.Exception
Extracts the unique identifier for the message.
This method returns an MQeFields
object containing
the following field items:
MQeFields
object containing the fields used
to make the unique message identifier.
MQeException
- Except_NotAllowed, Except_Not_Found
java.lang.Exception
MQeFields uid = null; try { uid = msg.getMsgUIDFields(); } catch (Exception e) { System.err.println("Failure ! " + e.toString()); } return uid;
public java.lang.String getOriginQMgr()
Extracts the name of the origination queue manager (if present).
Returns a String containing the name of the originating queue manager or null if not set.
String QMgr = null; try { QMgr = msg.getOriginQMgr(); } catch (Exception e) { System.err.println("Failure ! " + e.toString()); } return QMgr;
public long getTimeStamp()
Extracts the time the message object was created.
Returns a long integer value containing the time in milliseconds when the object was created.
long TimeStamp = msg.getTimeStamp(); return TimeStamp;
public void putOriginQMgr(java.lang.String queueManager) throws java.lang.Exception
Sets the messages originating queue manager name.
Once this name has been set, it cannot be reset.
Note: Normally this method would only be called internally by the queue manager when a putMessage() call is issued.
queueManager
- A String containing the name of the queue manager.
MQeException
- Except_NotAllowed, Except_Not_Found
java.lang.Exception
public void resetMsgUIDFields() throws java.lang.Exception
Resets the message objects Unique id.
This method resets the message objects UID such that a new Msg_Time value is generated and the Msg_OriginQMgr is set to null . This in effect creates a new message object but retains any field items that were set.
java.lang.InterruptedException
- If the thread is interrupted
java.lang.Exception
try { msg.resetMsgUIDFields(); } catch (Exception e) { System.err.println("Failure ! " + e.toString()); }
public MQeMsgObject unwrapMsgObject(MQeAttribute attribute) throws java.lang.Exception
Unwraps a wrappered message object.
This method unwraps an embedded MQeMsgObject, decode using the supplied attribute (if appropriate), and returns the new message object.
attribute
- An MQeAttribute
object reference or
null, used to decode the embedded message object.
java.lang.ClassNotFoundException
MQeException
- Except_Type, Except_Data, Except_NotFound
java.lang.Exception
MQeMsgObject MsgUnwrap = null; try { MsgUnwrap = msg.unwrapMsgObject(attribute); } catch (Exception e) { System.err.println("Failure ! " + e.toString()); } return MsgUnwrap;
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |