Audit Service sample

This sample shows how a service can be created that wraps existing code. The Audit Service is a sample service that records the arrival of messages at the service by echoing messages on arrival.

Note

This sample is not the recommended way to use a file for auditing messages in a Progress Sonic ESB environment. Rather, it is an example of how to:

  1. Take an existing class (in this case, AuditFile.java).

  2. Wrap it as a Sonic ESB service (in this case, the AuditServiceType.java).

  3. Use it in the context of Sonic ESB messages and ESB processes.

The following files are used for this sample:

File Description
AuditFile.java Source for the example java class
AuditServiceType.java Source for this XQService
Sample.AuditServiceType.esbstyp Definition file for this service type
Sample.AuditServiceType.properties Service configuration properties file to customize the Sonic Workbench GUI for this service type.

Note

Do not edit the service configuration properties file directly. It is modified by the Java service type editor .

To run the AuditService sample:

  1. Start Sonic Workbench (see Starting Sonic Workbench ).

  2. If you have not already done so, import the Sonic ESB samples (see Importing Sonic Workbench sample projects).

  3. Select the following file in the Navigator in the Sonic Design perspective: Sample.ESB\src\com\sonicsw\esb\samples\audit\Sample.AuditServiceType.esbstyp Right-click and select Open. The file opens in the Java service type editor .

  4. Follow the directions in the editor to upload the Sample.AuditServiceType.esbstyp file to the domain. The dev_ESBTest container is also restarted.

  5. Click the drop-down list on the toolbar of the Java service type editor to view the scenarios:

  6. Select the Message Test 1 scenario and click Run to run that scenario. (If the Run button is not enabled, click in the editor page.)

  7. Observe the output in the Output view.

  8. Go to the Containers view. Right-click on the dev_ESBTest container and select View container log.

  9. Observe the audit messages in the container log.

  10. Then repeat these steps to run the other two scenarios.