Fork me on GitHub

Configuring the Processing Pattern

The Processing Pattern is configured using Coherence Cache Configuration files with the addition of the following namespace:

<cache-config xmlns:processing="class:com.oracle.coherence.patterns.processing.config.xml.ProcessingPatternNamespaceHandler">

Configuration typically occurs using either Out-Of-The-Box Configurations or through explicit declarations based on the Processing Pattern Namespace

Out-Of-The-Box Configurations

Included in the processing pattern are a number of ready made, out-of-the-box configurations for different types of Coherence Members. These configurations can be used in two approaches:

  • Introducing configuration files into existing configuration files using the element:introduce-cache-config feature.

  • Directly specifying a Processing Pattern configuration file, using -Dtangosol.coherence.cacheconfig=<config file>

Default Processing Cluster Member Configuration

The configuration file coherence-processingpattern-cluster-processing-config.xml as provided in the distribution defines a full fledged Processing Pattern Cluster Member that is configured with the following features:

  • A LoggingDispatcher

  • A LocalExecutorDispatcher

  • A TaskDispatcher with a TaskDispatchPolicy configured as an attribute matching and round robin policy.

  • A default GRID-based TaskProcessor (one for each Storage Enabled member) with a thread pool size of 10.

Below follows the relevant parts of the configuration:

<cache-config xmlns:processing="class:com.oracle.coherence.patterns.processing.config.xml.ProcessingPatternNamespaceHandler">

    ...

    <processing:cluster-config pof="true">
        <processing:dispatchers>
            <processing:logging-dispatcher displayname="Logging Dispatcher" />

            <processing:task-dispatcher displayname="Task Dispatcher">
                <processing:composite-policy>
                    <processing:attribute-match-policy />
                    <processing:round-robin-policy />
                </processing:composite-policy>
            </processing:task-dispatcher>

            <processing:local-executor-dispatcher displayname="Local Dispatcher" />
        </processing:dispatchers>

        <processing:taskprocessors>
            <processing:taskprocessordefinition id="GridTaskProcessor"
                                                displayname="Grid Task Processor"
                                                type="GRID">

                <processing:default-taskprocessor id="GridTaskProcessor"
                                                  threadpoolsize="10" />

                <processing:attribute name="type">grid</processing:attribute>
            </processing:taskprocessordefinition>
        </processing:taskprocessors>
    </processing:cluster-config>

    ...

</cache-config>

Configuring Processing Clients

A Coherence Cluster Member that shall be used as a pure client to the Processing Pattern must disable local storage in order to operate correctly. eg: Using the command line parameter:

-Dtangosol.coherence.distributed.localstorage=false

The configuration file coherence-processingpattern-cluster-client-config.xml as provided with the distribution is essentially defined as follows:

<cache-config xmlns:processing="class:com.oracle.coherence.patterns.processing.config.xml.ProcessingPatternNamespaceHandler">
    <processing:cluster-config pof="true"/>
</cache-config>

Configuring Coherence *Extend Clients (without local Task Processing capabilities)

In prior releases the elements were used to help configure the extend client for the processing pattern. These elements are no longer supported in INC-12. The extend client for the processing pattern can be defined using the standard Coherence cache configuration elements.

The configuration file coherence-processingpattern-extend-client-config.xml as provided with the distribution defines a Coherence *Extend-based Client.

The relevant parts of the included configuration are as follows:

xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd">

   <caching-scheme-mapping>
     <cache-mapping>
       <cache-name>coherence.patterns.processing.*</cache-name>
       <scheme-name>extend-dist</scheme-name>
     </cache-mapping>
   </caching-scheme-mapping>

   <caching-schemes>
     <remote-cache-scheme>
       <scheme-name>extend-dist</scheme-name>
         <initiator-config>
            <tcp-initiator>
                <remote-addresses>
                    <socket-address>
                        <address>localhost</address>
                        <port>20020</port>
                    </socket-address>
                </remote-addresses>
                <connect-timeout>10s</connect-timeout>
            </tcp-initiator>
        </initiator-config>
     </remote-cache-scheme>
   </caching-schemes>
    ...

</cache-config>

Configuring Coherence *Extend Clients (with Task Processing capabilities)

In prior releases the elements were used to help configure the extend client for the processing pattern. These elements are no longer supported in INC-12. The extend client for the processing pattern can be defined using the standard C0herence cache configuration elements.

The configuration file coherence-processingpattern-extend-taskprocessing-config.xml as provided with the distribution defines a Coherence *Extend-base Client that is capable of processing Tasks using locally managed TaskProcessors.

The relevant parts of the included configuration are as follows:

>

  ...
  <caching-scheme-mapping>
      <cache-mapping>
        <cache-name>coherence.patterns.processing.*</cache-name>
        <scheme-name>extend-dist</scheme-name>
      </cache-mapping>
 </caching-scheme-mapping>

 <caching-schemes>
    <remote-cache-scheme>
        <scheme-name>extend-dist</scheme-name>
          <initiator-config>
            <tcp-initiator>
                <remote-addresses>
                    <socket-address>
                        <address>localhost</address>
                        <port>20020</port>
                    </socket-address>
                </remote-addresses>
                <connect-timeout>10s</connect-timeout>
            </tcp-initiator>
          </initiator-config>

        <processing:taskprocessors>
            <processing:taskprocessordefinition id="SingleTaskProcessor"
                                                displayname="Single Task Processor"
                                                type="SINGLE"
                                                taskpattern="SingleTask">

                <processing:default-taskprocessor id="Single Task Processor"
                                                   threadpoolsize="10"/>

                <processing:attribute name="type">single</processing:attribute>
            </processing:taskprocessordefinition>
        </processing:taskprocessors>
    </remote-cache-scheme>
 </caching-schemes>

    ...

</cache-config>

Processing Pattern Proxy Server Configuration

The configuration file coherence-processingpattern-proxy-config.xml as provided with the distribution defines a Coherence *Extend Proxy Server for the Processing Pattern. This is required when using Coherence *Extend Clients.

The config file includes a Coherence Cache Configuration <acceptor-config> that listens for connection on localhost.

IMPORTANT

As in most circumstances, it is strongly recommended to run proxy nodes storage disabled using the command-line argument -Dtangosol.coherence.distributed.localstorage=false

The relevant parts of the included configuration are as follows:

<cache-config
    xmlns:element="class://com.oracle.coherence.common.namespace.preprocessing.XmlPreprocessingNamespaceHandler"
    element:introduce-cache-config="coherence-processingpattern-pof-cache-config.xml">

    <caching-schemes>
        <proxy-scheme>
            <acceptor-config>
                <tcp-acceptor>
                    <local-address>
                        <address>localhost</address>
                        <port>20020</port>
                    </local-address>
                </tcp-acceptor>
            </acceptor-config>
            <autostart>true</autostart>
        </proxy-scheme>
    </caching-schemes>
</cache-config>