All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nlpcraft.0.7.1.source-code.ignite.xml Maven / Gradle / Ivy

There is a newer version: 0.8.2
Show newest version
<?xml version="1.0" encoding="UTF-8"?>

<!--
   "Commons Clause" License, https://commonsclause.com/

   The Software is provided to you by the Licensor under the License,
   as defined below, subject to the following condition.

   Without limiting other conditions in the License, the grant of rights
   under the License will not include, and the License does not grant to
   you, the right to Sell the Software.

   For purposes of the foregoing, "Sell" means practicing any or all of
   the rights granted to you under the License to provide to third parties,
   for a fee or other consideration (including without limitation fees for
   hosting or consulting/support services related to the Software), a
   product or service whose value derives, entirely or substantially, from
   the functionality of the Software. Any license notice or attribution
   required by the License must also include this Commons Clause License
   Condition notice.

   Software:    NLPCraft
   License:     Apache 2.0, https://www.apache.org/licenses/LICENSE-2.0
   Licensor:    Copyright (C) 2018 DataLingvo, Inc. https://www.datalingvo.com

       _   ____      ______           ______
      / | / / /___  / ____/________ _/ __/ /_
     /  |/ / / __ \/ /   / ___/ __ `/ /_/ __/
    / /|  / / /_/ / /___/ /  / /_/ / __/ /_
   /_/ |_/_/ .___/\____/_/   \__,_/_/  \__/
          /_/
-->

<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util-2.0.xsd">

    <bean name="cache-store-session-listener" class="javax.cache.configuration.FactoryBuilder.ClassFactory">
        <constructor-arg value="org.nlpcraft.server.tx.NCTxCacheStoreSessionListener"/>
    </bean>

    <bean name="tcp-disco" class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
        <property name="networkTimeout" value="10000"/>
        <property name="ipFinder">
            <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                <property name="addresses">
                    <list>
                        <!--
                            List all IP/port configurations that can be started first.
                        -->
                        <value>127.0.0.1:47500</value>
                        <value>127.0.0.1:47501</value>
                        <value>127.0.0.1:47502</value>
                        <value>127.0.0.1:47503</value>
                        <value>127.0.0.1:47504</value>
                        <value>127.0.0.1:47505</value>
                        <value>127.0.0.1:47506</value>
                        <value>127.0.0.1:47507</value>
                        <value>127.0.0.1:47508</value>
                        <value>127.0.0.1:47509</value>
                    </list>
                </property>
            </bean>
        </property>
    </bean>

    <bean id="oneDayPolicy" class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
        <constructor-arg>
            <bean class="javax.cache.expiry.Duration">
                <constructor-arg value="MILLISECONDS"/>
                <constructor-arg value="86400000"/>
            </bean>
        </constructor-arg>
    </bean>

    <bean id="threeHourPolicy" class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
        <constructor-arg>
            <bean class="javax.cache.expiry.Duration">
                <constructor-arg value="MILLISECONDS"/>
                <constructor-arg value="10800000"/>
            </bean>
        </constructor-arg>
    </bean>

    <bean id="fiveMinsPolicy" class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
        <constructor-arg>
            <bean class="javax.cache.expiry.Duration">
                <constructor-arg value="MILLISECONDS"/>
                <constructor-arg value="300000"/>
            </bean>
        </constructor-arg>
    </bean>

    <bean name="user-token-signin-cache" class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="name" value="user-token-signin-cache"/>
        <property name="cacheMode" value="REPLICATED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="expiryPolicyFactory" ref="oneDayPolicy"/>
    </bean>

    <bean name="user-id-signin-cache" class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="name" value="user-id-signin-cache"/>
        <property name="cacheMode" value="REPLICATED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="expiryPolicyFactory" ref="oneDayPolicy"/>
    </bean>

    <bean name="endpoint-cache" class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="name" value="endpoint-cache"/>
        <property name="cacheMode" value="REPLICATED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="expiryPolicyFactory" ref="oneDayPolicy"/>
        <property name="queryEntities">
            <list>
                <bean class="org.apache.ignite.cache.QueryEntity">
                    <property name="keyType" value="java.lang.String"/>
                    <property name="valueType" value="org.nlpcraft.server.endpoints.NCEndpointCacheValue"/>

                    <property name="fields">
                        <map>
                            <entry key="sendTime" value="java.lang.Long"/>
                            <entry key="createdOn" value="java.lang.Long"/>
                            <entry key="userId" value="java.lang.Long"/>
                            <entry key="srvReqId" value="java.lang.String"/>
                            <entry key="processed" value="java.lang.Boolean"/>
                        </map>
                    </property>

                    <property name="indexes">
                        <list>
                            <bean class="org.apache.ignite.cache.QueryIndex">
                                <constructor-arg value="createdOn"/>
                            </bean>
                            <bean class="org.apache.ignite.cache.QueryIndex">
                                <constructor-arg value="sendTime"/>
                            </bean>
                            <bean class="org.apache.ignite.cache.QueryIndex">
                                <constructor-arg value="userId"/>
                            </bean>
                            <bean class="org.apache.ignite.cache.QueryIndex">
                                <constructor-arg value="srvReqId"/>
                            </bean>
                            <bean class="org.apache.ignite.cache.QueryIndex">
                                <constructor-arg value="processed"/>
                            </bean>
                        </list>
                    </property>
                </bean>
            </list>
        </property>
    </bean>

    <bean name="qry-state-cache" class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="name" value="qry-state-cache"/>
        <property name="cacheMode" value="REPLICATED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="expiryPolicyFactory" ref="threeHourPolicy"/>
    </bean>

    <bean name="sentence-cache" class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="name" value="sentence-cache"/>
        <property name="cacheMode" value="REPLICATED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="expiryPolicyFactory" ref="fiveMinsPolicy"/>
    </bean>

    <bean name="stanford-cache" class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="name" value="stanford-cache"/>
        <property name="cacheMode" value="REPLICATED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="expiryPolicyFactory" ref="fiveMinsPolicy"/>
    </bean>

    <bean name="opennlp-cache" class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="name" value="opennlp-cache"/>
        <property name="cacheMode" value="REPLICATED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="expiryPolicyFactory" ref="fiveMinsPolicy"/>
    </bean>

    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="igniteInstanceName" value="nlpcraft"/>

        <property name="sqlSchemas">
            <list>
                <value>nlpcraft</value>
            </list>
        </property>

        <property name="dataStorageConfiguration">
            <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
                <property name="defaultDataRegionConfiguration">
                    <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                        <property name="persistenceEnabled" value="true"/>
                    </bean>
                </property>

                <!--
                    Change these paths to store Ignite DB elsewhere.
                -->
                <property name="walPath" value="#{systemProperties['user.home']}/.nlpcraft/ignite/wal"/>
                <property name="walArchivePath" value="#{systemProperties['user.home']}/.nlpcraft/ignite/wal-archive"/>
                <property name="storagePath" value="#{systemProperties['user.home']}/.nlpcraft/ignite/storage"/>
            </bean>
        </property>

        <!-- Note that 'shutdownHook' option doesn't work when Ignite is used with log4j2 for some reasons. -->
        <property name="gridLogger">
            <bean class="org.apache.ignite.logger.log4j2.Log4J2Logger">
                <constructor-arg type="java.net.URL" value="classpath:log4j2.xml"/>
            </bean>
        </property>

        <property name="localHost" value="127.0.0.1"/>

        <property name="communicationSpi">
            <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
                <!-- Override local port. -->
                <property name="sharedMemoryPort" value="-1"/>
            </bean>
        </property>

        <!-- Global cache store session listener. -->
        <property name="CacheStoreSessionListenerFactories">
            <list>
                <ref bean="cache-store-session-listener"/>
            </list>
        </property>

        <property name="discoverySpi" ref="tcp-disco"/>

        <!-- Enable all events. -->
        <property name="includeEventTypes">
            <util:constant static-field="org.apache.ignite.events.EventType.EVTS_ALL"/>
        </property>

        <!-- Caches. -->
        <property name="cacheConfiguration">
            <list>
                <ref bean="user-token-signin-cache"/>
                <ref bean="endpoint-cache"/>
                <ref bean="user-id-signin-cache"/>
                <ref bean="qry-state-cache"/>
                <ref bean="sentence-cache"/>
                <ref bean="stanford-cache"/>
                <ref bean="opennlp-cache"/>
            </list>
        </property>
    </bean>
</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy