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

spring.mapstore.mongodb.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- Mongo -->
    <bean id="writeConcern" class="com.mongodb.WriteConcern">
        <constructor-arg name="w" value="${mongo.options.write-concern.w}"/>
        <constructor-arg name="wtimeout" value="${mongo.options.write-concern.wtimeout}"/>
        <constructor-arg name="fsync" value="${mongo.options.write-concern.fsync}"/>
        <constructor-arg name="j" value="${mongo.options.write-concern.j}"/>
    </bean>

    <bean id="mongoClientOptionsBuilder" class="com.mongodb.MongoClientOptions" factory-method="builder"/>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="minConnectionsPerHost">
        <constructor-arg value="${mongo.options.min-connections-per-host}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="connectionsPerHost">
        <constructor-arg value="${mongo.options.connections-per-host}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="threadsAllowedToBlockForConnectionMultiplier">
        <constructor-arg value="${mongo.options.threads-allowed-to-block-for-connection-multiplier}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="maxWaitTime">
        <constructor-arg value="${mongo.options.max-wait-time}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="maxConnectionIdleTime">
        <constructor-arg value="${mongo.options.max-connection-idle-time}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="maxConnectionLifeTime">
        <constructor-arg value="${mongo.options.max-connection-life-time}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="connectTimeout">
        <constructor-arg value="${mongo.options.connect-timeout}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="socketTimeout">
        <constructor-arg value="${mongo.options.socket-timeout}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="socketKeepAlive">
        <constructor-arg value="${mongo.options.socket-keep-alive}"/>
    </bean>
    <bean factory-bean="mongoClientOptionsBuilder" factory-method="writeConcern">
        <constructor-arg ref="writeConcern"/>
    </bean>

    <bean id="mongo" class="com.mongodb.MongoClient">
        <constructor-arg name="addr">
            <bean class="com.mongodb.ServerAddress">
                <constructor-arg name="host" value="${mongo.host}"/>
                <constructor-arg name="port" value="${mongo.port}"/>
            </bean>
        </constructor-arg>
        <constructor-arg name="options">
            <bean factory-bean="mongoClientOptionsBuilder" factory-method="build"/>
        </constructor-arg>
    </bean>

    <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
        <constructor-arg ref="mongo"/>
        <constructor-arg name="databaseName" value="${mongo.db.name}"/>
    </bean>

    <bean id="mongoDB" factory-bean="mongo" factory-method="getDB">
        <constructor-arg name="dbname" value="${mongo.db.name}" />
    </bean>

    <!-- Map stores -->

    <bean id="taskDecisionMapStore" class="ru.taskurotta.hazelcast.store.MongoMapStore">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="serializationService" ref="bSerializationService"/>
        <constructor-arg name="objectClassName" value="ru.taskurotta.transport.model.Decision"/>
    </bean>

    <bean id="graphMapStore" class="ru.taskurotta.hazelcast.store.MongoMapStore">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="serializationService" ref="bSerializationService"/>
        <constructor-arg name="objectClassName" value="ru.taskurotta.service.dependency.links.Graph"/>
    </bean>

    <bean id="taskMapStore" class="ru.taskurotta.hazelcast.store.MongoMapStore">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="serializationService" ref="bSerializationService"/>
        <constructor-arg name="objectClassName" value="ru.taskurotta.transport.model.TaskContainer"/>
    </bean>

    <bean id="graphDecisionMapStore" class="ru.taskurotta.hazelcast.store.MongoMapStore">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="serializationService" ref="bSerializationService"/>
        <constructor-arg name="objectClassName" value="ru.taskurotta.service.hz.dependency.HzGraphDao$DecisionRow"/>
    </bean>

    <bean id="processMapStore" class="ru.taskurotta.hazelcast.store.MongoMapStore">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="serializationService" ref="bSerializationService"/>
        <constructor-arg name="objectClassName" value="ru.taskurotta.service.console.model.Process"/>
    </bean>

    <bean id="actorsPrefMapStore" class="ru.taskurotta.hazelcast.store.MongoMapStore">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="serializationService" ref="bSerializationService"/>
        <constructor-arg name="objectClassName" value="ru.taskurotta.service.config.model.ActorPreferences"/>
    </bean>

    <bean id="brokenProcessMapStore" class="ru.taskurotta.hazelcast.store.MongoMapStore">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="serializationService" ref="bSerializationService"/>
        <constructor-arg name="objectClassName" value="ru.taskurotta.service.console.model.BrokenProcess"/>
    </bean>

    <!-- fastest serializers to BSON -->

    <bean id="taskQueueItemStreamBSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.TaskQueueItemStreamBSerializer"/>

    <bean id="graphBSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.GraphBSerializer"/>

    <bean id="taskContainerBSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.TaskContainerBSerializer"/>

    <bean id="decisionRowBSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.DecisionRowBSerializer"/>

    <bean id="processBSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.ProcessBSerializer"/>

    <bean id="decisionBSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.DecisionBSerializer"/>

    <bean id="uuidSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.UUIDBSerializer"/>

    <bean id="stringSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.StringBSerializer"/>

    <bean id="recoveryOperationSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.RecoveryOperationSerializer"/>

    <bean id="taskKeyBSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.TaskKeyBSerializer"/>

    <bean id="actorsPreferencesSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.ActorPreferencesBSerializer"/>

    <bean id="brokenProcessSerializer"
          class="ru.taskurotta.service.hz.serialization.bson.BrokenProcessBSerializer"/>

    <bean id="bSerializationService" class="ru.taskurotta.mongodb.driver.BSerializationServiceFactory"
          factory-method="newInstance">
        <constructor-arg>
            <list>
                <ref bean="taskQueueItemStreamBSerializer"/>
                <ref bean="graphBSerializer"/>
                <ref bean="taskContainerBSerializer"/>
                <ref bean="decisionRowBSerializer"/>
                <ref bean="processBSerializer"/>
                <ref bean="decisionBSerializer"/>
                <ref bean="uuidSerializer"/>
                <ref bean="stringSerializer"/>
                <ref bean="recoveryOperationSerializer"/>
                <ref bean="taskKeyBSerializer"/>
                <ref bean="actorsPreferencesSerializer"/>
                <ref bean="brokenProcessSerializer"/>
            </list>
        </constructor-arg>
    </bean>
    <!--- /serializers> -->

    <bean id="cachedQueueStoreFactory"
          class="ru.taskurotta.hazelcast.queue.store.mongodb.MongoCachedQueueStorageFactory">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="serializationService" ref="bSerializationService"/>
    </bean>
    <!-- /Mongo -->

    <bean id="debugMonitor" class="ru.taskurotta.hazelcast.MongoHealthMonitor">
        <constructor-arg name="mongoTemplate" ref="mongoTemplate"/>
        <constructor-arg name="metricsPeriodMs">
            <bean class="ru.taskurotta.util.DurationParser" factory-method="toMillis">
                <constructor-arg name="duration" value="${health.mongo.metrics.log-period}"/>
            </bean>
        </constructor-arg>
        <constructor-arg name="mongoStatPeriodMs">
            <bean class="ru.taskurotta.util.DurationParser" factory-method="toMillis">
                <constructor-arg name="duration" value="${health.mongo.stat.log-period}"/>
            </bean>
        </constructor-arg>
    </bean>

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy