JBoss.orgCommunity Documentation

Chapter 7. Runtime Validation

7.1. Service Validator Configuration
7.2. Deploy the TrailBlazer Example
7.3. Starting the pi4soa Monitor
7.4. Running the Example
7.5. Detecting a Validation Error

Note

Before you can deploy and run the runtime validation example, you will need to install the SAVARA Validator module for JBossESB.

Once services have been deployed, as mentioned in the previous section, we still need to be able to verify that the services continue to conform to the choreography description. The Conversation Validation capability within the SAVARA distribution can be used to validate the behaviour of each service.

In this section, we will use the Trailblazer example found in the ${SAVARA}/samples/trailblazer folder and the trailblazer-models Eclipse project.

The JBossESB service validator configuration is defined using jbossesb specific annotations, that are associated with the 'exchange details' components (contained within interactions), within the choreography description.

To view the pre-configured service validator configuration defined for the Trailblazer example, edit the TrailBlazer.cdm file, navigate to the Choreography Flows tab and then select the Choreography->Edit Annotations menu item associated with the first 'exchange details' component (as shown below).

This will display the annotation editor, with the single configured annotation called 'validator'. This annotation defines the information required for the Service Validator to monitor this specific message exchange (i.e. the JMS destination on which the message will be passed).

Once an annotation has been defined, it will also be displayed as part of the tooltip for the associated model component, for example:

Once the jbossesb annotations have been defined for all relevant 'exchange details' components in the choreography description, the choreography file can be copied to the ${JBossAS}/server/default/deploy/savara-validator.esb/models folder in the JBossAS environment. The service validator configuration for the trailblazer example has been preconfigured to be deployed as part of the installation procedure.

Note

If the savara-validator.esb/validator-config.xml within the JBossAS environment is modified, or choreography description files added, removed or updated within the savara-validator.esb/models sub-folder, then the changes will automatically be detected and used to re-configure the service validators without having to restart the JBossESB server.

The first step to deploying the Trailblazer example is to configure the JBossAS environment:

One the server has been started, the next step is to deploy the relevant components into the JBossAS environment. This is achieved by:

The pi4soa Monitor is used to observe a correlated view of the executing business transactions. Each service validator can be configured to report activites (i.e. sent and received messages) that it validates, to enable the correlator to reconstitute a global interpretation of each transaction.

This correlated view of each transaction can be used to understand where each transaction is within the process. It can also be used to report out of sequence, unexpected messages and more general errors in the context of the business process.

A simple monitoring tool is currently provided with the pi4soa tools, to enable the correlated global view of the transactions to be observed. Once the Trailblazer example has been deployed to the JBossAS environment, and the server is running, then the monitoring tool can be launched from the Eclipse environment by selecting the Choreography->Monitor menu item from the popup menu associated with the TrailBlazer.cdm file.

Wait for the monitor window to start, and indicate that the choreography is being monitored, shown in the status line at the bottom of the window.

To run the example, you need to start a browser and select the URL localhost:8080/trailblazer. This will show the following page, if the server has been configured correctly and the TrailBlazer example deployed:

Now you can submit quotes, You will see either a loan request rejected (single email) because the score is less than 4, or two emails (one from JMS bank and one from FileBased bank) with valid quotes. When entering subsequent quotes, make sure that the quote reference is updated, so that each session has a unique id.

To demonstrate the detection of validation errors, there is an alternative implementation of the trailblazer modules that behaviour differently to the choreography that is being monitored. Specifically, the credit score threshold used to determine whether a loan request should be issued to the banks, is raised from 4 to 7.

To deploy the version of the TrailBlazer example that results in validation errors, then:

The next step is to issue more transactions, until a credit check score occurs that is between 4 and 6 inclusive. This will result in a insufficientCredit interaction being reported, which would be unexpected in terms of the choreography.

When errors, such as unexpected messages, are detected by the service validators and reported to the Choreography Monitor, they are displayed in red.