What's the difference between an exit and a ca

2020-07-16 09:41发布

问题:

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?

回答1:

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.