When you add an application through the DE PMC, you must use the Add Application wizard. This wizard defines 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 create a synchronous client application.
The myInput class acts as input to the service. In MyInput.java, we implement methods to set and access the data, such as the message string and task ID.
The input object must implement java.io.Serializable. Making the object serializable means that Java knows how to deconstruct the object so that it can be passed through the network to the service. This also means that Java knows how to reconstruct the object when it is received by the service.
The myoutput object is the result of the computation of input to the service, and is returned to the client by the service.
In MyOutput.java, we implement methods to set and access the output data, such as the message string, task ID, and run time that is returned from the service. Similar to the input object, the output object must implement java.io.Serializable.
A connection establishes a context for your client and workload. When you connect to an application:
The application name in the connection must match that defined in the application profile.
The default security callback encapsulates the callback for the user name and password. In Symphony DE, there is no security checking and login credentials are ignored —you can specify any user name and password. However, when using your client on the grid with Platform Symphony, you need a valid user name and password.
The creation and usage of the connection object must be scoped in a try-finally block. The finally block, with the connection.close() method, ensures that the connection is always closed whether exceptional behavior occurs or not. Failure to close the connection causes the connection to continue to occupy system resources.
A session is a way of logically grouping tasks that are sent to a service for execution. The tasks are sent and received synchronously.
When creating a synchronous session, you need to specify the session attributes by using the SessionCreationAttributes object. In this sample, we create a SessionCreationAttributes object called attributes and set three parameters in the object.
The first parameter is the session name. This is optional. The session name can be any descriptive name you want to assign to your session. It is for informational purposes, such as in the command line interface.
The second parameter is the session type. The session type is optional. You can leave this parameter blank and system default values are used for your session.
The third parameter is the session flag, which we specify as Session.SYNC. This indicates to Symphony that this is a synchronous session.
We pass the attributes object to the createSession() method, which returns the created session.
Similar to the connection object, the creation and usage of the session (sending and receiving data) must be scoped in a try-finally block. The finally block, with the session.close() method, ensures that the session is always closed, whether exceptional behavior occurs or not. Failure to close the session causes the session to continue to occupy system resources.
In this step, we create 10 input messages to be processed by the service. When a message is sent, a task input handle is returned. This task input handle contains the ID for the task that was created for this input message.
The call fetchTaskOutput() blocks until the output for all tasks is retrieved. If there is output to retrieve, getTaskOutput() gets the output