監視要求訊息格式
當適當的 XML 訊息到達代理程式的指令佇列時,即會建立資源監視器,這通常是因為使用者發出 fteCreateMonitor 指令或使用「 IBM® WebSphere® MQ 探險家」介面。
監視器 XML 必須符合 Monitor.xsd 綱目,使用 <monitor>
元素作為根元素。
監視器訊息可具有下列其中一個根元素:
<monitor>
- 用以建立及啟動新的資源監視器<deleteMonitor>
- 用以停止及刪除現有監視器
fteListMonitors 指令沒有指令訊息,因為此指令會直接從 SYSTEM.FTE 主題擷取符合的監視定義。
綱目
下列綱目說明在監視器要求 XML 訊息中有效的元素。
<xsd:schema xmlns:xsd="https://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.ibm.com/xmlns/wmqfte/7.0.1/MonitorDefinition"
xmlns="https://www.ibm.com/xmlns/wmqfte/7.0.1/MonitorDefinition">
<xsd:include schemaLocation="FileTransfer.xsd" />
<xsd:element name="monitor">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="monitorNameType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="description" type="xsd:string"
minOccurs="0" maxOccurs="1" />
<xsd:element name="pollInterval" type="pollIntervalType"
minOccurs="1" maxOccurs="1" default="10" />
<xsd:element name="batch" type="batchType"
minOccurs="0" maxOccurs="1" />
<xsd:element name="agent" type="agentNameType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="resources" type="monitorResourcesType"
minOccurs="0" maxOccurs="1" />
<xsd:element name="triggerMatch" type="triggerMatchType"
maxOccurs="1" minOccurs="1" />
<xsd:element name="reply" type="replyType"
maxOccurs="1" minOccurs="0" />
<xsd:element name="tasks" type="monitorTasksType"
maxOccurs="1" minOccurs="1" />
<xsd:element name="originator" type="origRequestType"
maxOccurs="1" minOccurs="1"/>
<xsd:element name="job" type="jobType"
maxOccurs="1" minOccurs="0"/>
<xsd:element name="defaultVariables" type="defaultVariablesType"
maxOccurs="1" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="version" type="versionType" use="required" />
</xsd:complexType>
</xsd:element>
<xsd:element name="deleteMonitor">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="monitorNameType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="originator" type="origRequestType"
maxOccurs="1" minOccurs="1"/>
<xsd:element name="reply" type="replyType"
maxOccurs="1" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="version" type="versionType" use="required" />
</xsd:complexType>
</xsd:element>
<xsd:complexType name="transferRequestType">
<xsd:choice>
<xsd:element name="managedTransfer" type="managedTransferType" />
<xsd:element name="managedCall" type="managedCallType" />
</xsd:choice>
<xsd:attribute name="version" type="versionType" />
</xsd:complexType>
<xsd:complexType name="monitorResourcesType">
<xsd:choice>
<xsd:sequence>
<xsd:element name="directory" type="monitoredDirectoryType"
minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:element name="queue" type="monitoredQueueType"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="monitoredDirectoryType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="recursionLevel" type="xsd:nonNegativeInteger" />
<xsd:attribute name="id" type="resourceIdAttrType" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="monitoredQueueType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="id" type="resourceIdAttrType" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="triggerMatchType">
<xsd:sequence>
<xsd:element name="conditions" type="conditionsType"
minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="conditionsType">
<xsd:choice minOccurs="1">
<xsd:element name="allOf" type="listPredicateType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="anyOf" type="listPredicateType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="condition" type="conditionType"
minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="listPredicateType">
<xsd:choice>
<xsd:element name="condition" type="conditionType"
minOccurs="1" maxOccurs="unbounded" />
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="conditionType">
<xsd:sequence>
<xsd:element name="name" type="conditionNameType"
minOccurs="0" maxOccurs="1" />
<xsd:element name="resource" type="resourceIdType"
minOccurs="0" maxOccurs="1" />
<xsd:choice minOccurs="1">
<xsd:element name="fileMatch" type="fileMatchConditionType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="fileNoMatch" type="fileNoMatchConditionType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="fileSize" type="fileSizeConditionType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="queueNotEmpty" type="queueNotEmptyConditionType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="completeGroups" type="completeGroupsConditionType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="fileSizeSame" type="fileSizeSameType"
minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="fileMatchConditionType">
<xsd:sequence>
<xsd:element name="pattern" type="conditionPatternType"
minOccurs="0" default="*.*" />
<xsd:element name="exclude" type="conditionPatternType"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="fileNoMatchConditionType">
<xsd:sequence>
<xsd:element name="pattern" type="conditionPatternType"
minOccurs="0" default="*.*" />
<xsd:element name="exclude" type="conditionPatternType"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="fileSizeConditionType">
<xsd:sequence>
<xsd:element name="compare" type="sizeCompareType"
minOccurs="1" default="0" />
<xsd:element name="pattern" type="conditionPatternType"
minOccurs="0" default="*.*" />
<xsd:element name="exclude" type="conditionPatternType"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="sizeCompareType">
<xsd:simpleContent>
<xsd:extension base="xsd:int">
<xsd:attribute name="operator" type="sizeOperatorType" use="required" />
<xsd:attribute name="units" type="fileSizeUnitsType" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="sizeOperatorType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value=">=" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="fileSizeUnitsType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[bB]|[kK][bB]|[mM][bB]|[gG][bB]" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="conditionPatternType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="type" type="patternTypeAttributeType"
use="optional" default="wildcard"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="patternTypeAttributeType">
<xsd:restriction base="xsd:token">
<xsd:enumeration value="regex" />
<xsd:enumeration value="wildcard" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="conditionNameType">
<xsd:simpleContent>
<xsd:extension base="xsd:string" />
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="queueNotEmptyConditionType"/>
<xsd:complexType name="completeGroupsConditionType"/>
<xsd:complexType name="fileSizeSameType">
<xsd:sequence>
<xsd:element name="pattern" type="conditionPatternType"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="exclude" type="conditionPatternType"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="polls" type="positiveIntegerType" use="required" />
</xsd:complexType>
<xsd:complexType name="pollIntervalType">
<xsd:simpleContent>
<xsd:extension base="xsd:int">
<xsd:attribute name="units" type="timeUnitsType"
use="optional" default="minutes" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="batchType">
<xsd:attribute name="maxSize" type="positiveIntegerType" use="required"/>
</xsd:complexType>
<xsd:simpleType name="timeUnitsType">
<xsd:restriction base="xsd:token">
<xsd:enumeration value="seconds" />
<xsd:enumeration value="minutes" />
<xsd:enumeration value="hours" />
<xsd:enumeration value="days" />
<xsd:enumeration value="weeks" />
<xsd:enumeration value="months" />
<xsd:enumeration value="years" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="monitorTasksType">
<xsd:sequence>
<xsd:element name="task" type="monitorTaskType"
minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="monitorTaskType">
<xsd:sequence>
<xsd:element name="name" type="monitorTaskNameType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="description" type="xsd:string"
minOccurs="0" maxOccurs="1" />
<xsd:element name="transfer" type="transferTaskType"
minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="transferTaskType">
<xsd:sequence>
<xsd:element name="request" type="transferRequestType"
minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="resourceIdType">
<xsd:attribute name="id" type="xsd:string" use="optional" />
</xsd:complexType>
<xsd:simpleType name="resourceIdAttrType">
<xsd:restriction base="xsd:string"></xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="monitorNameType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[^%\*]+" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="agentNameType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[.%_0-9A-Z]*" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="monitorTaskNameType">
<xsd:restriction base="xsd:string">
<xsd:pattern value=".*" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="defaultVariablesType">
<xsd:sequence>
<xsd:element name="variable" type="variableType"
maxOccurs="unbounded" minOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="variableType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="key" type="xsd:string" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:schema>
瞭解建立監視器訊息
以下說明在建立監視器訊息中使用的元素及屬性:元素說明
- <monitor>
- 群組元素,包含取消進行中的檔案傳送需要的所有元素。
屬性 說明 version 指定此元素的版本,由 WebSphere MQ Managed File Transfer提供。 - <name>
- 監視器的名稱,必須是監視器代理程式內的唯一名稱。
- <description>
- 監視器的說明(目前未使用)。
- <pollInterval>
- 每一次根據觸發條件檢查資源之間的時間間隔。
屬性 說明 單元: 指定輪詢間隔的時間單位。 有效值為: - 秒
- 分鐘
- 時
- 日
- 週
- 月
- 年
- <agent>
- 與監視器相關聯的代理程式名稱。
- <resources>
- 群組元素,包含指定監視器資源的元素。
- <directory>
- 完整路徑,指定要在監視器的代理程式機器上監視的目錄。
屬性 說明 recursionLevel 除了指定的目錄外所要監視的子目錄數目。 ID 資源的唯一 ID。 - <queue>
- 佇列名稱,指定要在監視代理程式的佇列管理程式上監視的佇列。
- <triggerMatch>
- 群組元素,包含指定與受監視資源相互比較之觸發條件的元素。
- <conditions>
- 群組元素,包含指定與受監視資源相互比較之條件類型的元素。
- <allOf>
- 指定必須滿足所有內含條件的述詞。
- <anyOf>
- 指定必須滿足任何內含條件的述詞。
- <condition>
- 定義將納入整體監視器觸發條件的比較條件。
- <name>
- 條件的名稱。
- <resource>
- 識別據以比較條件的資源定義。
屬性 說明 ID 資源的唯一 ID。
- fileMatch
- fileNoMatch
- fileSize
- queueNotEmpty
- completeGroups
- <fileMatch>
- 檔案名稱符合條件的群組元素。
- <pattern>
- 指定檔案名稱符合型樣。 資源上的檔案必須符合此型樣,才能滿足條件。 預設型樣是 *(任何檔案皆符合)。
- <fileNoMatch>
- 反向檔案名稱符合條件的群組元素。
- <pattern>
- 指定反向檔案名稱符合型樣。 如果受監視資源上沒有符合的檔案,則滿足條件。 預設型樣是 *(無任何檔案即符合)。
- <fileSize>
- 檔案大小比較的群組元素。
- <compare>
- 指定檔案大小比較。 這個值必須是非負整數。
屬性 說明 operator 要使用的比較運算子。 僅支援> = '。 單元: 指定檔案大小的單位,可以是下列其中一項: - B - 位元組
- KB - 千位元組
- MB - 百萬位元組
- GB - 十億位元組
- <pattern>
- 要比對的檔案名稱型樣。 預設值是 *(任何檔案皆符合)。
- <queueNotEmpty>
- 只有在資源是佇列時,才可指定此項目。 指定佇列上必須有訊息,才會觸發監視器。
- <completeGroups>
- 只有在資源是佇列時,才可指定此項目。 指定佇列上必須有完整訊息群組存在,才會觸發監視器。 對於佇列上的每一個完整群組,分別執行單一傳送作業。
- <reply>
- 選用元素,用來指定非同步要求的回覆佇列。
屬性 說明 QMGR 佇列管理程式名稱。 - <tasks>
- 群組元素,包含的元素指定滿足監視器觸發條件時所要呼叫的作業。
- <task>
- 群組元素,定義監視器在滿足觸發條件時所要呼叫的個別作業。 目前只能指定一項作業。
- <name>
- 作業的名稱。 接受任何英數字元。
- <description>
- 作業的說明。 接受任何文字值。
- <transfer>
- 定義傳送作業的群組元素。
- <request>
- 定義作業類型的群組元素。 其中必須包含下列其中一個繼承自 FileTransfer.xsd 綱目定義的元素:
- managedTransfer
- managedCall
屬性 說明 version WebSphere MQ Managed File Transfer所提供的要求版本。 其格式為 n.mm,其中 n 是主要發行版本,mm 是次要版本。 例如,1.00。 - <originator>
- 群組元素,包含指定要求發送端的元素。
- <hostName>
- 來源檔案所在系統的主機名稱。
- <userID>
- 發出檔案傳送的使用者 ID。
- <mqmdUserID>
- 選用項目。 在訊息描述子 (MQMD) 中提供的 IBM WebSphere MQ 使用者 ID。
- <job>
- 包含工作資訊的群組元素。
- <jobName>
- 指定邏輯工作 ID。
- <defaultVariables>
- 群組元素,包含個以上 variable 元素。 在監視佇列時,將這些變數用於變數替代中。 如需變數替代的相關資訊,請參閱 使用變數替代來自訂作業。
- <variable>
- 一個元素,包含與 key 屬性指定的索引鍵相關聯的值。
屬性 說明 key 預設變數的名稱。
瞭解刪除監視器訊息
以下說明在刪除監視器訊息中使用的元素及屬性:元素說明
- <deleteMonitor>
- 群組元素,包含停止及刪除監視器需要的所有元素。
屬性 說明 version 指定此元素的版本,由 WebSphere MQ Managed File Transfer提供。 - <name>
- 要刪除的監視器名稱。
- <originator>
- 群組元素,包含指定要求發送端的元素。
- <hostName>
- 來源檔案所在系統的主機名稱。
- <userID>
- 發出檔案傳送的使用者 ID。
- <mqmdUserID>
- 選用項目。 在訊息描述子 (MQMD) 中提供的 IBM WebSphere MQ 使用者 ID。
- <reply>
- 指定對要求產生的暫時回覆佇列名稱。 佇列名稱由 command.properties 配置檔中的索引鍵
dynamicQueuePrefix
所定義。 如果未指定此項目,佇列名稱將會使用預設值 WMQFTE。屬性 說明 QMGR 產生暫時動態佇列以接收回覆的指令佇列管理程式的名稱。