When you add an application through the DE PMC, you must use the Add Application wizard. This wizard creates a consumer location to associate with your application, deploys your service package, and registers your application. After completing the steps with the wizard, your application should be ready to use.
Review the sample client application code to learn how you can understand the differences between a synchronous client and an asynchronous client.
The client application sample sends 10 input messages through Symphony to the service with the data “Hello Grid !!”.
The service takes the input data sent by the client and returns it with the additional data “Hello Client !!”.
Results are returned asynchronously with a callback interface provided by the client to the API. Methods in this interface are called from threads within the API when certain events occur. In the sample, the events are:
The purpose of an asynchronous client is to get the output as soon as it is available. The client thread does not need to be blocked once the input data is sent and can perform other actions.
Because results can come back at any time, it is probable that your callback code needs synchronization between the callback thread and the controlling thread. The controlling thread needs to know when work is complete.
Results are not sent back in order. If order of results is important, the client application must sort the results.
Perform this step after implementing your own input and output objects.
In MySessionCallback.java, we create our own callback class that extends the SessionCallback class, and we implemented onResponse() to retrieve the output for each input message that we send.
We handle when an exception occurs on the callback method for the session. If you do not handle the exception, you do not have any exceptions if an error occurs on the callback.
onResponse() is called every time a task completes and output is returned to the client. The task output handle allows the client code to manipulate the output.
If there is output to retrieve, getTaskOutput() gets the output. Once results return, we print them to standard output and return.
In AsyncClient.java, perform this step after you have connected to the application.
When creating an asynchronous session: