Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Guaranteed Delivery | Creating a Java Client that Uses Guaranteed Delivery | Overview
 
Overview
Using the TContext function, you can submit requests from a Java client application that uses guaranteed delivery.
Creating a Java client that uses guaranteed delivery involves the following general steps:
1. Make sure the following are in your classpath:
Integration Server_directory \lib\wm-isserver.jar
(or Integration Server_directory \instances\instance_name\lib\wm-isserver.jar)
Software AG_directory \common\lib\wm-isclient.jar
Software AG_directory \common\lib\ext\mail.jar
Note:
These jar files must be the same version as those present on the Integration Server to which your client program connects. If you are creating a stand-alone client application, you can obtain a copy of the jar files from the Integration Server. If you are creating a Java service for an Integration Server, verify that the Integration Server on which you deploy the service and the Integration Server to which the service submits guaranteed-delivery requests are both running the same version of Integration Server software.
2. Initialize TContext when a process starts. The server handles this function when a service uses guaranteed delivery.
3. Create TContext instances for different connection attributes. If you are only connecting to one host with a single set of credentials, you need only one TContext regardless of how many threads share the TContext.
The main difference between Context (the standard class) and TContext is that your client application or service is responsible for obtaining a transaction ID (tid) and associating it with each request you make for the same transaction. You receive a transaction ID (tid) when you start a guaranteed delivery transaction.
4. After a transaction is started and a transaction ID is received, invoke a service using guaranteed delivery. You must supply the transaction ID when you invoke the service.
5. When the transaction completes, end the transaction to clear the record for the transaction from the Job Manager’s job store.
You can chain transactions in a sequence so that each transaction in a sequence waits until the preceding transaction executes. To chain transactions, supply the transaction ID (tid) from the previous transaction when starting a new transaction.
6. When you are finished executing guaranteed delivery transactions for a specific instance, disconnect to end the instance of TContext. When you disconnect, TContext unregisters the instance with the Job Manager.
After a client application disconnects all TContext instances, it should shut down guaranteed delivery for the process. The server handles this function automatically when a service uses guaranteed delivery. If your client application or service has active TContext instances when the shutdown occurs, the server throws an exception (unless the shutdown was performed with the force option).
The following examples show how you would submit both synchronous and asynchronous requests from a Java client to the Job Manager.