WebSphere MQ FTE 中的退出和调用有什么区别?
最近有人问我这个问题,所以我想我应该在这里发布问题和答案。
FTE 退出和 FTE 呼叫有什么区别?它们的用途是什么以及何时使用它们?
I have been asked this a lot lately so I thought I'd post the question and answer here.
What is the difference between an FTE exit and an FTE call? What are they for and when do I use them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
背景
WebSphere MQ File Transfer Edition (WMQ FTE) 是一个基于 WebSphere MQ 构建的 Java 应用程序,它提供了一个企业文件传输平台。传输发生在两个代理之间,一个位于源,另一个位于目的地。在传输的生命周期中,有四个点可以调用外部代码:在源代理和目标代理上开始传输之前,以及在源代理和目标代理上完成传输之后。调用外部代码的两种方法是退出和调用。
退出
出口被实现为 Java 类并从代理代码中调用。这些的范围是每个代理,一旦启用,每次传输都会调用退出。这使得它们适合执行全球政策或提供无处不在的服务,例如病毒扫描。
通话
调用(大部分)作为传输生命周期中的单独任务来实现,并且可以是 Ant 脚本或命令行可执行文件。这些是在传输作业定义中定义的,如果传输失败,则不会触发传输后调用。这使得它们适合提供特定于传输或取决于传输结果的功能。例如,传输后目标调用是执行解密的好地方,因为这是您通常为特定传输定义的内容,并且如果传输失败,解密步骤将不会触发。
退出和调用的顺序
在源代理和目标代理上,在传输开始之前和传输完成之后退出并调用都会触发。但文档中还没有显示调用和退出之间的关系。通过创建一组更新同一日志文件的调用和退出,可以演示触发顺序。
以下是文件传输期间退出点和调用的时间线。出口的名称按照 Java 接口定义。调用的名称符合传输定义的 XML 模式。
转移成功
2011 年美国东部时间 2 月 6 日星期日 20:20:21: onSourceTransferStart Exit 被触发
2011 年美国东部时间 2 月 6 日星期日 20:20:21:PreSourceCall 已启动
2011 年美国东部时间 2 月 6 日星期日 20:20:21: onDestinationTransferStart Exit 被触发
2011 年美国东部时间 2 月 6 日星期日 20:20:21:PreDestinationCall 已触发
2011 年美国东部时间 2 月 6 日星期日 20:20:22:onDestinationTransferEnd 退出已触发
2011 年美国东部时间 2 月 6 日星期日 20:20:22:PostDestinationCall 已触发
2011 年美国东部时间 2 月 6 日星期日 20:20:22: onSourceTransferEnd Exit 被触发
2011 年美国东部时间 2 月 6 日星期日 20:20:22:PostSourceCall 被触发
传输失败
2011 年美国东部时间 2 月 6 日星期日 20:28:49: onSourceTransferStart Exit 被触发
2011 年美国东部时间 2 月 6 日星期日 20:28:50:PreSourceCall 已启动
2011 年美国东部时间 2 月 6 日星期日 20:28:50: onDestinationTransferStart Exit 被触发
2011 年美国东部时间 2 月 6 日星期日 20:28:50:PreDestinationCall 已触发
2011 年美国东部时间 2 月 6 日星期日 20:28:50:onDestinationTransferEnd 退出已触发
2011 年 EST 2 月 6 日星期日 20:28:50:onSourceTransferEnd Exit 已触发
其他资源
有关 WMQ FTE 调用和退出编程的更多信息,请参阅 WMQ FTE 信息中心。
Background
WebSphere MQ File Transfer Edition (WMQ FTE) is a Java application built on WebSphere MQ and which provides an enterprise file transfer platform. The transfer occurs between two agents, one at the source and one at the destination. In the lifecycle of the transfer there are four points at which external code can be called - before the transfer starts at both the source and the destination agents, and after the transfer completes at the source and destination agents. The two methods by which external code may be called are exits and calls.
Exits
Exits are implemented as Java classes and are called from the agent code. The scope of these is per-agent and once enabled, the exit is called for every transfer. This makes them appropriate for enforcing global policies or providing a ubiquitous service such as virus scanning.
Calls
Calls are implemented as (mostly) separate tasks in the transfer lifecycle and may be either an Ant script or a command-line executable. These are defined within the transfer job definition and the post-transfer calls will not fire if the transfer fails. This makes them suitable for providing functionality that is specific to a transfer or that depends on the outcome of the transfer. For example, a post-transfer destination call is a good place to perform decryption because this is something you would usually define for specific transfers and the decrypt step will not fire if the transfer fails.
Order of exits and calls
Exits and calls both fire before the transfer starts and after the transfer completes, at both the source and target agents. But the documentation does not yet show the relationship between calls and exits. By creating a set of calls and exits which update the same log file, it is possible to demonstrate the firing order.
Below is the timeline of exit points and calls during a file transfer. The names of the exits are as per the Java interface definition. The names of the calls are as per the XML schema for transfer definitions.
Successful transfer
Sun Feb 6 20:20:21 EST 2011: onSourceTransferStart Exit fired
Sun Feb 6 20:20:21 EST 2011: PreSourceCall fired
Sun Feb 6 20:20:21 EST 2011: onDestinationTransferStart Exit fired
Sun Feb 6 20:20:21 EST 2011: PreDestinationCall fired
Sun Feb 6 20:20:22 EST 2011: onDestinationTransferEnd Exit fired
Sun Feb 6 20:20:22 EST 2011: PostDestinationCall fired
Sun Feb 6 20:20:22 EST 2011: onSourceTransferEnd Exit fired
Sun Feb 6 20:20:22 EST 2011: PostSourceCall fired
Failed transfer
Sun Feb 6 20:28:49 EST 2011: onSourceTransferStart Exit fired
Sun Feb 6 20:28:50 EST 2011: PreSourceCall fired
Sun Feb 6 20:28:50 EST 2011: onDestinationTransferStart Exit fired
Sun Feb 6 20:28:50 EST 2011: PreDestinationCall fired
Sun Feb 6 20:28:50 EST 2011: onDestinationTransferEnd Exit fired
Sun Feb 6 20:28:50 EST 2011: onSourceTransferEnd Exit fired
Additional resources
For more information on programming WMQ FTE calls and exits, see the WMQ FTE Infocenter.