使用 ProtocolBridgeProperties.xml 文件定义协议文件服务器的属性

定义一个或多个协议文件服务器的属性,您希望使用代理程序配置目录中的 Managed File Transfer 提供的 ProtocolBridgeProperties.xml 文件与这些服务器之间传输文件。

关于本任务

fteCreateBridgeAgent 命令在代理程序配置目录 MQ_DATA_PATH/mqft/config/coordination_queue_manager/agents/bridge_agent_name中创建 ProtocolBridgeProperties.xml 文件。 如果运行命令时指定缺省值,那么该命令还会在此文件中为缺省协议文件服务器创建一个条目。

消息 BFGCL0392I 将提供 ProtocolBridgeProperties.xml 文件的位置。
<?xml version="1.0" encoding="IBM-1047"?>
<!--
This ProtocolBridgeProperties.xml file determines the protocol servers that will be accessed by the
MQMFT protocol bridge agent.

Each protocol server is defined using either a <tns:ftpServer>, <tns:ftpsServer>, or <tns:sftpServer>
element - depending on the protocol used to communicate with the server.  When the protocol
bridge agent participates in a managed file transfer it will determine which server to used based on
the prefix (if any) present on the file path.  For example a file path of 'server1:/home/user/file.txt' would
be interpreted as a request to transfer /home/user/file.txt using 'server1'.  The server name is compared
to the 'name' attribute of each <tns:ftpServer>, <tns:ftpsServer> or <tns:sftpServer> element in this
XML document and the first match is used to determine which protocol server the protocol bridge
agent will connect to.  If no match is found then the managed file transfer operation will fail.

If a file path is not prefixed with a server name, for example '/home/user/file.txt' then this XML
document can specify a default server to use for the managed file transfer.  To specify a
default server use the <tns:defaultServer> element as the first element inside the <tns:serverProperties>
element.  The default server will be used whenever the protocol bridge agent participates in
a managed file transfer for file names which do not specify a prefix.

An optional <tns:limits> element can be specified within each server definition. This element contains 
attributes that govern the amount of resources used by each defined server.

An optional <tns:credentialsFile> element can be specified within each serverProperties definition. This
element contains a path to a file containing credentials to be used when connecting to defined servers.

An example ProtocolBridgeProperties.xml file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<tns:serverProperties xmlns:tns="http://wmqfte.ibm.com/ProtocolBridgeProperties"
	xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://wmqfte.ibm.com/ProtocolBridgeProperties  ProtocolBridgeProperties.xsd">

	<tns:credentialsFile path="$HOME/ProtocolBridgeCredentials.xml" />

	<tns:defaultServer name="myFTPserver" />

	<tns:ftpServer name="myFTPserver" host="windows.hursley.ibm.com" port="1234" platform="windows"
		timeZone="Europe/London" locale="en_GB" fileEncoding="UTF-8"
		listFormat="unix" limitedWrite="false">

		<tns:limits maxListFileNames="100" maxListDirectoryLevels="999999999"
			maxReconnectRetry="2"  reconnectWaitPeriod="10"
			maxSessions="60" socketTimeout="30" />

	</tns:ftpServer>

	<tns:ftpsServer name="myFTPSserver" host="unix.hursley.ibm.com" platform="unix"
		timeZone="Europe/London" locale="en_GB" fileEncoding="UTF8"
		listFormat="unix" limitedWrite="false" ftpsType="explicit"
		trustStore="C:\FTE\keystores\myFTPSserver\FTPSKeyStore.jks" trustStorePassword="password">

		<tns:limits maxReconnectRetry="10" connectionTimeout="10"/>

	</tns:ftpsServer>

	<tns:sftpServer name="mySFTPserver" host="windows.hursley.ibm.com" platform="windows"
		timeZone="Europe/London" locale="en_GB" fileEncoding="UTF-8"
		limitedWrite="false">

		<tns:limits connectionTimeout="60"/>

	</tns:sftpServer>

</tns:serverProperties>

This example shows the outermost <tns:serverProperties> element which must exist for the document to
be valid, an optional <tns:defaultServer> element, as well as definitions for an FTP, FTPS and SFTP server.

The attributes of the <tns:ftpServer>, <tns:ftpsServer> and <tns:sftpServer> elements determine the
characteristics of the connection established to the server.  These attributes correspond to the command
line parameters for the 'fteCreateBridgeAgent' command.

The following attributes are valid for all of the <tns:ftpServer>, <tns:ftpsServer> and <tns:sftpServer>
elements: name, host, port, platform, fileEncoding, limitedWrite and controlEncoding.

The following attributes are valid for the <tns:ftpServer> and <tns:ftpsServer> elements: timezone, locale,
listFormat, listFileRecentDateFormat, listFileOldDateFormat, and monthShortNames.

The following attributes are valid for the <tns:ftpServer> element only: passiveMode

The following attributes are valid for the <tns:ftpsServer> element only: ftpsType, trustStore, trustStorePassword,
trustStoreType, keyStore, keyStorePassword, keyStoreType, ccc, protFirst, auth, and connectTimeout.

The following attributes are valid for the <tns:limits> element within all of the <tns:ftpServer>, <tns:ftpsServer>
and <tns:sftpServer> elements: maxListFileNames, maxListDirectoryLevels, maxReconnectRetry, reconnectWaitPeriod,
maxSessions and socketTimeout

-->
<tns:serverProperties xmlns:tns="http://wmqfte.ibm.com/ProtocolBridgeProperties"
        xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://wmqfte.ibm.com/ProtocolBridgeProperties ProtocolBridgeProperties.xsd">

    <!-- By default the location of the credentials file is in the home directory of the user that started the -->
    <!-- protocol bridge agent. If you wish to specify a different location use the credentialsFile element to -->
    <!-- do this. For example:                                                                                 -->
    <!-- <tns:credentialsFile path="/test/ProtocolBridgeCredentials.xml"/>                                   -->

    <tns:defaultServer name="WINMVSCA.HURSLEY.IBM.COM" />
    <tns:ftpServer name="WINMVSCA.HURSLEY.IBM.COM" host="WINMVSCA.HURSLEY.IBM.COM" platform="unix" 
                timeZone="Europe/London" locale="en-GB" fileEncoding="US-ASCII"
                listFormat="unix" limitedWrite="false"  />

    <!-- Define servers here -->
</tns:serverProperties>
该命令可以生成以下消息:BFGCL0532I
为使该代理正常运行,必须手工创建一个额外的凭证文件。 
默认情况下,该文件名为 ProtocolBridgeCredentials ,位于主目录中 
启动代理程序的用户的目录。 例如,如果此用户启动了代理程序 
文件位置为 $HOME/ProtocolBridgeCredentials
如果使用凭证文件:
  1. 请参阅以下文本以获取有关如何创建凭证文件的进一步信息。
  2. 凭证文件必须位于具有受限许可权的目录中。 例如,其他用户不能具有读访问权。
  3. 在已启动代理的用户标识的 $HOME 环境变量中为凭证文件指定目录的位置,或者编辑 ProtocolBridgeProperties.xml 文件并指定位置:
    <tns:credentialsFile path="/test/ProtocolBridgeCredentials.xml"/>
如果您要添加更多非缺省协议服务器,请编辑此文件以定义它们的属性。 该示例添加一个额外的 FTP 服务器。
注: 协议网桥代理不支持文件锁定。 这是因为 Managed File Transfer 不支持文件服务器上的文件锁定机制。

过程

  1. 通过将以下行作为 <tns:serverProperties>的子元素插入到文件中来定义协议文件服务器:
    <tns:ftpServer name="myserver" host="myhost.hursley.ibm.com" port="1234" 
       platform="windows"
    		         		   timeZone="Europe/London" locale="en-GB" fileEncoding="UTF-8"
    		        		   listFormat="unix" limitedWrite="false" >
    <tns:limits maxListFileNames="10" maxListDirectoryLevels="500"/>
  2. 然后更改属性的值:
    • name 是协议文件服务器的名称
    • host 是协议文件服务器的主机名或 IP 地址
    • port 是协议文件服务器的端口号
    • platform 是运行协议文件服务器的平台
    • timeZone 是协议文件服务器运行的时区
    • locale 是协议文件服务器上使用的语言
    • fileEncoding 是协议文件服务器的字符编码
    • listFormat 是从协议文件服务器返回的文件列表格式
    • limitedWrite 确定是否在写入文件服务器时遵循缺省方式,这会创建临时文件,然后在完成传输后重命名此文件。 对于配置为只写的文件服务器,会使用其最终名称直接创建此文件。 该属性的值可以为 true 或 false。 limitedWrite 属性和 doNotUseTempOutputFile 代理属性在协议网桥代理中共同使用。 如果要使用临时文件,那么切勿设置 doNotUseTempOutputFile 的值,并且必须将 limitedWrite 的值设置为 false。 其他任何设置组合意味着不会使用临时文件。
    • maxListFileNames 是在协议文件服务器上的目录中扫描文件名时收集的最大名称数。
    • maxListDirectoryLevels 是在协议文件服务器上的目录中扫描文件名时要递归的最大目录级别数。
    有关这些属性的更多详细信息,包括这些属性是必需属性还是可选属性及其缺省值,请参阅 协议网桥属性文件格式