Retrieving replies from asynchronous requests
Replies to asynchronous requests can be retrieved by using callbacks or reply solicitation calls.
Callbacks
ECIRequest supports callback objects. A callback object, which must implement the Callbackable interface, receives the results of the flow via the setResults method. When the results have been applied, a new thread is started to execute the run method.
If you specify a callback object for a synchronous call the results are passed to your Callbackable object as well as to your ECIRequest object in the flow request.
Reply solicitation calls
You can retrieve asynchronous replies using message qualifiers and reply solicitation calls.
Turn the feature on by invoking the method setAutoMsgQual(true) on your ECIRequest object. This will assign a message qualifier that is unique on all asynchronous requests (ECI_ASYNC, ECI_ASYNC_TPN, ECI_STATE_ASYNC, ECI_STATE_ASYNC_JAVA), when the request is flowed. Use this message qualifier to retrieve replies when you use the ECI_GET_SPECIFIC_REPLY and ECI_GET_SPECIFIC_REPLY_WAIT call types.
For remote connections you cannot get replies on a different connection to the one that flowed the original request with a message qualifier.
If you use ASYNC calls with message qualifiers, you might have to pass a user ID and password when you retrieve the reply with one of the various GET_REPLY call types. The user ID and password are not used to validate whether the reply can be retrieved; they are passed to the Gateway to hold in case security is required to clean up (BACKOUT) an LUW if the connection is lost while the server program is still running.
- To avoid problems resulting from reusing the same message qualifier
- To allow you to switch your application between local and remote connection
IPIC connections do not support asynchronous requests using message qualifiers from Java clients. Java clients that perform asynchronous requests using IPIC connections must use callbacks.