Petals-SE-EIP

Features


This component implements some Enterprise Integration Patterns, as described in http://www.enterpriseintegrationpatterns.com.

The services provided by the EIP components are integration logic functionalities.

The component acts as a proxy, as it receives one or more messages from consumers, and forward them to other services, depending on the integration pattern rule used.

The provided integration patterns are :

  • Aggregator
  • Bridge
  • Dispatcher
  • Router
  • DynamicRouter
  • RoutingSlip
  • ScatterGather
  • WireTap
  • Splitter

Component Configuration

The component can be extended to provide more integration patterns.

To add a new pattern, provide a Java class implementing org.ow2.petals.se.eip.patterns.Pattern :

/**
 * The pattern interface
 *
 * @author Adrien Louis
 * @author Christophe Hamerling
 * @author Frederic Gardes
 */
public interface Pattern {

    /**
     * Initialize the pattern
     *
     */
    void init();

    /**
     * Process the Pattern.
     *
     * @param exchange
     * 		The exchange to process
     * @param context
     * 		The context of the exchange
     */
    boolean processPattern(Exchange exchange, ExchangeContext context);

    /**
     * Process an exchange for an asynchronous pattern.
     *
     * @param exchange
     * 		The exchange to process
     * @param context
     * 		The context of the exchange
     * @param asyncContext
     * 		The EIP asynchronous context
     * @param expired
     * 		true if the asynchronous exchange is expired, false else
     */
    boolean processAsyncPattern(Exchange exchange, ExchangeContext context,
            EIPAsyncContext asyncContext, boolean expired);

    /**
     * Get the pattern name.
     *
     * @return The name
     */
    String getName();
}


Use the ExchangeContext to help you processing your orchestration :

/**
 * The exchange context.
 *
 * @author Adrien Louis
 * @author Frederic Gardes
 */
public interface ExchangeContext {

    /**
     * Get the logger
     *
     * @return the logger
     */
    public Logger getLogger();

    /**
     * get the Consumes for an endpoint
     *
     * @param endpoint
     * 		The endpoint
     * @return The Consumes of the endpoint
     */
    public List<Consumes> getSUConsumes(ServiceEndpoint endpoint);

    /**
     * Send synchronously an exchange. The response will be provided into the
     * same exchange
     *
     * @param exchange
     * 		The exchange to send
     * @return true if the exchange was sent, false else (reached timeout,
     * technical error,...)
     * @throws MessagingException
     */
    public boolean sendSync(final Exchange exchange) throws MessagingException;

    /**
     * Send asynchronously an exchange. The response will be provided as an
     * asynchronous exchange
     *
     * @param exchange
     * 		The exchange to send
     * @param asyncContext
     * 		The asynchronous context, provided on the response
     * @throws MessagingException
     */
    public void sendAsync(final Exchange exchange, AsyncContext asyncContext) throws MessagingException;

    /**
     * Send asynchronously an exchange. The response will be provided as a
     * synchronous exchange
     *
     * @param exchange
     * The exchange to send
     * @throws MessagingException
     */
    public void send(final Exchange exchange) throws MessagingException;

    /**
     * Create an exchange from a Consumes
     *
     * @param consumes
     * 		The Consumes used as JBI Consumer of the exchange
     * @return The exchange created
     * @throws MessagingException
     * @throws PEtALSCDKException
     */
    public Exchange createConsumeExchange(Consumes consumes) throws MessagingException, PEtALSCDKException;

    /**
     * Get the extensions
     *
     * @return The extensions
     */
    public ConfigurationExtensions getExtensions();
}


Extends the JBI.xml file of the component to reference your pattern :

<?xml version="1.0" encoding="UTF-8"?>
<jbi version="1.0"
     xmlns="http://java.sun.com/xml/ns/jbi"
     xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
     xmlns:eip="http://petals.ow2.org/components/eip/version-2">
  <component type="service-engine" component-class-loader-delegation="parent-first">
    <identification>
        <name>petals-se-eip</name>
        <description>EIP Service engine</description>
    </identification>
    <component-class-name>org.ow2.petals.se.eip.EIPComponent</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></path-element>
    </bootstrap-class-path>
    <petalsCDK:acceptor-pool-size>5</petalsCDK:acceptor-pool-size>
    <petalsCDK:processor-pool-size>10</petalsCDK:processor-pool-size>
    <petalsCDK:ignored-status>NOTHING_IGNORED</petalsCDK:ignored-status>
    <petalsCDK:notifications>false</petalsCDK:notifications>
    <petalsCDK:jbi-listener-class-name>org.ow2.petals.se.eip.listener.JBIListener</petalsCDK:jbilistener-class-name>
    <petalsCDK:properties-file />

    <!-- Declaring the supported patterns -->
    <eip:aggregator>org.ow2.petals.se.eip.patterns.Aggregator</eip:aggregator>
    <eip:router>org.ow2.petals.se.eip.patterns.Router</eip:router>
    <eip:dynamic-router>org.ow2.petals.se.eip.patterns.DynamicRouter</eip:dynamic-router>
    <eip:dispatcher>org.ow2.petals.se.eip.patterns.Dispatcher</eip:dispatcher>
    <eip:routing-slip>org.ow2.petals.se.eip.patterns.RoutingSlip</eip:routing-slip>
    <eip:bridge>org.ow2.petals.se.eip.patterns.Bridge</eip:bridge>
    <eip:wire-tap>org.ow2.petals.se.eip.patterns.WireTap</eip:wire-tap>
    <eip:scatter-gather>org.ow2.petals.se.eip.patterns.ScatterGather</eip:scatter-gather>
    <eip:splitter>org.ow2.petals.se.eip.patterns.Splitter</eip:splitter>
  </component>
</jbi>
Unable to render {include} Couldn't find a page to include called: 0 CDK Component Configuration Table


Configuration of the component (EIP)

Parameter Description Default Required
your-pattern-name Name of the java class implementing your pattern. The name of the pattern at runtime will be the one you give as parameter name - No

Service Configuration

Service Unit descriptor

<?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:eip="http://petals.ow2.org/components/eip/version-2"
         xmlns:sample="http://petals.ow2.org/sample">
    <jbi:services binding-component="false">
        <!-- The Provides -->
        <jbi:provides interface-name="sample:interface" service-name="sample:service"
                      endpoint-name="endpoint">
            <petalsCDK:wsdl xsi:nil="true" />
            <eip:eip>pattern</eip:eip>
        </jbi:provides>
        <!-- The first Consumes -->
        <jbi:consumes interface-name="sample:calledInterface1" service-name="sample:calledService1"
                      endpoint-name="calledEndpoint1">
            <petalsCDK:mep xsi:nil="true" />
        </jbi:consumes>
        <!-- The second Consumes -->
        <jbi:consumes interface-name="sample:calledInterface2" service-name="sample:calledService2"
                      endpoint-name="calledEndpoint2">
            <petalsCDK:mep xsi:nil="true" />
        </jbi:consumes>
    </jbi:services>
</jbi:jbi>


Unable to render {include} Couldn't find a page to include called: 0 CDK Description of provide
 

Unable to render {include} Couldn't find a page to include called: 0 CDK Description of consume


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

Processing a pattern

A Service Unit contains one and only one Provides section, which describes the pattern that will be processed when a message is received.

The Service Unit contains also one or more consumes sections, which reference services to call during the pattern execution. The order of the consumes sections is important, as it is the one which is used by the pattern during its execution.

The number of consumes sections depends on the pattern implemented.

If the MEP InOut or InOptionalOut are supported by an implemented EIP, the component returns to the consumer an
OUT response built according to the pattern feature.
If the MEP InOut or InOptionalOut are supported by an implemented EIP, the component returns to the consumer an OUT response built according to the pattern feature.

If an invoked service returns a Fault or an Error status, the process ends or no, and the Fault or the Error is sent back to the consumer or no, according to the pattern feature.

An operation must be specified in the consumes sections. This operation is used to invoke the bound service.

Aggregator Pattern

Enterprise Integration Pattern

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.