Websphere MQ Everyplace

com.ibm.mqe.mqemqmessage
Class MQePubSubMsgObject

java.lang.Object
  |
  +--com.ibm.mqe.MQe
        |
        +--com.ibm.mqe.MQeFields
              |
              +--com.ibm.mqe.MQeMsgObject
                    |
                    +--com.ibm.mqe.mqemqmessage.MQeMQMsgObject
                          |
                          +--com.ibm.mqe.mqemqmessage.MQePubSubMsgObject
All Implemented Interfaces:
MQeExceptionCodes

public class MQePubSubMsgObject
extends MQeMQMsgObject

This class represents a WebSphere Business Integrator (WBI) style message. It is designed for use with messages which flow between WBI and WMQe applications and use the WBI message format, i.e. 'system information' is stored in fields in a header section and the user data is stored in a byte array.

MQePubSubMsgObjects are transformed by the WMQe/WMQ bridge support into suitably formatted WMQ messages that can be sent to the WBI broker. Messages flowing in the other direction are also supported by the bridge.

This class is intended as a replacement for com.ibm.broker.mqimqe.MQeMbMsgObject, originally shipped with WBI as part of the WMQe node support but then later added to MQe. This class has the same functionality, almost the same signature, but is a sub-class of com.ibm.mqe.mqemqmessage.MQeMQMsgObject.


Field Summary
static java.lang.String copyright
           
static int DEF_CHARACTER_SET
          The default value used for the MQeMQMsgObject.FIELD_NAME_MQ_CHARACTER_SET field if it has not been specified explicitly in the message.
static int DEF_COMPLETION_CODE
          The default value used for the FIELD_NAME_COMPLETION_CODE field if it is not set in the message.
static boolean DEF_RETENTION
          The default value used for the #FIELD_NAME_RETENTION field if it is not set in the message.
static int DEF_TYPE
          The default value used for the FIELD_NAME_TYPE_OF_MSG field if it is not set in the message.
static java.lang.String FIELD_NAME_COMPLETION_CODE
          The name of the optional integer field which holds the WBI completion code.
static java.lang.String FIELD_NAME_MESSAGE
          The name of the optional field for any data to be published.
static java.lang.String FIELD_NAME_MQ_DEST_QUEUE_MGR
          The name of the optional ASCII String field which holds the destination queue manager name associated with a subscription.
static java.lang.String FIELD_NAME_MQ_DEST_QUEUE_NAME
          The name of the optional ASCII String field which holds the destination queue name associated with a subscription.
static java.lang.String FIELD_NAME_RESPONSES
          The name of the optional Unicode array field which holds any WBI response information.
static java.lang.String FIELD_NAME_RETAINED
          The name of the optional field for any retention information associated with a publication.
static java.lang.String FIELD_NAME_TOPIC
          The name of the optional field for any topic information.
static java.lang.String FIELD_NAME_TYPE_OF_MSG
          The name of the optional integer field which holds the purpose of the message, i.e.
static int RESULT_ERROR
          A value for the optional FIELD_NAME_COMPLETION_CODE field, indicating that the operation failed.
static int RESULT_OK
          A value for the optional FIELD_NAME_COMPLETION_CODE field, indicating that the operation was successful.
static int RESULT_UNKNOWN
          A value for the optional FIELD_NAME_COMPLETION_CODE field, indicating that no information was available on the success of the operation.
static int RESULT_WARNING
          A value for the optional FIELD_NAME_COMPLETION_CODE field, indicating that the operation generated warnings.
static int TYPE_MQE
          A value for the optional FIELD_NAME_TYPE_OF_MSG field, indicating that the purpose of the message is to drive a WMQ application through the subsequent creation of a WMQ message with a defined MQMD and with a specified payload.
static int TYPE_PUB
          A value for the optional FIELD_NAME_TYPE_OF_MSG field, indicating that the purpose of the message is to send a publication to the broker.
static int TYPE_SUB
          A value for the optional FIELD_NAME_TYPE_OF_MSG field, indicating that the purpose of the message is to send a subscription to the broker.
static int TYPE_UNSUB
          A value for the optional FIELD_NAME_TYPE_OF_MSG field, indicating that the purpose of the message is to send an un-subscription to the broker.
 
Fields inherited from class com.ibm.mqe.mqemqmessage.MQeMQMsgObject
DEF_ACCOUNTING_TOKEN, DEF_APPLICATION_ID_DATA, DEF_APPLICATION_ORIGIN_DATA, DEF_BACKOUT_COUNT, DEF_CORRELATION_ID, DEF_ENCODING, DEF_EXPIRY, DEF_FEEDBACK, DEF_FORMAT, DEF_GROUP_ID, DEF_MESSAGE_FLAGS, DEF_MESSAGE_ID, DEF_MESSAGE_TYPE, DEF_OFFSET, DEF_ORIGINAL_LENGTH, DEF_PERSISTENCE, DEF_PRIORITY, DEF_PUT_APPLICATION_NAME, DEF_PUT_APPLICATION_TYPE, DEF_REPLY_TO_QUEUE_MANAGER_NAME, DEF_REPLY_TO_QUEUE_NAME, DEF_REPORT, DEF_SEQUENCE_NUMBER, DEF_USER_ID, FIELD_NAME_MQ_ACCOUNTING_TOKEN, FIELD_NAME_MQ_APP_ID_DATA, FIELD_NAME_MQ_APP_ORIG_DATA, FIELD_NAME_MQ_BACKOUT_COUNT, FIELD_NAME_MQ_CHARACTER_SET, FIELD_NAME_MQ_DATA, FIELD_NAME_MQ_ENCODING, FIELD_NAME_MQ_FEEDBACK, FIELD_NAME_MQ_FORMAT, FIELD_NAME_MQ_GROUP_ID, FIELD_NAME_MQ_MSG_FLAGS, FIELD_NAME_MQ_MSG_SEQUENCE_NUM, FIELD_NAME_MQ_OFFSET, FIELD_NAME_MQ_ORIGINAL_LENGTH, FIELD_NAME_MQ_PERSISTENCE, FIELD_NAME_MQ_PUT_APP_NAME, FIELD_NAME_MQ_PUT_APP_TYPE, FIELD_NAME_MQ_PUT_DATE_TIME, FIELD_NAME_MQ_REPORT, FIELD_NAME_MQ_USER_ID
 
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, 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
MQePubSubMsgObject()
          This creates a new MQePubSubMsgObject.
MQePubSubMsgObject(MQeMsgObject msg)
          This creates a new MQePubSubMsgObject, wrapping a supplied message into the new object and setting the properties from the supplied message.
 
Method Summary
 java.lang.String dumpAllToString()
          Dump all the fields in the message object into a String.
 int getActionType()
          Gets the message action type (publish, subscribe, etc).
 int getCompletionCode()
          Gets the completion code for an operation performed by the WBI broker.
 java.lang.String getDestQueueMgr()
          Gets the destination queue manager name.
 java.lang.String getDestQueueName()
          Gets the destination queue name.
 java.lang.String getFormat()
          Gets the format value from the message header (MQMD or RFH2 depending upon the nature of the message).
 byte[] getMessage()
          Gets the message associated with a publication, as a String value.
 byte[] getMessageData()
          Gets the message associated with a publication, as a byte[] value.
 java.lang.String[] getResponses()
          Gets the responses for an operation performed by the WBI broker.
 boolean getRetention()
          Gets the retention parameter associated with a publication message.
 java.lang.String[] getTopics()
          Gets the topics associated with the message.
 void publish(java.lang.String topic, boolean retained, byte[] messageBytes)
          Sets the parameters appropriate to a message publication.
 void publish(java.lang.String topic, boolean retained, java.lang.String message)
          Sets the parameters appropriate to a message publication.
 void setData(byte[] data)
          Sets the message data.
 void setFormat(java.lang.String format)
          Sets the format value in the message header (MQMD or RFH2 depending upon the nature of the message).
 void subscribe(java.lang.String[] topics, java.lang.String destQMgrName, java.lang.String destQueueName)
          Sets the parameters appropriate to a subscription.
 void unSubscribe(java.lang.String[] topics, java.lang.String destQMgrName, java.lang.String destQueueName)
          Sets the parameters appropriate to an unsubscription.
 
Methods inherited from class com.ibm.mqe.mqemqmessage.MQeMQMsgObject
dumpToString, equals, getAccountingToken, getApplicationIdData, getApplicationOriginData, getBackoutCount, getCharacterSet, getCorrelationId, getData, getEncoding, getExpiry, getFeedback, getGroupId, getMessageFlags, getMessageId, getMessageSequenceNumber, getMessageType, getOffset, getOriginalLength, getPersistence, getPriority, getPutApplicationName, getPutApplicationType, getPutDateTime, getReplyToQueueManagerName, getReplyToQueueName, getReport, getUserId, setAccountingToken, setApplicationIdData, setApplicationOriginData, setBackoutCount, setCharacterSet, setCorrelationId, setEncoding, setExpiry, setFeedback, setGroupId, setMessageFlags, setMessageId, setMessageSequenceNumber, setMessageType, setOffset, setOriginalLength, setPersistence, setPriority, setPutApplicationName, setPutApplicationType, setPutDateTime, setReplyToQueueManagerName, setReplyToQueueName, setReport, setUserId
 
Methods inherited from class com.ibm.mqe.MQeMsgObject
getMsgUIDFields, getOriginQMgr, getTimeStamp, putOriginQMgr, resetMsgUIDFields, unwrapMsgObject
 
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
 

Field Detail

copyright

public static final java.lang.String copyright
See Also:
Constant Field Values

FIELD_NAME_TYPE_OF_MSG

public static final java.lang.String FIELD_NAME_TYPE_OF_MSG
The name of the optional integer field which holds the purpose of the message, i.e. one of: TYPE_MQE, TYPE_PUB, TYPE_SUB or TYPE_UNSUB.

See Also:
Constant Field Values

FIELD_NAME_TOPIC

public static final java.lang.String FIELD_NAME_TOPIC
The name of the optional field for any topic information.

Specifically, for messages with a value of TYPE_SUB or TYPE_UNSUB for the field FIELD_NAME_TYPE_OF_MSG, an ASCII String array of the topics; for messages with a value of of TYPE_PUB, an <>ASCII String<> value for the associated topic. for the topic.

See Also:
Constant Field Values

FIELD_NAME_MESSAGE

public static final java.lang.String FIELD_NAME_MESSAGE
The name of the optional field for any data to be published.

Specifically, for messages with a value of TYPE_PUB for the field FIELD_NAME_TYPE_OF_MSG, the message contents in an array of bytes format. Note that message contents are not present in responses from the broker.

See Also:
Constant Field Values

FIELD_NAME_RETAINED

public static final java.lang.String FIELD_NAME_RETAINED
The name of the optional field for any retention information associated with a publication.

Specifically, for messages with a value of TYPE_PUB for the field FIELD_NAME_TYPE_OF_MSG, the retention information as a boolean value.

See Also:
Constant Field Values

TYPE_MQE

public static final int TYPE_MQE
A value for the optional FIELD_NAME_TYPE_OF_MSG field, indicating that the purpose of the message is to drive a WMQ application through the subsequent creation of a WMQ message with a defined MQMD and with a specified payload.

See Also:
Constant Field Values

TYPE_PUB

public static final int TYPE_PUB
A value for the optional FIELD_NAME_TYPE_OF_MSG field, indicating that the purpose of the message is to send a publication to the broker.

See Also:
Constant Field Values

TYPE_SUB

public static final int TYPE_SUB
A value for the optional FIELD_NAME_TYPE_OF_MSG field, indicating that the purpose of the message is to send a subscription to the broker.

See Also:
Constant Field Values

TYPE_UNSUB

public static final int TYPE_UNSUB
A value for the optional FIELD_NAME_TYPE_OF_MSG field, indicating that the purpose of the message is to send an un-subscription to the broker.

See Also:
Constant Field Values

FIELD_NAME_MQ_DEST_QUEUE_NAME

public static final java.lang.String FIELD_NAME_MQ_DEST_QUEUE_NAME
The name of the optional ASCII String field which holds the destination queue name associated with a subscription.

See Also:
Constant Field Values

FIELD_NAME_MQ_DEST_QUEUE_MGR

public static final java.lang.String FIELD_NAME_MQ_DEST_QUEUE_MGR
The name of the optional ASCII String field which holds the destination queue manager name associated with a subscription.

See Also:
Constant Field Values

FIELD_NAME_COMPLETION_CODE

public static final java.lang.String FIELD_NAME_COMPLETION_CODE
The name of the optional integer field which holds the WBI completion code. This field is present in messages generated by the MQeJMSRFHTransformer as a consequence of receiving a response from the broker.

See Also:
Constant Field Values

FIELD_NAME_RESPONSES

public static final java.lang.String FIELD_NAME_RESPONSES
The name of the optional Unicode array field which holds any WBI response information. This field is present in messages generated by the MQeJMSRFHTransformer as a consequence of receiving a response from the broker.

Each element of the array represents a response in the format "parameter1: value1; parameter2: value2; ...". If there are no responses available a zero length array is returned.

See Also:
Constant Field Values

DEF_CHARACTER_SET

public static final int DEF_CHARACTER_SET
The default value used for the MQeMQMsgObject.FIELD_NAME_MQ_CHARACTER_SET field if it has not been specified explicitly in the message.

Indicates a UTF-8 character set (the WBI default).

See Also:
Constant Field Values

RESULT_UNKNOWN

public static final int RESULT_UNKNOWN
A value for the optional FIELD_NAME_COMPLETION_CODE field, indicating that no information was available on the success of the operation.

See Also:
Constant Field Values

RESULT_OK

public static final int RESULT_OK
A value for the optional FIELD_NAME_COMPLETION_CODE field, indicating that the operation was successful.

See Also:
Constant Field Values

RESULT_WARNING

public static final int RESULT_WARNING
A value for the optional FIELD_NAME_COMPLETION_CODE field, indicating that the operation generated warnings. For more information use the method getResponses().

See Also:
Constant Field Values

RESULT_ERROR

public static final int RESULT_ERROR
A value for the optional FIELD_NAME_COMPLETION_CODE field, indicating that the operation failed. For more information use the method getResponses().

See Also:
Constant Field Values

DEF_TYPE

public static final int DEF_TYPE
The default value used for the FIELD_NAME_TYPE_OF_MSG field if it is not set in the message.

The default is TYPE_MQE.

See Also:
Constant Field Values

DEF_COMPLETION_CODE

public static final int DEF_COMPLETION_CODE
The default value used for the FIELD_NAME_COMPLETION_CODE field if it is not set in the message.

The default is RESULT_UNKNOWN.

See Also:
Constant Field Values

DEF_RETENTION

public static final boolean DEF_RETENTION
The default value used for the #FIELD_NAME_RETENTION field if it is not set in the message.

The default is false.

See Also:
Constant Field Values
Constructor Detail

MQePubSubMsgObject

public MQePubSubMsgObject()
                   throws java.lang.Exception
This creates a new MQePubSubMsgObject.

Throws:
java.lang.Exception - Propagated from the super-class constructor, MQeMsgObject.

MQePubSubMsgObject

public MQePubSubMsgObject(MQeMsgObject msg)
                   throws java.lang.Exception

This creates a new MQePubSubMsgObject, wrapping a supplied message into the new object and setting the properties from the supplied message.

Parameters:
msg - The message object to be wrapped.
Throws:
java.lang.Exception - Propagated from the super-class constructor, MQeMsgObject.
Method Detail

dumpAllToString

public java.lang.String dumpAllToString()
Dump all the fields in the message object into a String.

Overrides:
dumpAllToString in class MQeMQMsgObject
Returns:
A readable String representation of the data content.

getActionType

public int getActionType()
                  throws java.lang.Exception
Gets the message action type (publish, subscribe, etc).

Returns:
The message action type, returned as an appropriate constant from this class, i.e TYPE_PUB, etc.
Throws:
java.lang.Exception - if there is an error getting the value in the message object.

getTopics

public java.lang.String[] getTopics()
                             throws java.lang.Exception
Gets the topics associated with the message. This is applicable only to subscription, unsubscription and publish messages.

Returns:
The topics associated with the message. If no topics are associated with the message then null is returned.
Throws:
java.lang.Exception - if there is an error getting the values in the message object.

getFormat

public java.lang.String getFormat()
                           throws java.lang.Exception

Gets the format value from the message header (MQMD or RFH2 depending upon the nature of the message).

This method gets the value of the Format header field in the Websphere MQ style message. If the message is configured to publish, subscribe or unsubscribe, then the field is taken from the RFH2 header; in all other cases the field is taken from the MQMD. Values are expected to be suitable constants in the com.ibm.mq.MQC class.

Overrides:
getFormat in class MQeMQMsgObject
Returns:
A String containing the format value.
Throws:
java.lang.Exception - If there is an error reading the value from the message object.

getMessage

public byte[] getMessage()
                  throws java.lang.Exception
Gets the message associated with a publication, as a String value.

Returns:
The message data. If the message action type is not for a publication, then the value new byte[0] is returned.
Throws:
java.lang.Exception - if there is an error getting the values in the message object.

getMessageData

public byte[] getMessageData()
                      throws java.lang.Exception
Gets the message associated with a publication, as a byte[] value.

Returns:
The message. If the message action type is not for a publication, then the value null is returned.
Throws:
java.lang.Exception - if there is an error getting the values in the message object.

getDestQueueMgr

public java.lang.String getDestQueueMgr()
                                 throws java.lang.Exception
Gets the destination queue manager name. This is only appropriate if the message is set for a subscription or an unsubscription, i.e. if either the subscribe(String[], String, String) or unSubscribe(String[], String, String) methods have been called.

Returns:
The destination queue manager name if available, otherwise null.
Throws:
java.lang.Exception - if there is an error getting the value in the message object.

getDestQueueName

public java.lang.String getDestQueueName()
                                  throws java.lang.Exception
Gets the destination queue name. This is only appropriate if the message is set for a subscription or an unsubscription, i.e. if either the subscribe(String[], String, String) or the unSubscribe(String[], String, String) methods have been called.

Returns:
The destination queue name if available, otherwise null.
Throws:
java.lang.Exception - if there is an error getting the value in the message object.

getCompletionCode

public int getCompletionCode()
                      throws java.lang.Exception
Gets the completion code for an operation performed by the WBI broker.

Returns:
The completion code if present, otherwise the value DEF_COMPLETION_CODE. Completion codes are specified by appropriate constants in this class.
Throws:
java.lang.Exception - if there is an error getting the value in the message object.

setFormat

public void setFormat(java.lang.String format)
               throws java.lang.Exception

Sets the format value in the message header (MQMD or RFH2 depending upon the nature of the message).

This method sets the value of the Format header field in the Websphere MQ style message. If the message is configured to publish, subscribe or unsubscribe, then the field is set in the RFH2 header, with the format in the MQMD being forced to com.ibm.mq.MQC.MQFMT_HEADER_2; in all other cases the field is set in the MQMD. The default value is MQC.MQFMT_NONE.

Overrides:
setFormat in class MQeMQMsgObject
Parameters:
format - The value to be set in the format field; values must be taken from suitable constants in the com.ibm.mq.MQC class, e.g. MQC.MQFMT_NONE.
Returns:
void
Throws:
java.lang.Exception - If there is an error setting the value in the message object.

getResponses

public java.lang.String[] getResponses()
                                throws java.lang.Exception
Gets the responses for an operation performed by the WBI broker.

Returns:
The responses, where each element of the array represents a response in the format "parameter1: value1; parameter2: value2; ...". If there are no responses available a zero length array is returned.
Throws:
java.lang.Exception - if there is an error getting the value in the message object.

getRetention

public boolean getRetention()
                     throws java.lang.Exception
Gets the retention parameter associated with a publication message.

Returns:
The retention parameter. If the message is not a publication message then the value false is returned.
Throws:
java.lang.Exception - if there is an error getting the values in the message object.

subscribe

public void subscribe(java.lang.String[] topics,
                      java.lang.String destQMgrName,
                      java.lang.String destQueueName)
               throws java.lang.Exception
Sets the parameters appropriate to a subscription. This negates the effects of any prior publish(String, boolean, String), #publish(String, boolean), unSubscribe(String[], String, String), or setData(byte[]) calls which might have been issued.

Parameters:
topics - The topics to be subscribed to.
destQMgrName - This is the name of the queue manager to received the relevant published messages.
destQueueName - This is the name of the queue on the destination queue manager to received the relevant published messages.
Throws:
java.lang.Exception - if there is an error setting the values in the message object.

unSubscribe

public void unSubscribe(java.lang.String[] topics,
                        java.lang.String destQMgrName,
                        java.lang.String destQueueName)
                 throws java.lang.Exception
Sets the parameters appropriate to an unsubscription. This negates the effects of any prior publish(String, boolean, String), #publish(String, boolean), setData(byte[]), or subscribe(String[], String, String) calls which might have been issued.

Parameters:
topics - The topics to be unsubscribed from.
destQMgrName - This is the name of the queue manager to no longer receive the relevant published messages.
destQueueName - This is the name of the queue on the destination queue manager to no longer receive the relevant published messages.
Throws:
java.lang.Exception - if there is an error setting the values in the message object.

publish

public void publish(java.lang.String topic,
                    boolean retained,
                    byte[] messageBytes)
             throws java.lang.Exception
Sets the parameters appropriate to a message publication. This negates the effects of any prior setData(byte[]), unSubscribe(String[], String, String), or subscribe(String[], String, String) calls which might have been issued.

Parameters:
topic - The topic under which the message should be published.
retained - The message retention. This contains a boolean value; if this is set to true, the publication is retained and therefore unsubscribed clients subscribing will receive the last published value for the given topic. If set to false unsubscribed clients subscribing will not receive the last published value for the given topic.
messageBytes - The data to be published.
Throws:
java.lang.Exception - if there is an error setting the values in the message object.

publish

public void publish(java.lang.String topic,
                    boolean retained,
                    java.lang.String message)
             throws java.lang.Exception
Sets the parameters appropriate to a message publication. This negates the effects of any prior setData(byte[]), unSubscribe(String[], String, String), or subscribe(String[], String, String) calls which might have been issued.

Parameters:
topic - The topic under which the message should be published.
retained - The message retention. This contains a boolean value; if this is set to true, the publication is retained and therefore unsubscribed clients subscribing will receive the last published value for the given topic. If set to false unsubscribed clients subscribing will not receive the last published value for the given topic.
message - The message to be published.
Throws:
java.lang.Exception - if there is an error setting the values in the message object.

setData

public void setData(byte[] data)
             throws java.lang.Exception
Sets the message data. This negates the effects of any prior publish(String, boolean, String), #publish(String, boolean), unSubscribe(String[], String, String), or subscribe(String[], String, String) calls which might have been issued.

Overrides:
setData in class MQeMQMsgObject
Parameters:
data - A byte array containing the message data.
Returns:
void
Throws:
java.lang.Exception - if there is an error setting the value in the message object.

Websphere MQ Everyplace