|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (26)
View Page History throws MessagingException {
[...]
[...]
jbiListener.sendASync(anotherExchange);
MyAsyncContext myAsyncContext = new MyAsyncContext(...);
[...]
jbiListener.sendASync(anotherExchange, myAsyncContext);
[...]
[...]
return true; false;
}
public boolean onAsyncExchange(Exchange exchange, subExchange, AsyncContext asyncContext)
throws MessagingException {
[...]
[...]
jbiListener.sendASync(anotherExchange);
Exchange originalExchange = asyncContext.getOriginalExchange();
[...]
jbiListener.send(originalExchange);
[...]
[...]
return true;
}
}
Processing a service in asynchronous way is the best approach when targeting performance, but it's more tedious to develop, and demands an average level in Petals development.
Basically, all is in the data that permit to correlate asynchronous sent exchange and their asynchronous response.
Basically, all is in the data that permit to correlate asynchronous sent exchange and their asynchronous response.
The original exchange is the received by the component and the process of the service start in the {{onExchange(Exchange exchange)}} method.
The method create an asynchronous context, to set the data.
The method can create any 'sub-exchange' and send then asynchronously, with the asynchronous context as parameter.
Then the {{onExchange(Exchange exchange)}} returns {{false}}, as the response or the acknowledgment of the original exchange is not yet ready to be sent back.
Any asynchronous reponse from the 'sub-exchange' comes bask in the {{onAsyncExchange(Exchange subExchange, AsyncContext asyncContext)}} method. During the process of this method, the sub-exchange must be handled according the MEP, and the returns {{true}} of the method let the CDK send the 'sub-exchange' to the partner.
Once all 'sub-exchanges' are received, the 'original' exchange can be retrieve from the asynchronous context and the response or acknowledgement send back explicitly.
The method create an asynchronous context, to set the data.
The method can create any 'sub-exchange' and send then asynchronously, with the asynchronous context as parameter.
Then the {{onExchange(Exchange exchange)}} returns {{false}}, as the response or the acknowledgment of the original exchange is not yet ready to be sent back.
Any asynchronous reponse from the 'sub-exchange' comes bask in the {{onAsyncExchange(Exchange subExchange, AsyncContext asyncContext)}} method. During the process of this method, the sub-exchange must be handled according the MEP, and the returns {{true}} of the method let the CDK send the 'sub-exchange' to the partner.
Once all 'sub-exchanges' are received, the 'original' exchange can be retrieve from the asynchronous context and the response or acknowledgement send back explicitly.
h2. Service Configuration
{center}{*}Configuration of a Service Unit to provide a service (JBI)*{center}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
|| {color:#333333}Parameter{color} || {color:#333333}Description{color}\\ || {color:#333333}Default{color}\\ || {color:#333333}Required{color}\\ ||
| provides | Describe the JBI service that will be exposed into the JBI bus. Interface (QName), Service (QName) and Endpoint (String) attributes are required. | \- | Yes |
\\
{center}{*}Configuration of a Service Unit to provide a service (CDK)*{center}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
|| {color:#333333}Parameter{color} || {color:#333333}Description{color}\\ || {color:#333333}Default{color}\\ || {color:#333333}Required{color}\\ ||
| 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. | 0 | 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 |
| wsdl-imports-download | If false, the external imports declared in the service WSDL won't be downloaded, so they won't be replaced by their content. | true | No |
| org.ow2.petals.messaging.provider.noack | Check PEtALS container document for further details. This propety activates the bypass of acknowledgment messages destinated to this SU. | \- | No |
{table-plus}
{petalslink}{include:0 CDK SU Provide Configuration}{petalslink}
\\
{center}{*}Configuration of a Service Unit to provide a service (POJO)*{center}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
|| Parameter \\ || Description || Default value || Required ||
| class-name \\ | The name of the Java class to expose as a service. \\ | \- \\ | Yes \\ |
{table-plus}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
|| {color:#333333}Parameter{color} || {color:#333333}Description{color}\\ || {color:#333333}Default{color}\\ || {color:#333333}Required{color}\\ ||
| provides | Describe the JBI service that will be exposed into the JBI bus. Interface (QName), Service (QName) and Endpoint (String) attributes are required. | \- | Yes |
\\
{center}{*}Configuration of a Service Unit to provide a service (CDK)*{center}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
|| {color:#333333}Parameter{color} || {color:#333333}Description{color}\\ || {color:#333333}Default{color}\\ || {color:#333333}Required{color}\\ ||
| 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. | 0 | 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 |
| wsdl-imports-download | If false, the external imports declared in the service WSDL won't be downloaded, so they won't be replaced by their content. | true | No |
| org.ow2.petals.messaging.provider.noack | Check PEtALS container document for further details. This propety activates the bypass of acknowledgment messages destinated to this SU. | \- | No |
{table-plus}
{petalslink}{include:0 CDK SU Provide Configuration}{petalslink}
\\
{center}{*}Configuration of a Service Unit to provide a service (POJO)*{center}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
|| Parameter \\ || Description || Default value || Required ||
| class-name \\ | The name of the Java class to expose as a service. \\ | \- \\ | Yes \\ |
{table-plus}
h3. Service Unit descriptor
The POJO class(es) and their depending libraries must be set in JAR(s) file(s) at the root directory of the POJO Service
Unit package.
Unit package.
The POJO JBI descriptor must contain a {{pProvides}} section for each POJO to expose in the JBI bus. For each provides
section, the name of the POJO class must be filled.
Here is an example:
Here is an example:
AN example of the POJO SU:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
{code}
{include:0 CDK SU Provide Configuration}
\\
{table-plus}
|| Parameter || Description || Default || Required ||
| class-name | The name of the Java class to expose as a service. | {center}\-{center} | {center}Yes{center} |
{table-plus}
\\
{table-plus}
|| Parameter || Description || Default || Required ||
| class-name | The name of the Java class to expose as a service. | {center}\-{center} | {center}Yes{center} |
{table-plus}
{include:0 CDK SU Interceptor configuration}
h3. Service Unit content
The POJO class(es) and their depending libraries must be set as JAR(s) file(s) at the root directory of the POJO Service
Unit package.
Unit package.
The Service Unit has to must contain the following elements, packaged in an ZIP archive:
* The META-INF/jbi.xml descriptor file, has described above.
* At least one jar containing the POJO class to expose
* At least one jar containing the POJO class to expose
service-unit.zip
+ META-INF
+ META-INF
- jbi.xml (as defined above)
- mypojoclasses.jar
- mypojoclasses.jar
{code}
h1. Component Configuration
The following attributes can be set during the installation phase to configure the component, using the params element of the jbi-install-component ANT task:
{include:0 CDK Component Configuration Table 2.1}
{include:0 CDK Parameter scope}
{include:0 CDK Component Interceptor configuration}
{include:0 CDK Parameter scope}
{include:0 CDK Component Interceptor configuration}
{center}{*}Configuration of the component (CDK)*{center}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;",style="text-align:center;"}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
|| {color:#333333}Parameter{color} || {color:#333333}Description{color} || {color:#333333}Default{color} || {color:#333333}Required{color} || {color:#333333}Required{color} ||
| 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 |
| 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 |
| ignored-status | When the component receives an acknowledgement message exchange, it can skip the processing of these message according to the type of the acknowledgment. If you decide to not ignore some acknowledgement, the component listeners must take care of them. \\
\\
Accepted values : DONE_AND_ERROR_IGNORED, DONE_IGNORED, ERROR_IGNORED or NOTHING_IGNORED | DONE_AND_ERROR_IGNORED | Yes | Component |
| 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 value of this parameter is :
* an URL
* a file relative to the PEtALS installation path
* an empty value to stipulate a non-using file | \- | No | Installation |
| external-listener-class-name | Qualified name of the class extending *AbstractExternalListener*
{note}Only for Binding Components{note} | \- | No | Component |
| jbi-listener-class-name | Qualified name of the class extending *AbstractJBIListener* | \- | Yes | Component |
| performance-notifications | Enable the performance notifications in the component. The CDK proposes to a performance notification feature to the component implementor. If you enable this feature, you must use the related \\
method accessible in the {{AbstractComponent}} class. | \- | No | Runtime |
| performance-step | When the performance notification feature is enabled, it is possible to define a step on the notifications. When there is an heavy message traffic, it is recommanded to increase this step to \\
avoid performance disturbance. | \- | No | Runtime |
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{petalslink}{include:0 CDK Component Configuration Table}{petalslink}
*Definition of CDK parameter scope :*
* *Component :* The parameter has been defined during the development of the component. A user of the component can not change its value.
* *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.
{petalslink}{include:0 CDK Parameter scope}{petalslink}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;",style="text-align:center;"}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
|| {color:#333333}Parameter{color} || {color:#333333}Description{color} || {color:#333333}Default{color} || {color:#333333}Required{color} || {color:#333333}Required{color} ||
| 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 |
| 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 |
| ignored-status | When the component receives an acknowledgement message exchange, it can skip the processing of these message according to the type of the acknowledgment. If you decide to not ignore some acknowledgement, the component listeners must take care of them. \\
\\
Accepted values : DONE_AND_ERROR_IGNORED, DONE_IGNORED, ERROR_IGNORED or NOTHING_IGNORED | DONE_AND_ERROR_IGNORED | Yes | Component |
| 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 value of this parameter is :
* an URL
* a file relative to the PEtALS installation path
* an empty value to stipulate a non-using file | \- | No | Installation |
| external-listener-class-name | Qualified name of the class extending *AbstractExternalListener*
{note}Only for Binding Components{note} | \- | No | Component |
| jbi-listener-class-name | Qualified name of the class extending *AbstractJBIListener* | \- | Yes | Component |
| performance-notifications | Enable the performance notifications in the component. The CDK proposes to a performance notification feature to the component implementor. If you enable this feature, you must use the related \\
method accessible in the {{AbstractComponent}} class. | \- | No | Runtime |
| performance-step | When the performance notification feature is enabled, it is possible to define a step on the notifications. When there is an heavy message traffic, it is recommanded to increase this step to \\
avoid performance disturbance. | \- | No | Runtime |
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{table-plus}
{petalslink}{include:0 CDK Component Configuration Table}{petalslink}
*Definition of CDK parameter scope :*
* *Component :* The parameter has been defined during the development of the component. A user of the component can not change its value.
* *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.
{petalslink}{include:0 CDK Parameter scope}{petalslink}
{column}
{column:width=25%}
{column:width=25%}