These global variables provide application programs with access to message information from the most recent message sent or received. They are discussed in Chapter 4, “SQL Reference.”
Contains correlation from last message sent or read.
MQSeries – MQ does not verify whether @@msgcorrelation consists of printable characters. Application programs should not rely on @@msgcorrelation being in the current server character set, and should only use @@msgcorrelation as a selector for subsequent messages. If @@msgcorrelation is to be returned to the application, convert it to a varbinary datatype.
TIBCO JMS – @@msgcorrelation contains the correlationId from the the most recent message sent or received.
Contains message header information from the most recent message received. This variable’s format is in XML. For details about this format, see “<msgheader> and <msgproperties> documents”.
Functions that set @@msgheader include msgrecv and msgconsume.
For fields and descriptions about @@msgheader, see Table 4-1 for MQSeries and Table 4-2 for JMS.
Contains the ID of the most recent message sent or received.
MQ Series – MQ does not verify that the @@msgid consists of printable characters. Application programs should not rely on @@msgid being in the current server character set, and should only use @@msgid as a selector for subsequent messages. If @@msgid is returning to the application, it should be converted to a varbinary datatype.
Functions that set the variable are:
JMS – msgsend, msgpublish, msgrecv, msgconsume.
MQ Series – msgsend, msgrecv.
Contains message properties information from the most recent message received. This variable’s format is in XML. For details about this format, see “<msgheader> and <msgproperties> documents”.
JMS – the @@msgproperties are the user properties from the message.
MQ Series – if:
The message contains one or more MQRF headers, the name-value pairs in the MQRF headers and inserted into @@msgproperties.
Since the name-value pairs in the MQRF header can have non-unique names, the names are made unique by appending a “_ddd”, where ddd is an integer extension for uniqueness.
For instance, a MQRF header with these topics:
MQPSTopic */baseball MQPSTopic */baseball/world series MQPSTopic */sports
Results in these properties in @@msgproperties:
MQPSTopic */baseball MQPSTopic_1 */baseball/world series MPQSTopic_2 */sports
Functions that set the variable are:
JMS – msgrecv, msgconsume
MQ Series – msgrecv
The list below lists RFH name-value pairs that are extracted from the RF header if they are present.
MQPSCommand |
MQPSPubOpts |
MQPSStreamName |
MQPSCompCode |
MQPSPubTime |
MQPSStringData |
MQPSCorrelId |
MQPSQMgrName |
MQPSSubIdentity |
MQPSDelOpts |
MQPSQName |
MQPSSubName |
MQPSErrorId |
MQPSReason |
MQPSSubUserData |
MQPSErrorPos |
MQPSReasonText |
MQPSSubUserData |
MQPSIntData |
MQPSRegOpts |
MQPSTopic |
MQPSParmId |
MQPSSeqNum |
MQPSUserId |
Unrecognized names are ignored. If the value is quoted (“) in the RF header, the surrounding quotes are removed. In a quoted value, if there are escaped quotes (“”) within the value, doubled quotes are replaced by a single quote.
MQSeries only – contains the ReplyToQmgr name of the last message read.
Contains the name (provider_url, queue_name, topic_name, user_name) of the topic or queue name used to receive the next message. Can be a permanent or temporary destination.
Functions that set the variable are:
JMS – msgsend, msgpublish.
MQSeries – msgsend.
TIBCO JMS only – contains the schema of the message or a null value. Contains the value of the Adaptive Server property ase_message_body_schema. For more information, see the description of the schema option in msgsend and msgpublish.
Functions that set the variable are: msgsend, msgpublish.
Contains either the integer error code of the service provider exception, or zero, if the last operation did not raise an exception.
Functions that set the variable are: msgsend, msgpublish, msgrecv, msgconsume.
Contains either the error message of the service provider exception, or zero, if the last msgsend, msgpublish, msgrecv, or msgconsume raised an exception, or an empty string.
MQ Series – contains provider error message of last messaging operation. The MQ client libraries do not provide localized error messages, so you see an error message such as:
MQ API call failed with reason code '%s' (%d)
The “%s
” is
substituted with the MQ mnemonic for the MQ reason code.
The “%d
” is
substituted with the decimal MQ reason code.
Functions that set the variable are:
JMS – msgsend, msgpublish, msgrecv, msgconsume.
MQ Series – msgsend, msgrecv.
Contains the timestamp included in the message last sent.
Functions that set the variable are: msgsend, msgpublish.
MQSeries only – shows request/reply messaging using both @@msgreplytoinfo and @@msgcorrelation:
Session 1 (requester) |
Session 2 (receiver) |
---|---|
|
|
|
|
|
In this example:
Session 1 sends the request message to Q100, and expects the reply messsage on Q200. It sets the correlation to 0x123456.
Session 2 reads a message from Q100, sends a reply message to Q200, and specifies the correlation to 0x123456. The reply queue is obtained from the message that was just read.
Session 1 reads the reply message from Q200, wanting only message with correlation 0x123456.
These global variables are char datatypes, of length 16384.
You can remove trailing blanks using rtrim.
@@msgreplytoinfo contains reply destination information from the message header. It is formatted as an endpoint, as described in msgsend:
JMS only – The password is not included in the value of @@msgreplytoinfo. To use this destination as an argument in a subsequent msgsend or msgrecv call, add:
password=<your password>
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |