Websphere MQ Everyplace

com.ibm.mqe
Class MQeMsgObject

java.lang.Object
  |
  +--com.ibm.mqe.MQe
        |
        +--com.ibm.mqe.MQeFields
              |
              +--com.ibm.mqe.MQeMsgObject
All Implemented Interfaces:
MQeExceptionCodes
Direct Known Subclasses:
MQeAdminMsg, MQeMbMsgObject, MQeMQMsgObject, MQeMultiMsgObject

public class MQeMsgObject
extends MQeFields

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
 
Fields inherited from class com.ibm.mqe.MQe
Admin_Queue_Name, Admin_Reply_Queue_Name, copyright, DeadLetter_Queue_Name, Event_Activate, Event_Attribute, Event_Authenticate, Event_Close, Event_Logoff, Event_Logon, Event_MiniCert_Validate, Event_Queue, Event_QueueManager, Event_UserBase, JMS_Version, MQ_Headers, MQe_Log_Audit_Failure, MQe_Log_Audit_Success, MQe_Log_Error, MQe_Log_Information, MQe_Log_Success, MQe_Log_Warning, Msg_BackoutCount, Msg_CorrelID, Msg_ExpireTime, Msg_LockID, Msg_MsgID, Msg_OriginQMgr, Msg_Priority, Msg_ReplyToQ, Msg_ReplyToQMgr, Msg_Resend, Msg_Style, Msg_Style_Datagram, Msg_Style_Reply, Msg_Style_Request, Msg_Time, Msg_WrapMsg, sccsid, System_Default_Queue_Name, version
 
Fields inherited from interface com.ibm.mqe.MQeExceptionCodes
Except_Active, Except_AdapterException, Except_AdapterMissingRemoteAddress, Except_Admin_ActionNotSupported, Except_Admin_InvalidField, Except_Admin_NotAdminMsg, Except_AdminAction, Except_Authenticate, Except_BadRequest, Except_BridgeListener, Except_Chnl_Attributes, Except_Chnl_ID, Except_Chnl_Limit, Except_Chnl_Overrun, Except_Closed, Except_Con_AdapterRequired, Except_Con_AliasAlreadyExists, Except_Con_AlreadyExists, Except_Con_InvalidName, Except_Connect_Failure, Except_ConnectonType, Except_Cryptor, Except_Data, Except_Duplicate, Except_JmxProperties, Except_Listener, Except_MessageStore, Except_MiniCertReg_ActivateFailed, Except_MiniCertReg_BadPIN, Except_MiniCertReg_NotOpen, Except_NotActive, Except_NotAllowed, Except_NotFound, Except_NotSupported, Except_PrivateReg_ActivateFailed, Except_PrivateReg_BadPIN, Except_PrivateReg_NotOpen, Except_PublicReg_ActivateFailed, Except_PublicReg_InvalidAddress, Except_PublicReg_InvalidRequest, Except_Q_Full, Except_Q_InvalidName, Except_Q_InvalidPriority, Except_Q_MsgTooLarge, Except_Q_NoMatchingMsg, Except_Q_TargetRegistryRequired, Except_QMgr_Activated, Except_QMgr_AlreadyExists, Except_QMgr_InvalidQMgrName, Except_QMgr_InvalidQName, Except_QMgr_NotActive, Except_QMgr_NotBridgeEnabled, Except_QMgr_NotConfigured, Except_QMgr_QDoesNotExist, Except_QMgr_QExists, Except_QMgr_QNotEmpty, Except_QMgr_RegistryDataVersion, Except_QMgr_UnknownQMgr, Except_QMgr_WrongQType, Except_Reg_AddFailed, Except_Reg_AlreadyExists, Except_Reg_AlreadyOpen, Except_Reg_CRTKeyDecFailed, Except_Reg_CRTKeySignFailed, Except_Reg_DeleteFailed, Except_Reg_DeleteRegistryFailed, Except_Reg_DoesNotExist, Except_Reg_InvalidSession, Except_Reg_ListFailed, Except_Reg_NotDefined, Except_Reg_NotSecure, Except_Reg_NullName, Except_Reg_OpenFailed, Except_Reg_ReadFailed, Except_Reg_RenameFailed, Except_Reg_ResetPINFailed, Except_Reg_SearchFailed, Except_Reg_UpdateFailed, Except_RemoteException, Except_Rule, Except_S_BadIntegrity, Except_S_BadSubject, Except_S_CertificateExpired, Except_S_Cipher, Except_S_InvalidAttribute, Except_S_InvalidSignature, Except_S_MiniCertNotAvailable, Except_S_MissingSection, Except_S_NoPresetKeyAvailable, Except_S_RegistryNotAvailable, Except_Stopped, Except_Syntax, Except_TimeOut, Except_Transporter, Except_TriggerTransmission, Except_Trnsport_QMgr, Except_Trnsport_Request, Except_Type, Except_UdpipAdapterStateException, Except_UdpipAdapterTimeOut, Except_UdpipAdapterUnableToConfirmSuccess, Except_UnCoded, Except_Uncontactable_DontTransmit
 
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.MQeFields
contains, copy, copy, dataType, deepCopy, delete, dump, dumpedType, dumpToString, equals, fields, getArrayLength, getArrayOfByte, getArrayOfDoubleAsLong, getArrayOfFloatAsInt, getArrayOfInt, getArrayOfLong, getArrayOfShort, getAscii, getAsciiArray, getAttribute, getBoolean, getByte, getDoubleAsLong, getFields, getFieldsArray, getFloatAsInt, getInt, getIntArray, getLong, getLongArray, getObject, getShort, getShortArray, getUnicode, getUnicodeArray, includes, isEqualTo, putArrayLength, putArrayOfByte, putArrayOfDoubleAsLong, putArrayOfFloatAsInt, putArrayOfInt, putArrayOfLong, putArrayOfShort, putAscii, putAsciiArray, putBoolean, putByte, putByteArray, putDoubleAsLong, putFields, putFieldsArray, putFloatAsInt, putInt, putIntArray, putLong, putLongArray, putObject, putShort, putShortArray, putUnicode, putUnicodeArray, rename, restore, restoreFromString, restoreFromString, restoreFromString, setAttribute, updateValue
 
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

MQeMsgObject

public MQeMsgObject()
             throws java.lang.Exception

This constructs an empty message object.

Throws:
java.lang.InterruptedException - If the thread is interrupted
java.lang.Exception
Example:
 try {
     MQeMsgObject msg = new MQeMsgObject();
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 

MQeMsgObject

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.

Parameters:
data - A byte array containing a dumped fields object.
Throws:
MQeException - Except_Type, Except_Data, Except_NotFound
java.lang.Exception - anything thrown by attribute.decodeData()

MQeMsgObject

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.

Parameters:
msg - An MQeMsgObject to be "copied".
Throws:
MQeException - Except_Data, Except_NotAllowed, Except_Not_Found
java.lang.Exception - Anything thrown by attribute.encodeData()
Example:
 try {
     MQeMsgObject MQeMsg = new MQeMsgObject(msg);
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 
Method Detail

getMsgUIDFields

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:

The returned fields object can be used as a match parameter in an equality test or in a browse or get message call.

Returns:
An MQeFields object containing the fields used to make the unique message identifier.
Throws:
MQeException - Except_NotAllowed, Except_Not_Found
java.lang.Exception
Example:
 MQeFields uid = null;
 
 try {
     uid = msg.getMsgUIDFields();
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return uid;
 
 
 

getOriginQMgr

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.

Returns:
A String or null.
Example:
 String QMgr = null;
 
 try {
     QMgr = msg.getOriginQMgr();
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return QMgr;
 
 

getTimeStamp

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.

Returns:
A long value in milliseconds.
Example:
 long TimeStamp = msg.getTimeStamp();
 
 return TimeStamp;
 
 

putOriginQMgr

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.

Parameters:
queueManager - A String containing the name of the queue manager.
Returns:
void
Throws:
MQeException - Except_NotAllowed, Except_Not_Found
java.lang.Exception

resetMsgUIDFields

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.

Returns:
void
Throws:
java.lang.InterruptedException - If the thread is interrupted
java.lang.Exception
Example:
 try {
     msg.resetMsgUIDFields();
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 

unwrapMsgObject

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.

Parameters:
attribute - An MQeAttribute object reference or null, used to decode the embedded message object.
Returns:
Unwrapped MQeMsgObject
Throws:
java.lang.ClassNotFoundException
MQeException - Except_Type, Except_Data, Except_NotFound
java.lang.Exception
Example:
 MQeMsgObject MsgUnwrap = null;
 
 try {
     MsgUnwrap = msg.unwrapMsgObject(attribute);
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return  MsgUnwrap;
 
 

Websphere MQ Everyplace