Implementing Handlers Using Application Classes
This section provides an overview of implementing handlers using application classes and discusses how to:
Develop an application class for implementing a handler.
Specify application class implementation details.
You can specify an application class as a handler for a service operation. This is the most typical implementation of a handler.
The process for implementing a handler using an application class is:
Develop an application class for implementing the handler.
This process is discussed in this section.
See Developing Application Classes for Implementing Handlers.
Add a handler to the service operation.
This process is discussed elsewhere in this topic.
Specify general handler details.
This process is discussed elsewhere in this topic.
Specify application class details for the handler.
This process is discussed in this section.
This section discusses how to develop application classes for implementing service operation handlers.
After you create the application package, you must specify the application package, class and method in the service operation definition as part of the handler details.
Understanding Interfaces and Deriving Application Classes
For each handler type, the following table lists the interface from which to derive the application class. The interfaces are located in the PS_PT application package:
Handler Type |
Application Class Interface |
---|---|
On Notify |
INotificationHandler |
On Post Notify |
IPrePostNotification |
On Pre Notify |
IPrePostNotification |
On Response |
INotificationHandler |
On Receive |
IReceiver |
On Request |
IRequestHandler |
On Send |
ISend |
On Route |
IRouter |
Understanding Input and Output Parameters
For application class handlers, the names that populate the drop-down used for selecting the appropriate method must have the exact signature required for the method.
Handler Type |
Input Parameter to Method |
Method Output Parameter |
---|---|---|
On Notify |
Message |
Void (none) |
On Response |
Message |
Void (none) |
On Receive |
Message |
Int |
On Request |
Message |
Message |
On Send |
Message |
Message |
On Route* |
Message |
Integer or Boolean |
For the On Route handler type, if you select a method that returns as integer, the handler type is On Route Send. If you select a method that returns as Boolean, the handler type is On Route Receive.
Developing an Application Class for Implementing a Handler
To develop an application class for implementing a handler:
Select the Integration Broker method that you want to implement based on the type of service operation you are creating.
Create a new application class, and import the appropriate Integration Broker application class. For example:
import PS_PT:Integration:INotificationHandler;
Define a class that implements the Integration Broker application class.
Define the method that implements the Integration Broker method, with the appropriate signature. In the following example, the OnNotify method would be available as a handler method.
class RESPONSE_NOTIFICATION implements PS_PT:Integration:INotificationHandler method RESPONSE_NOTIFICATION(); method OnNotify(&MSG As Message); end-class;
In the definition of the class, create the program-specific code to be used for this handler.
Before specifying application class implementation details for a handler, you must first create the application class to implement the handler, add a handler to the service operation definition, and specify general handler details.
To specify application class implementation details:
On the Service Operations – Handlers tab, in the Handlers section, click the Details link.
The Handler Details page appears.
Complete the following fields:
Field or Control
Definition
Package Name Enter the package name that contains the class that you want to specify, or use the Lookup button to search for and select one.
Path Enter the name or names of any subpackages that contain the application class that you want to specify, or use the Lookup button to search for and select one.
Class ID Enter the name of the application class that contains the method that you want to specify, or use the Lookup button to search for and select one.
Only application classes that implement an appropriate base class are shown. The base class is dependent on the handler type.
Method From the Method drop-down list box, select the method from the selected application class that you want to specify.
Only methods with the correct signature for the current handler type are shown.
Click the OK button.
Click the Save button.