MQGMO-Get-消息选项
MQGMO 结构允许应用程序控制如何从队列中除去消息。 此结构是 MQGET 调用上的输入/输出参数。
版本
MQGMO 的当前版本为 MQGMO_VERSION_4。 某些字段仅在特定版本的 MQGMO 中可用。 如果需要在多个环境之间移植应用程序,那么必须确保 MQGMO 的版本在所有环境之间一致。 仅在结构的特定版本中存在的字段在 MQGMO-Get-message 选项 和字段描述中标识为此类字段。
为受支持的编程语言提供的头 COPY 和 INCLUDE 文件包含环境支持的最新版本的 MQGMO ,但 Version 字段的初始值设置为 MQGMO_VERSION_1。 要使用 version-1 结构中不存在的字段,请将 Version 字段设置为所需版本的版本号。
字符集和编码
MQGMO 中的数据必须是由 MQENC_NATIVE 提供的本地队列管理器的 CodedCharSetId 队列管理器属性和编码提供的字符集。 但是,如果应用程序作为 MQ MQI 客户机运行,那么该结构必须采用客户机的字符集和编码。
字段
| 字段名称和描述 | 常量的名称 | 常量的初始值 (如果有) |
|---|---|---|
| StrucId (结构标识) | MQGMO_STRUC_ID | 'GMO¬' |
| 版本 (结构版本号) | MQGMO_VERSION_1 | 1 |
| MQGMO-"选项" 字段 (用于控制 MQGET 操作的选项) | MQGMO_NO_WAIT | 0 |
| WaitInterval (等待时间间隔) | None | 0 |
| Signal1 (信号) | None | z/OS® 上的空指针; 0 否则 |
| Signal2 (信号标识) | None | 0 |
| ResolvedQName (目标队列的已解析名称) | None | 空字符串或空白 |
注: 如果
Version 小于 MQGMO_VERSION_2,那么将忽略其余字段。 |
||
| MatchOptions (控制用于 MQGET 的选择条件的选项) | MQMO_MATCH_MSG_ID + MQMO_MATCH_CORREL_ID | 3 |
| GroupStatus (指示检索的消息是否在组中的标志) | MQGS_NOT_IN_GROUP | '¬' |
| SegmentStatus (指示检索的消息是否为逻辑消息的段的标志) | MQSS_NOT_A_SEGMENT | '¬' |
| 分段 (指示检索的消息是否允许进一步分段的标志) | MQSEG_禁止 | '¬' |
| Reserved1 (保留) | None | '¬' |
注: 如果
Version 小于 MQGMO_VERSION_3,那么将忽略其余字段。 |
||
| MsgToken (消息令牌) | MQMTOK_NONE | Null |
| ReturnedLength (以返回的消息数据的字节为单位的长度) | MQRL_UNDEFINED | -1 |
注: 如果
Version 小于 MQGMO_VERSION_4,那么将忽略其余字段。 |
||
| Reserved2 (保留) | None | '¬' |
| MsgHandle (要使用从队列中检索的消息的属性填充的消息的句柄) | MQHM_NONE | 0 |
备注信息:
|
||
语言声明
MQGMO 的 C 声明
typedef struct tagMQGMO MQGMO;
struct tagMQGMO {
MQCHAR4 StrucId; /* Structure identifier */
MQLONG Version; /* Structure version number */
MQLONG Options; /* Options that control the action of */
MQGET */
MQLONG WaitInterval; /* Wait interval */
MQLONG Signal1; /* Signal */
MQLONG Signal2; /* Signal identifier */
MQCHAR48 ResolvedQName; /* Resolved name of destination queue */
/* Ver:1 */
MQLONG MatchOptions; /* Options controlling selection */
criteria used for MQGET */
MQCHAR GroupStatus; /* Flag indicating whether message */
retrieved is in a group */
MQCHAR SegmentStatus; /* Flag indicating whether message */
retrieved is a segment of a logical */
message */
MQCHAR Segmentation; /* Flag indicating whether further */
segmentation is allowed for the */
message retrieved */
MQCHAR Reserved1; /* Reserved */
/* Ver:2 */
MQBYTE16 MsgToken; /* Message token */
MQLONG ReturnedLength; /* Length of message data returned */
(bytes) */
/* Ver:3 */
MQLONG Reserved2; /* Reserved */
MQHMSG MsgHandle; /* Message handle */
/* Ver:4 */
};
Signal1 字段声明为 PMQLONG。MQGMO 的 COBOL 声明
** MQGMO structure
10 MQGMO.
** Structure identifier
15 MQGMO-STRUCID PIC X(4).
** Structure version number
15 MQGMO-VERSION PIC S9(9) BINARY.
** Options that control the action of MQGET
15 MQGMO-OPTIONS PIC S9(9) BINARY.
** Wait interval
15 MQGMO-WAITINTERVAL PIC S9(9) BINARY.
** Signal
15 MQGMO-SIGNAL1 PIC S9(9) BINARY.
** Signal identifier
15 MQGMO-SIGNAL2 PIC S9(9) BINARY.
** Resolved name of destination queue
15 MQGMO-RESOLVEDQNAME PIC X(48).
** Options controlling selection criteria used for MQGET
15 MQGMO-MATCHOPTIONS PIC S9(9) BINARY.
** Flag indicating whether message retrieved is in a group
15 MQGMO-GROUPSTATUS PIC X.
** Flag indicating whether message retrieved is a segment of a
** logical message
15 MQGMO-SEGMENTSTATUS PIC X.
** Flag indicating whether further segmentation is allowed for the
** message retrieved
15 MQGMO-SEGMENTATION PIC X.
** Reserved
15 MQGMO-RESERVED1 PIC X.
** Message token
15 MQGMO-MSGTOKEN PIC X(16).
** Length of message data returned (bytes)
15 MQGMO-RETURNEDLENGTH PIC S9(9) BINARY.
** Reserved
15 MQGMO-RESERVED2 PIC S9(9) BINARY.
** Message handle
15 MQGMO-MSGHANDLE PIC S9(18) BINARY.
Signal1 字段声明为 POINTER。MQGMO 的 PL/I 声明
dcl
1 MQGMO based,
3 StrucId char(4), /* Structure identifier */
3 Version fixed bin(31), /* Structure version number */
3 Options fixed bin(31), /* Options that control the action of
MQGET */
3 WaitInterval fixed bin(31), /* Wait interval */
3 Signal1 fixed bin(31), /* Signal */
3 Signal2 fixed bin(31), /* Signal identifier */
3 ResolvedQName char(48), /* Resolved name of destination
queue */
3 MatchOptions fixed bin(31), /* Options controlling selection
criteria used for MQGET */
3 GroupStatus char(1), /* Flag indicating whether message
retrieved is in a group */
3 SegmentStatus char(1), /* Flag indicating whether message
retrieved is a segment of a logical
message */
3 Segmentation char(1), /* Flag indicating whether further
segmentation is allowed for the
message retrieved */
3 Reserved1 char(1), /* Reserved */
3 MsgToken char(16), /* Message token */
3 ReturnedLength fixed bin(31); /* Length of message data returned
(bytes) */
3 Reserved2 fixed bin(31); /* Reserved */
3 MsgHandle fixed bin(63); /* Message handle */
Signal1 字段声明为 pointer。MQGMO 的 High Level Assembler 声明
MQGMO DSECT
MQGMO_STRUCID DS CL4 Structure identifier
MQGMO_VERSION DS F Structure version number
MQGMO_OPTIONS DS F Options that control the action of
* MQGET
MQGMO_WAITINTERVAL DS F Wait interval
MQGMO_SIGNAL1 DS F Signal
MQGMO_SIGNAL2 DS F Signal identifier
MQGMO_RESOLVEDQNAME DS CL48 Resolved name of destination queue
MQGMO_MATCHOPTIONS DS F Options controlling selection criteria
* used for MQGET
MQGMO_GROUPSTATUS DS CL1 Flag indicating whether message
* retrieved is in a group
MQGMO_SEGMENTSTATUS DS CL1 Flag indicating whether message
* retrieved is a segment of a logical
* message
MQGMO_SEGMENTATION DS CL1 Flag indicating whether further
* segmentation is allowed for the message
* retrieved
MQGMO_RESERVED1 DS CL1 Reserved
MQGMO_MSGTOKEN DS XL16 Message token
MQGMO_RETURNEDLENGTH DS F Length of message data returned (bytes)
MQGMO_RESERVED2 DS F Reserved
MQGMO_MSGHANDLE DS D Message handle
MQGMO_LENGTH EQU *-MQGMO
ORG MQGMO
MQGMO_AREA DS CL(MQGMO_LENGTH)
MQGMO 的 High Level Assembler 声明
Type MQGMO
StrucId As String*4 'Structure identifier'
Version As Long 'Structure version number'
Options As Long 'Options that control the action of MQGET'
WaitInterval As Long 'Wait interval'
Signal1 As Long 'Signal'
Signal2 As Long 'Signal identifier'
ResolvedQName As String*48 'Resolved name of destination queue'
MatchOptions As Long 'Options controlling selection criteria'
'used for MQGET'
GroupStatus As String*1 'Flag indicating whether message'
'retrieved is in a group'
SegmentStatus As String*1 'Flag indicating whether message'
'retrieved is a segment of a logical'
'message'
Segmentation As String*1 'Flag indicating whether further'
'segmentation is allowed for the message'
'retrieved'
Reserved1 As String*1 'Reserved'
MsgToken As MQBYTE16 'Message token'
ReturnedLength As Long 'Length of message data returned (bytes)'
End Type
MQGMO 的 PROPCTL 通道选项
使用 PROPCTL 通道属性可控制将哪些消息属性包含在从较早版本的 IBM MQ从 IBM® MQ 9.2 队列管理器发送到伙伴队列管理器的消息中。
| PROPCTL | 描述 |
|---|---|
| ALL | 如果从较早版本连接到伙伴队列管理器的应用程序能够处理 IBM MQ 9.2 应用程序放置在消息中的任何属性,请使用此选项。 除 您必须考虑两个应用程序设计问题:
通过设置 |
| COMPAT | 在某些情况下,使用此选项将消息属性发送到连接到较早版本伙伴队列管理器的应用程序,但不发送到所有应用程序。 仅当满足以下两个条件时,才会发送消息属性:
通过设置 COMPAT 通道选项, JMS 应用程序可以使用该通道在 IBM MQ 9.2 与较低版本之间进行互操作。 通道不可用于每个使用消息属性的应用程序,仅可用于那些使用保留文件夹的应用程序。 有关是否发送消息或属性的规则如下:
注:
reserved文件夹名称以 mcd., jms., usr.或 mqext.开头。 将为使用 JMS 接口的应用程序创建这些文件夹。 在 IBM MQ 9.2 中,放置在这些文件夹中的任何 "名称/值" 对都将被视为消息属性。除了放入 |
| NONE | 使用此选项可防止将任何消息属性发送到连接到较早版本伙伴队列管理器的应用程序。 仍将发送包含 "名称/值" 对和消息属性的 在设置了 |
MQGMO 的 PROPCTL 队列选项
使用 PROPCTL 队列属性来控制如何将消息属性返回到调用 MQGET 而不设置任何 MQGMO 消息属性选项的应用程序。
| PROPCTL | 描述 |
|---|---|
| ALL | 使用 ALL 选项,以便从同一队列读取消息的不同应用程序可以通过不同方式处理消息。
消息中的所有属性都将返回到应用程序。
仅当接收应用程序未设置 |
| COMPAT (缺省值) | COMPAT 是缺省选项。 如果未设置 如果您已编写较早版本的应用程序 MQI 应用程序以读取 JMS 消息,请使用此选项。
如果消息包含新的用户属性文件夹,那么您可以推断消息是由新的或已更改的 IBM MQ 9.2 应用程序创建的。 如果接收应用程序要直接在
仅当接收应用程序未设置 |
| FORCE | FORCE 选项将所有消息属性放入 假设您已修改应用程序以处理 IBM MQ 9.2 消息属性,但也保留了它直接使用 仅当接收应用程序未设置 |
| NONE | 使用 NONE 选项,以便现有应用程序可以处理消息 (忽略所有消息属性) ,新的或已更改的应用程序可以查询消息属性。
仅当接收应用程序未设置 |
| V6COMPAT | 使用此选项可接收与发送的格式相同的 必须在发送队列和接收队列以及任何中间传输队列上都设置此选项。 它覆盖队列名称解析路径中的队列定义上设置的任何其他 PROPCTL 选项。 仅在特殊情况下使用 V6COMPAT 选项。 例如,如果要将应用程序从较低版本迁移到 IBM MQ 9.2,那么该选项很有价值,因为它会保留较低版本的行为。 该选项可能会对消息吞吐量产生影响。 管理也比较困难; 您需要确保在发送方,接收方和中间传输队列上设置该选项。 仅当接收应用程序未设置 |
有关消息属性和名-值对的更多信息,请参阅NameValueData(MQCHARn)。
MQGMO 的消息属性选项
使用 MQGMO 消息属性选项可控制如何将消息属性返回到应用程序。
| MQGMO 选项 | 描述 |
|---|---|
| MQGMO_PROPERTIES_AS_Q_DEF | 从同一队列读取且未设置
|
| MQGMO_PROPERTIES_IN_HANDLE | 强制应用程序使用消息属性。 使用此选项可检测修改后的应用程序是否未能创建消息句柄。 应用程序可能正在尝试直接从 |
| MQGMO_NO_PROPERTIES |
|
| MQGMO_PROPERTIES_FORCE_MQRFH2 | 即使创建了消息句柄,也会在
|
| MQGMO_PROPERTIES_COMPATIBILITY | 如果消息来自 JMS 客户机,那么将在
|