Chapter 9. Synchronous event processing (callback) 147
scenario two, you would need to enhance your design to enable process multiple
concurrent sequential event requests.
9.4 Adapter termination and sequential event
processing
This section describes the different behaviors of adapter termination when you
use sequential event processing.
9.4.1 Normal termination
When an adapter is shut down normally, the Adapter Framework attempts to call
the termination method of the custom connector agent class. This method should
undertake the necessary processing to terminate the sequential processing
mechanism. We recommend that any currently awaiting requests be handled by
returning a failure status to the back-end application, if at all possible.
Current, in-progress requests will most likely be lost or might need to be thrown
away depending on the connectivity to the application. When an adapter is
terminated, a sequential event request will likely be in one of three states:
Awaiting processing by the sequential event processing mechanism
Sent to the broker and awaiting a response
Processing the broker response to send back to the application
The first point has been discussed previously, and ideally, we would prefer to
process any currently available responses prior to returning from the terminate
method of the custom adapter agent, which can be achieved with thoughtful
adapter design. One consideration that adapter developers should take into
account is the longevity of the broker flows or processes that might be executed.
Ideally, these processes should be short-lived. If this cannot be guaranteed, the
adapter developer must consider weighing the implications of delaying adapter
termination and risk the user pressing Ctrl+C to terminate the adapter abnormally
or terminating the adapter with outstanding requests.
9.4.2 Abnormal termination or no neat adapter shutdown situations
If a custom adapter with sequential event processing is abnormally terminated,
the back-end application will be potentially left in state where it is awaiting
responses from the adapter that it will never receive. Action might be required
within the application to clean-up the application state.