Petals-SE-Validation 1.5.0+

This version must be installed on Petals ESB 5.0.0+

Features

The Validation Service-Engine allows to validate and filter Petals messages against an XML Schema.

Each configuration of this component embeds an XML Schema (made up of one or several XSD files).
When such a configuration (i.e. service, i.e. service-unit) is called, it validates the received message against the XML Schema.
Depending on the called operation, the returned message is either a boolean (validate operation) or the received message or a fault (filter operation).
filter and validate are the only operations this component supports.

This component only acts as service provider, not as a service consumer.
In fact, it provides a validation / filtering service (the filtering relies on the validity of the message against the XML Schema).

Validation Component overview

Recommended usage

The Validation component may be used before calling a critical service.
It allows to make sure the message to send has the right shape.
For some services, this can be useless. For some others though, it can be critical to perform this check.

A typical example

One typical example would be a service converting the received message as data and manipulating it then (e.g. to insert it into a database).
In Petals ESB, that would concern the Petals-BC-SQL component or even the Petals-SE-Talend component.
Notice that this last one has a built-in feature to validate received messages against the job's WSDL.

Another example could be a service that accesses an EJB.
The received message is mapped to a Java object that is about to be manipulated in a JEE container.
Making sure the sent message is valid may prevent errors from occurring later in the processing.

In a perfect SOA world, this component would be useless.
Every service would have a WSDL, and every service consumer would rely on this WSDL to send a message.
But this is only good practices. It happens that service consumers do not send the perfect messages.

It can be the case with integration use cases (e.g. with an EIP - Enterprise Integration Pattern - or a POJO that consumes a service by generating dynamically the message to send).
Before calling this service, you might want to ensure the validity of the built message. An this is where you will use the Validation component.

Roughly, the principle looks like

if( validationService.validate( MSG )) {
criticalService.criticalOperation( MSG );
}
else {
log( "The message was invalid." );
}

Validation and chaining services

Following our previous algorithm, it appears that validating or filtering a message only makes sense if this message is going to be sent to another service.
That supposes that there is a chaining service, that will first call the validation service, and then call the real target service.

  1. Message from the chaining service to the validation / filtering service.
  2. Response from the validation / filtering service to the chaining service (the MEP is InOut, always, no matter what the operation is).
  3. Message from the chaining service to the real target service.
  4. Optional response, depending on the MEP for the second service.

This chaining service can be implemented by a POJO (an home made Java Class) or an Enterprise Integration Pattern (EIP).
It could also be implemented by a BPEL process, but this latter needs that the WSDL proposed by the Validation component is correct and completed.
Note that BPEL can validate by itself the message during its processing, so it may be useless to use the Validation component in some cases.

Limitations

The validated / filtered content is always the payload from the input message.
Do not mistake XML-validation services for interceptors.

Neither to validate attached, nor to intercept and validate messages on the fly.
Interceptors would better fit this kind of use case.

Contributors
No contributors found for: authors on selected page(s)

Creating a XML Validation service (Provides mode)

Each Validation service runs on the Petals Validation component.
The Petals Validation component has native operations to invoke. These operations are inherited by the Validation services.
A Validation service cannot add additional operations. It only has the ones of the XSLT component.

The version 1.1 of the Petals Validation component exposes two operations.

  • validate: the received message is validated against a XML-Schema. The service returns a boolean response indicating if the message is valid.
  • filter: the received message is validated against a XML-Schema. If the message is valid, this same message is returned. Otherwise, a fault is raised.

The "validate" operation

The fully qualified name of this operation is:

  • Name space URI: *http://petals.ow2.org/components/validation/version-1*
  • Local part: validate


This operation only supports the InOut message exchange pattern (MEP).
When invoking this operation, you must call it using its fully qualified name.


Here is the execution flow for this operation:

  1. The received message is validated against the XML-Schema embedded by the service.
  2. The validation response is wrapped into a message and sent back.


More precisely, if the message is valid, the returned message is

<!-- The target name space depends on the version of the Validation component -->
<tns:validateResponse xmlns:tns='http://petals.ow2.org/components/validation/version-1'>
     <tns:valid>true</tns:valid>
</tns:validateResponse>


Otherwise, it is

<!-- The target name space depends on the version of the Validation component -->
<tns:validateResponse xmlns:tns='http://petals.ow2.org/components/validation/version-1'>
     <tns:valid>false</tns:valid>
     <tns:comment>The reason explaining why it is invalid.</tns:comment>
</tns:validateResponse>

The "filter" operation

The fully qualified name of this operation is:

  • Name space URI: *http://petals.ow2.org/components/validation/version-1*
  • Local part: filter


This operation only supports the InOut message exchange pattern (MEP).
When invoking this operation, you must call it using its fully qualified name.


Here is the execution flow for this operation:

  1. The received message is validated against the XML-Schema embedded by the service.
  2. If the message is valid, this same message is sent back. Otherwise, a fault is raised.


<!-- The target name space depends on the version of the Validation component -->
<tns:validationFault xmlns:tns='http://petals.ow2.org/components/validation/version-1'>
     <tns:message>The fault message.</tns:message>
<tns:validationFault>


If the operation is invalid (i.e. is neither validate, nor filter), then filter is the operation by default.

WSDL definitions

By default, services deployed on the Validation component do not need a WSDL.
However, as a good practice, it is better to provide it one.

The operations are known.
The only unknown is whether the input messages will be anyType or the exact top element of the XML Schema.
It is let to the choice of the user.

The output message for the operation filter should however be described by the XML Schema.

JBI descriptor

The Service Unit descriptor file ( jbi.xml ) looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jbi="http://java.sun.com/xml/ns/jbi"
	xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
	xmlns:validation="http://petals.ow2.org/components/validation/version-1"
	xmlns:serviceNs="http://petals.ow2.org/simpletransformation">

 <jbi:services binding-component="false">
	<jbi:provides
		interface-name="serviceNs:ValidationInterface"
		service-name="serviceNs:ValidationService"
		endpoint-name="ValidationEndpoint">

   <!-- WSDL file -->
   <petalsCDK:wsdl>your optional description wsdl file.wsdl</petalsCDK:wsdl>

   <!-- Validation specific fields -->
   <validation:schema>schema.xsd</validation:schema>
  </jbi:provides>
 </jbi:services>
</jbi:jbi>


A JBI descriptor for an Validation service-unit can only define one provides block.


Configuration of a Service Unit to provide a service (JBI)

Parameter Description
Default
Required
provides Describe the JBI service that will be exposed into the JBI bus. Interface (QName), Service (QName) and Endpoint (String) attributes are required. - Yes

Configuration of a Service Unit to provide a service (CDK)

Parameter Description
Default
Required
timeout Timeout in milliseconds of a synchronous send. This parameter is used by the method sendSync (Exchange exchange) proposes by the CDK Listeners classes.
Set it to 0 for an infinite timeout.
30000 No
exchange-properties This sections defines the list of properties to set to the JBI exchange when processing a service. - No
message-properties This sections defines the list of properties to set to the JBI message when processing a service. - No
validate-wsdl Activate the validation of the WSDL when deploying a service unit. true No
wsdl
Path to the WSDL document describing services and operations exposed by the provided JBI endpoints defined in the SU.
The value of this parameter is :
  • an URL
  • a file relative to the root of the SU package
    If not specified, a basic WSDL description is automaticaly provided by the CDK.
- No
forward-attachments
Defines if attachment will be forwarded from IN message to OUT message.
false No
forward-message-properties
Defines if the message properties will be forwarded from IN message to OUT message. false No
forward-security-subject
Defines if the security subject will be forwarded from IN message to OUT message. false No


Configuration of a Service Unit to provide a service (Validation)

Parameter Description Default Required
schema Location of the XSD schema. This path must be a relative path from the root of the SU package.
-
Yes

Interceptor

Example of an interceptor configuration:

<?xml version="1.0" encoding="UTF-8"?>
<!--...-->
<petalsCDK:su-interceptors>
  <petalsCDK:send>
    <petalsCDK:interceptor name="myInterceptorName">
      <petalsCDK:param name="myParamName">myParamValue</petalsCDK:param>
      <petalsCDK:param name="myParamName2">myParamValue2</petalsCDK:param>
    </petalsCDK:interceptor>
  </petalsCDK:send>
  <petalsCDK:accept>
    <petalsCDK:interceptor name="myInterceptorName">
      <petalsCDK:param name="myParamName">myParamValue</petalsCDK:param>
    </petalsCDK:interceptor>
  </petalsCDK:accept>
  <petalsCDK:send-response>
    <petalsCDK:Interceptor name="myInterceptorName">
      <petalsCDK:param name="myParamName">myParamValue</petalsCDK:param>
    </petalsCDK:Interceptor>
  </petalsCDK:send-response>
  <petalsCDK:accept-response>
    <petalsCDK:Interceptor name="myInterceptorName">
      <petalsCDK:param name="myParamName">myParamValue</petalsCDK:param>
    </petalsCDK:Interceptor>
  </petalsCDK:accept-response>
</petalsCDK:su-interceptors>
<!--...-->

Interceptors configuration for SU (CDK)

Parameter Description Default Required
send Interceptor dedicated to send phase, for an exchange sent by a consumer - No
accept Interceptor dedicated to receive phase, for an exchange received by a provider - No
send-response Interceptor dedicated to send phase, for an exchange (a response) received by a consumer - No
accept-response Interceptor dedicated to receive phase, for an exchange sent (a response) by a provider - No
interceptor - name Logical name of the interceptor instance. It can be referenced to add extended parameters by a SU Interceptor configuration. - Yes
param[] - name The name of the parameter to use for the interceptor for this SU - No
param[] The value of the parameter to use for the interceptor for this SU - No

Service-Unit content

The service unit must contain the XML Schema and the JBI descriptor (jbi.xml file).
It is also highly recommended to provide a WSDL description for this service (though it is optional).
This WSDL is not mandatory, but not providing it will prevent your service from interacting with other Petals services and components.


The directory structure of a SU for the Petals-SE-Validation looks like this:

su-xslt-TransformationName-provide.zip
   + META-INF
     - jbi.xml
   + XsltService.wsdl (recommended)
   + myfile.xsd (required)
   + myfile2.xsd (required if myfile2.xsd is imported in myfile.xsd)

Configuring the component

The component can be configured through its JBI descriptor file, as shown below.

<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<jbi version="1.0"
	xmlns='http://java.sun.com/xml/ns/jbi'
	xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
	xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5">

	<component type="service-engine">
		<identification>
			<name>petals-se-validation</name>
			<description>A VALIDATION Service Engine</description>
		</identification>

		<component-class-name description="Validation Component class">org.ow2.petals.se.validation.ValidationComponent</component-class-name>
		<component-class-path><path-element/></component-class-path>
		<bootstrap-class-name>org.ow2.petals.component.framework.DefaultBootstrap</bootstrap-class-name>
		<bootstrap-class-path><path-element/></bootstrap-class-path>

		<petalsCDK:acceptor-pool-size>3</petalsCDK:acceptor-pool-size>
		<petalsCDK:processor-pool-size>10</petalsCDK:processor-pool-size>
		<petalsCDK:ignored-status>DONE_AND_ERROR_IGNORED</petalsCDK:ignored-status>
		<petalsCDK:notifications>false</petalsCDK:notifications>
		<petalsCDK:jbi-listener-class-name>org.ow2.petals.se.validation.listener.JBIListener</petalsCDK:jbi-listener-class-name>
	</component>
</jbi>


The component configuration includes the configuration of the CDK. The following parameters correspond to the CDK configuration.

Configuration of the component, CDK part

Parameter Description Default Required Scope
acceptor-pool-size The size of the thread pool used to accept Message Exchanges from the NMR. Once a message is accepted, its processing is delegated to the processor pool thread.
3

Yes

Runtime

acceptor-retry-number Number of tries to submit a message exchange to a processor for processing before to declare that it cannot be processed.
40

No

Installation

acceptor-retry-wait Base duration, in milliseconds, to wait between two processing submission tries. At each try, the new duration is the previous one added by this base duration multiplied by the try number plus a random value between 0 and 10.
250

No

Installation

acceptor-stop-max-wait The max duration (in milliseconds) of the stop of an acceptor before to force it to stop.
500

No

Runtime

message-processor-max-pool-size Max size of the object pool containing message exchange processors.
processor-max-pool-size

No

Runtime

processor-pool-size The size of the thread pool used to process Message Exchanges. Once a message is accepted, its processing is delegated to one of the thread of this pool.
10
Yes

Runtime
processor-max-pool-size The maximum size of the thread pool used to process Message Exchanges. The difference between this size and the processor-pool-size represents the dynamic threads that can be created and destroyed during overhead processing time.
50

No
Runtime

processor-keep-alive-time When the number of processors is greater than the core, this is the maximum time that excess idle processors will wait for new tasks before terminating, in seconds.
300

No
Runtime

processor-stop-max-wait The max duration (in milliseconds) of message exchange processing on stop phase.
15000

No
Runtime

time-beetween-async-cleaner-runs The time (in milliseconds) between two runs of the asynchronous message exchange cleaner.
2000

No
Installation

properties-file Name of the file containing properties used as reference by other parameters. Parameters reference the property name in the following pattern ${myPropertyName}. At runtime, the expression is replaced by the value of the property.

The properties file can be reloaded using the JMX API of the component. The runtime configuration MBean provides an operation to reload these place holders. Check the service unit parameters that support this reloading.

The value of this parameter is :
  • an URL
  • a file relative to the PEtALS installation path
  • an absolute file path
  • an empty value to stipulate a non-using file.
-
No
Installation
monitoring-sampling-period Period, in seconds, of a sample used by response time probes of the monitoring feature.
300

No
Installation

Definition of CDK parameter scope :

  • Installation: The parameter can be set during the installation of the component, by using the installation MBean (see JBI specifications for details about the installation sequence). If the parameter is optional and has not been defined during the development of the component, it is not available at installation time.
  • Runtime: The paramater can be set during the installation of the component and during runtime. The runtime configuration can be changed using the CDK custom MBean named RuntimeConfiguration. If the parameter is optional and has not been defined during the development of the component, it is not available at installation and runtime times.

Interceptor

Interceptors can be defined to inject some post or pre processing in the component during service processing.

Using interceptor is very sensitive and must be manipulate only by power users. An non properly coded interceptor engaged in a component can lead to uncontrolled behaviors, out of the standard process.

Example of an interceptor configuration:

<?xml version="1.0" encoding="UTF-8"?>
<!--...-->
<petalsCDK:component-interceptors>
  <petalsCDK:interceptor active="true" class="org.ow2.petals.myInterceptor" name="myInterceptorName">
    <petalsCDK:param name="myParamName">myParamValue</petalsCDK:param>
    <petalsCDK:param name="myParamName2">myParamValue2</petalsCDK:param>
  </petalsCDK:interceptor>
</petalsCDK:component-interceptors>
<!--...-->

Interceptors configuration for Component (CDK)

Parameter Description Default Required
interceptor - class Name of the interceptor class to implement. This class must extend the abstract class org.ow2.petals.component.common.interceptor.Interceptor. This class must be loadable from the component classloader, or in a dependent Shared Library classloader. - Yes
interceptor - name Logical name of the interceptor instance. It can be referenced to add extended parameters by a SU Interceptor configuration. - Yes
interceptor - active If true, the Interceptor instance is activated for every SU deployed on the component.
If false, the Interceptor can be activated:
-by the InterceptorManager Mbean at runtime, to activate the interceptor for every deployed SU.
-by a SU configuration
- Yes
param[] - name The name of the parameter to use for the interceptor. - No
param[] The value of the parameter to use for the interceptor. - No


This component does not have any specific configuration parameter.

Monitoring the component

In this documentation, the term "Allocated threads" must be understood as "Active threads", see PETALSDISTRIB-37. This naming error will be fixed in the next version.

Using metrics

Several probes providing metrics are included in the component, and are available through the JMX MBean 'org.ow2.petals:type=custom,name=monitoring_<component-id>', where <component-id> is the unique JBI identifier of the component.

Common metrics

The following metrics are provided through the Petals CDK, and are common to all components:

Metrics, as MBean attribute Description Detail of the value Configurable
MessageExchangeAcceptorThreadPoolMaxSize The maximum number of threads of the message exchange acceptor thread pool integer value, since the last startup of the component yes, through acceptor-pool-size
MessageExchangeAcceptorThreadPoolCurrentSize The current number of threads of the message exchange acceptor thread pool. Should be always equals to MessageExchangeAcceptorThreadPoolMaxSize. instant integer value no
MessageExchangeAcceptorCurrentWorking The current number of working message exchange acceptors. instant long value no
MessageExchangeAcceptorMaxWorking The max number of working message exchange acceptors. long value, since the last startup of the component no
MessageExchangeAcceptorAbsoluteDurations The aggregated durations of the working message exchange acceptors since the last startup of the component. n-tuple value containing, in nanosecond:
  • the maximum duration,
  • the average duration,
  • the minimum duration.
no
MessageExchangeAcceptorRelativeDurations The aggregated durations of the working message exchange acceptors on the last sample. n-tuple value containing, in nanosecond:
  • the maximum duration,
  • the average duration,
  • the minimum duration,
  • the 10-percentile duration (10% of the durations are lesser than this value),
  • the 50-percentile duration (50% of the durations are lesser than this value),
  • the 90-percentile duration (90% of the durations are upper than this value).
no
MessageExchangeProcessorObjectPoolBorrowedObjectsCurrent The current number of borrowed object of the message exchange processor object pool instant integer value no
MessageExchangeProcessorObjectPoolBorrowedObjectsMax The maximum number of object of the message exchange processor object pool that was borrowed integer value, since the last startup of the component no
MessageExchangeProcessorObjectPoolIdleObjectsCurrent The current number of idel object of the message exchange processor object pool instant integer value no
MessageExchangeProcessorObjectPoolIdleObjectsMax The maximum number of object of the message exchange processor object pool that was idle integer value, since the last startup of the component no
MessageExchangeProcessorObjectPoolMaxSize The maximum size, in objects, of the message exchange processor object pool instant integer value yes, through processor-max-pool-size
MessageExchangeProcessorObjectPoolMinIdleSize The minimum size, in objects (in state idle), of the message exchange processor object pool instant integer value yes, through processor-pool-size
MessageExchangeProcessorObjectPoolExhaustion The number of message exchange processor object pool exhaustions integer counter value, since the last startup of the component no
MessageExchangeProcessorThreadPoolAllocatedThreadsCurrent The current number of allocated threads of the message exchange processor thread pool instant integer value no
MessageExchangeProcessorThreadPoolAllocatedThreadsMax The maximum number of threads of the message exchange processor thread pool that was allocated integer value, since the last startup of the component no
MessageExchangeProcessorThreadPoolIdleThreadsCurrent The current number of idle threads of the message exchange processor thread pool instant integer value no
MessageExchangeProcessorThreadPoolIdleThreadsMax The maximum number of threads of the message exchange processor thread pool that was idle integer value, since the last startup of the component no
MessageExchangeProcessorThreadPoolMaxSize The maximum size, in threads, of the message exchange processor thread pool instant integer value yes, through http-thread-pool-size-max
MessageExchangeProcessorThreadPoolMinSize The minimum size, in threads, of the message exchange processor thread pool instant integer value yes, through http-thread-pool-size-min
MessageExchangeProcessorThreadPoolQueuedRequestsCurrent The current number of enqueued requests waiting to be processed by the message exchange processor thread pool instant integer value no
MessageExchangeProcessorThreadPoolQueuedRequestsMax The maximum number of enqueued requests waiting to be processed by the message exchange processor thread pool that was allocated since the last startup of the component instant integer value no
ServiceProviderInvokations The number of service provider invokations grouped by:
  • interface name, as QName, the invoked service provider,
  • service name, as QName, the invoked service provider,
  • invoked operation, as QName,
  • message exchange pattern,
  • and execution status (PENDING, ERROR, FAULT, SUCCEEDED).
integer counter value since the last startup of the component no
ServiceProviderInvokationsResponseTimeAbs The aggregated response times of the service provider invokations since the last startup of the component grouped by:
  • interface name, as QName, the invoked service provider,
  • service name, as QName, the invoked service provider,
  • invoked operation, as QName,
  • message exchange pattern,
  • and execution status (PENDING, ERROR, FAULT, SUCCEEDED).
n-tuple value containing, in millisecond:
  • the maximum response time,
  • the average response time,
  • the minimum response time.
no
ServiceProviderInvokationsResponseTimeRel The aggregated response times of the service provider invokations on the last sample, grouped by:
  • interface name, as QName, the invoked service provider,
  • service name, as QName, the invoked service provider,
  • invoked operation, as QName,
  • message exchange pattern,
  • and execution status (PENDING, ERROR, FAULT, SUCCEEDED).
n-tuple value containing, in millisecond:
  • the maximum response time,
  • the average response time,
  • the minimum response time,
  • the 10-percentile response time (10% of the response times are lesser than this value),
  • the 50-percentile response time (50% of the response times are lesser than this value),
  • the 90-percentile response time (90% of the response times are upper than this value).
no

Dedicated metrics

No dedicated metric is available.

Receiving alerts

Several alerts are notified by the component through notification of the JMX MBean 'org.ow2.petals:type=custom,name=monitoring_<component-id>', where <component-id> is the unique JBI identifier of the component.

To integrate these alerts with Nagios, see Receiving Petals ESB defects in Nagios.

Common alerts

Defect JMX Notification
A message exchange acceptor thread is dead
  • type: org.ow2.petals.component.framework.process.message.acceptor.pool.thread.dead
  • no user data
No more thread is available in the message exchange acceptor thread pool
  • type: org.ow2.petals.component.framework.process.message.acceptor.pool.exhausted
  • no user data
No more message exchange processor is available in the message exchange processor pool
  • type: org.ow2.petals.component.framework.process.message.processor.object.pool.exhausted
  • no user data
No more thread is available to run a message exchange processor
  • type: org.ow2.petals.component.framework.process.message.processor.thread.pool.exhausted
  • no user data

Dedicated alerts

No dedicated alert is available.

Labels

1-1 1-1 Delete
components components Delete
validation validation Delete
se se Delete
components-se-family components-se-family Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.