JBoss.orgCommunity Documentation

Chapter 2. Conversation Validation with CDL

2.1. Overview
2.2. Configuration of Conversation Validation
2.2.1. Installing the Conversation Validation Mechanism
2.2.2. Explicit Configuration
2.2.3. Defining the Validator Configuration within a Choreography
2.3. Monitoring the Choreography Description
2.4. Configuration for Conversation Recording

Conversation validation is a form of runtime governance concerned with the dynamic behaviour of a system.

When coupled with a choreography description model of a system, this means having the ability to ensure that the way a collection of services interact correctly adheres to a description of the business process being enacted.

This section introduces the choreography description language (CDL) defined by W3C, and the pi4soa open source project which provides an editor for creating choreography descriptions, as well as utilizing these descriptions for runtime validation and execution purposes.

This section explains how to configure the conversation validation mechanism to validate ESB services against a choreography description. The first sub-section describes how the mechanism is hooked into the JBossESB environment. The following two sub-sections explain two alternate ways that relevant endpoint references can be configured for validation.

The information concerning which destinations will be validated, and to which model/role they relate, can be explicitly defined within the validator-config.xml file, contained within the overlord-cdl-validator.esb bundle.

An example of the contents of this file, that would related to the TrailBlazer example, is:



    <validator mode="monitor" replyToTimeout="10000" >
        <service model="TrailBlazer.cdm" 
                    role="LoanBrokerParticipant" >
            <output epr="jms:queue/esb-tb-creditAgencyQueue" />
            <input epr="jms:queue/esb-tb-creditAgencyQueue_reply" />
            <output epr="jms:queue/esb-tb-jmsBankRequestQueue" />
            <output epr="jms:queue/esb-tb-fileBankRequestQueue" />
            <input epr="jms:queue/esb-tb-jmsBankResponseQueue" />
            <output epr="jms:queue/esb-tb-customerNotifier" />
            <input epr="jms:queue/esb-tb-fileBankResponseQueue" />
        </service>
        <service model="TrailBlazer.cdm" 
                    role="CreditAgencyParticipant" >
            <input epr="jms:queue/esb-tb-creditAgencyQueue" />
            <output epr="jms:queue/esb-tb-creditAgencyQueue_reply" />
        </service>
        <service model="TrailBlazer.cdm" 
                    role="BankParticipant" >
            <input epr="jms:queue/esb-tb-jmsBankRequestQueue" />
            <input epr="jms:queue/esb-tb-fileBankRequestQueue" />
            <output epr="jms:queue/esb-tb-jmsBankResponseQueue" />
            <output epr="jms:queue/esb-tb-fileBankResponseQueue" />
        </service>
        <service model="TrailBlazer.cdm" 
                    role="NotifierParticipant" >
            <input epr="jms:queue/esb-tb-customerNotifier" />
        </service>
    </validator>
                 

The 'validator' element has an optional attribute called 'mode', with the possible values of 'monitor' or 'manage'. If the mode is 'monitor' (which is the default), then any messages that result in validation errors being detected will continue to be received or sent, with the errors only be reported for information purposes. If the mode is 'manage', then any erronous messages detected during validation, that conflict with the behaviour as described in the choreography, will be prevented from being received or sent.

The optional 'replyToTimeout' (defined in milliseconds) is used to determine how long a dynamic reply-to destination should be monitored for validation purposes. In some message exchanges, the response destination will not always be known in advance. Therefore the configuration can identify such situations, and monitor the reply-to destination for the response. However, if a response is not delivered in a particular time period, we need to be able to discontinue the validation of the dynamic endpoint. If this did not occur, then over time too many endpoints would be monitored, which may result in out-of-memory problems. The default timeout period is 10 seconds.

Within the 'validator' element is a list of 'service' elements, one per service being validated. The behaviour of the service being validated is identified by specifying the model (e.g. choreography description file) and the role (e.g. participant type) within the model. Therefore, within the above configuration, the first set of destinations (eprs) are associated with the LoanBrokerParticipant defined within the choreography description model found in the file TrailBlazer.cdm, which will be located within the models folder contained within the overlord-cdl-validator.esb bundle.

The elements contained within the 'service' element define the input and output eprs (Endpoint References) that are associated with the service. The input eprs are the destinations on which messages will be received and the output eprs are the destinations on which messages will be sent by the service.

The format of the 'epr' attribute will be specific to the type of transport used for the ESB aware destination. Currently only JMS is supported, and can be identified by the protocol prefix 'jms:'.

Each 'input' and 'output' element can also define an optional 'dynamicReplyTo' boolean attribute. If defined, it will indicate to the Service Validator that the message on the specified endpoint (epr) will contain a dynamically defined 'reply-to' destination that needs to be monitored for a response.

The first step to configuring the validator is to associate the endpoint references (EPRs) against the relevant choreography interactions. This is achieved by defining an annotation for each 'exchange details' component (i.e. each request and response/notification).

When the annotation editor is displayed for the relevant 'exchange details' component, the jbossesb annotation should be added. This is achieved by selecting the popup menu associated with the background of the lefthand panel, and selecting the Add Defined Annotation menu item.

When the list of defined annotations is displayed, select the jbossesb annotation.

After pressing the Ok button, the annotation editor will configure the righthand panel with the parameters associated with this annotation.

To specify the EPR for a particular message exchange, enter the EPR into the Destination field. If the exchange is a request, that will result in a response being sent on a dynamically provided "reply-to" destination, then the Dynamic Reply-To checkbox should be selected.

Once the annotation has been defined, then press the Save button to save the annotation against the interaction's exchange details.

When all of the relevant 'exchange details' components have been configured with a jbossesb annotation, defining the EPR to be validated, then the choreography description file can be copied into the overlord-cdl-validator.esb/models folder. This will cause the validation mechanism to derive the configuration information from the choreography description model, and begin validating the defined destinations against that choreography description model.

Once the JBossESB environment has been configured, to perform service validation of a set of ESB services against a choreography description, and the server has been started, then the next step is to launch a tool to view the correlated information from the service validators - and determine if the transactions are being correctly executed.

Within an Eclipse Java project, that contains the choreography description to be monitored, a configuration file called pi4soa.xml needs to be defined on the project's classpath. This file provides details of the JMS configuration parameters required to subscribe for the information generated by the service validators. The contents of this file is:

The destination defined in this file must match the one configured in the pi4soa.sar/pi4soa.xml file within the server.

The next step is to launch the monitoring tool. This is located on the popup menu, for the choreography description (i.e. .cdm) file, by selecting the Choreography->Monitor menu item. Once the tool has been launched, it will load the choreography description, subscribe to the relevant event destination, and then indicate via a message in the bottom status line that it is ready to monitor.

When the information is received, from the service validators representing the different participants (services), it is correlated to show the global status of the business transaction. The list of correlated interactions is show in reverse time order in the image, so in this example a LoanBroker sends a creditCheck message to a CreditAgency, followed by a creditCheckResult being returned.

If any out of sequence or other error situations arise, these are displayed in red.

As well as validating the interactions between a set of services, against a pre-defined choreography description, it is also possible to use the Service Validators in a non-validating record mode.

This will be useful in situations where a choreography description does not currently exist, and we wish to use the stream of business events being sent and received by each identified service (or participant type) to gain an understanding of the current business process.

An example of this type of configuration, associated with the TrailBlazer example, is:



    <validator>
        <service role="LoanBrokerParticipant" validate="false" >
            <output epr="jms:queue/esb-tb-creditAgencyQueue" />
            <input epr="jms:queue/esb-tb-creditAgencyQueue_reply" />
            <output epr="jms:queue/esb-tb-jmsBankRequestQueue" />
            <output epr="jms:queue/esb-tb-fileBankRequestQueue" />
            <input epr="jms:queue/esb-tb-jmsBankResponseQueue" />
            <output epr="jms:queue/esb-tb-customerNotifier" />
            <input epr="jms:queue/esb-tb-fileBankResponseQueue" />
        </service>
        <service role="CreditAgencyParticipant" validate="false" >
            <input epr="jms:queue/esb-tb-creditAgencyQueue" />
            <output epr="jms:queue/esb-tb-creditAgencyQueue_reply" />
        </service>
        <service role="BankParticipant" validate="false" >
            <input epr="jms:queue/esb-tb-jmsBankRequestQueue" />
            <input epr="jms:queue/esb-tb-fileBankRequestQueue" />
            <output epr="jms:queue/esb-tb-jmsBankResponseQueue" />
            <output epr="jms:queue/esb-tb-fileBankResponseQueue" />
        </service>
        <service role="NotifierParticipant" validate="false" >
            <input epr="jms:queue/esb-tb-customerNotifier" />
        </service>
    </validator>
                 

To define a Service Validator in record only mode, the model attribute is not specified (because no choreography description exists to be validated against), and the optional validate attribute should be set to false (by default this attribute is true).