|
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 | +--com.ibm.mqe.mqemqmessage.MQeMQMsgObject | +--com.ibm.mqe.mqemqmessage.MQePubSubMsgObject
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.MQeFields |
ArraySeparator, TypeArrayElements, TypeAscii, TypeBoolean, TypeByte, TypeDouble, TypeFields, TypeFloat, TypeInt, TypeLong, TypeShort, TypeUnicode, TypeUnTyped |
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.MQeMsgObject |
getMsgUIDFields, getOriginQMgr, getTimeStamp, putOriginQMgr, resetMsgUIDFields, unwrapMsgObject |
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 |
public static final java.lang.String copyright
public static final java.lang.String FIELD_NAME_TYPE_OF_MSG
integer
field which holds the
purpose of the message, i.e. one of: TYPE_MQE
, TYPE_PUB
,
TYPE_SUB
or TYPE_UNSUB
.
public static final java.lang.String FIELD_NAME_TOPIC
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.
public static final java.lang.String FIELD_NAME_MESSAGE
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.
public static final java.lang.String FIELD_NAME_RETAINED
Specifically, for messages with a value of TYPE_PUB
for the field
FIELD_NAME_TYPE_OF_MSG
, the retention information as a boolean
value.
public static final int TYPE_MQE
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.
public static final int TYPE_PUB
FIELD_NAME_TYPE_OF_MSG
field, indicating that the
purpose of the message is to send a publication to the broker.
public static final int TYPE_SUB
FIELD_NAME_TYPE_OF_MSG
field, indicating that the
purpose of the message is to send a subscription to the broker.
public static final int TYPE_UNSUB
FIELD_NAME_TYPE_OF_MSG
field, indicating that the
purpose of the message is to send an un-subscription to the broker.
public static final java.lang.String FIELD_NAME_MQ_DEST_QUEUE_NAME
ASCII String
field which holds the
destination queue name associated with a subscription.
public static final java.lang.String FIELD_NAME_MQ_DEST_QUEUE_MGR
ASCII String
field which holds the
destination queue manager name associated with a subscription.
public static final java.lang.String FIELD_NAME_COMPLETION_CODE
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.
public static final java.lang.String FIELD_NAME_RESPONSES
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.
public static final int DEF_CHARACTER_SET
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).
public static final int RESULT_UNKNOWN
FIELD_NAME_COMPLETION_CODE
field, indicating that
no information was available on the success of the operation.
public static final int RESULT_OK
FIELD_NAME_COMPLETION_CODE
field, indicating that
the operation was successful.
public static final int RESULT_WARNING
FIELD_NAME_COMPLETION_CODE
field, indicating that
the operation generated warnings. For more information use the method getResponses()
.
public static final int RESULT_ERROR
FIELD_NAME_COMPLETION_CODE
field, indicating that
the operation failed. For more information use the method getResponses()
.
public static final int DEF_TYPE
FIELD_NAME_TYPE_OF_MSG
field if it is not set in the message.
The default is TYPE_MQE
.
public static final int DEF_COMPLETION_CODE
FIELD_NAME_COMPLETION_CODE
field if it is not set in the message.
The default is RESULT_UNKNOWN
.
public static final boolean DEF_RETENTION
#FIELD_NAME_RETENTION
field if it is not set in the message.
The default is false
.
Constructor Detail |
public MQePubSubMsgObject() throws java.lang.Exception
java.lang.Exception
- Propagated from the super-class
constructor, MQeMsgObject.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.
msg
- The message object to be wrapped.
java.lang.Exception
- Propagated from the super-class
constructor, MQeMsgObject.Method Detail |
public java.lang.String dumpAllToString()
String
.
dumpAllToString
in class MQeMQMsgObject
String
representation of the data content.public int getActionType() throws java.lang.Exception
TYPE_PUB
, etc.
java.lang.Exception
- if there is an error getting the value
in the message object.public java.lang.String[] getTopics() throws java.lang.Exception
null
is returned.
java.lang.Exception
- if there is an error getting the values
in the message object.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.
getFormat
in class MQeMQMsgObject
java.lang.Exception
- If there is an error reading the value
from the message object.public byte[] getMessage() throws java.lang.Exception
String
value.
new byte[0]
is returned.
java.lang.Exception
- if there is an error getting the values
in the message object.public byte[] getMessageData() throws java.lang.Exception
byte[]
value.
null
is returned.
java.lang.Exception
- if there is an error getting the values
in the message object.public java.lang.String getDestQueueMgr() throws java.lang.Exception
subscribe(String[], String, String)
or unSubscribe(String[], String, String)
methods have been called.
null
.
java.lang.Exception
- if there is an error getting the value
in the message object.public java.lang.String getDestQueueName() throws java.lang.Exception
subscribe(String[], String, String)
or the unSubscribe(String[], String, String)
methods have been called.
null
.
java.lang.Exception
- if there is an error getting the value
in the message object.public int getCompletionCode() throws java.lang.Exception
DEF_COMPLETION_CODE
. Completion codes
are specified by appropriate constants in this class.
java.lang.Exception
- if there is an error getting the value
in the message object.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.
setFormat
in class MQeMQMsgObject
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.
java.lang.Exception
- If there is an error setting the value in the
message object.public java.lang.String[] getResponses() throws java.lang.Exception
java.lang.Exception
- if there is an error getting the value
in the message object.public boolean getRetention() throws java.lang.Exception
false
is returned.
java.lang.Exception
- if there is an error getting the values
in the message object.public void subscribe(java.lang.String[] topics, java.lang.String destQMgrName, java.lang.String destQueueName) throws java.lang.Exception
publish(String, boolean, String)
, #publish(String, boolean)
,
unSubscribe(String[], String, String)
,
or setData(byte[])
calls which might have been issued.
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.
java.lang.Exception
- if there is an error setting the values
in the message object.public void unSubscribe(java.lang.String[] topics, java.lang.String destQMgrName, java.lang.String destQueueName) throws java.lang.Exception
publish(String, boolean, String)
, #publish(String, boolean)
,
setData(byte[])
, or subscribe(String[], String, String)
calls
which might have been issued.
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.
java.lang.Exception
- if there is an error setting the values
in the message object.public void publish(java.lang.String topic, boolean retained, byte[] messageBytes) throws java.lang.Exception
setData(byte[])
, unSubscribe(String[], String, String)
,
or subscribe(String[], String, String)
calls which might have been issued.
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.
java.lang.Exception
- if there is an error setting the values
in the message object.public void publish(java.lang.String topic, boolean retained, java.lang.String message) throws java.lang.Exception
setData(byte[])
, unSubscribe(String[], String, String)
,
or subscribe(String[], String, String)
calls which might have been issued.
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.
java.lang.Exception
- if there is an error setting the values
in the message object.public void setData(byte[] data) throws java.lang.Exception
publish(String, boolean, String)
, #publish(String, boolean)
,
unSubscribe(String[], String, String)
,
or subscribe(String[], String, String)
calls which might have been issued.
setData
in class MQeMQMsgObject
data
- A byte array containing the message data.
java.lang.Exception
- if there is an error setting the value
in the message object.
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |