Giter Club home page Giter Club logo

router's Introduction

#路由选择器简介: ###主要处理动态client路由问题,类结构图如下: Image text #路由器工程结构:

  • router-parent :父工程

router-core : 基础包

router-nosql :nosql路由选择器
router-database :database路由选择器

#router-nosql spring配置: ${cacheCluster_1.redis.url} ${cacheCluster_1.redis.maxActive} ${cacheCluster_1.redis.maxIdle} ${cacheCluster_1.redis.minIdle}

<bean id="provRedisCluster" class="com.al.crm.router.nosql.DefaultRedisFixProxy">
           <constructor-arg name="clientRouter" ref="routeSelector"/>
       </bean>
   
       <!--nosql路由配置   -->
       <bean id="routeSelector" class="com.al.crm.router.nosql.DefaultCacheClientRouter">
           <property name="targetClientInstanceBeans">
               <map>
                   <entry key="rds01" value-ref="cl01" />
                   <entry key="rds02" value-ref="cl02" />
                   <!--<entry key="rds03" value-ref="cl03" />-->
               </map>
           </property>
           <property name="strategy" value="com.al.crm.router.core.strategy.DefaultRegionRouteStrategy"/>
       </bean>

###cl01/cl02 为对应的IRedisFix 实现类实例

#router-database spring 配置:

<bean id="dataSource" class="com.al.crm.router.database.SpringDataSourceRouter">
	<property name="targetDataSources">
		<map>
			<entry key="ds01" value-ref="dataSource2"/>
			<entry key="ds02" value-ref="dataSource2"/>
		</map>
	</property>
	<property name="strategy" value="com.al.crm.router.core.strategy.DefaultRegionRouteStrategy"/>
</bean>

#路由器使用时配置路由表,即RouteId-targetDataSources.key 对应关系,如下: com.al.crm.router.core.MDA.REGION_ROUTE_MAP 类型为:Map<String, Map<String, String>> key 设置为 系统名称,需要在properties文件中设置uniconfig.domain=系统名称; 简要配置如下: Map<String,String> map = new HashMap<String, String>(); map.put("areaId_111","ds01"); map.put("areaId_222","ds02"); map.put("areaId_333","ds01"); MDA.REGION_ROUTE_MAP.put("CRM2013",map);

#路由器使用时需要设置线程级变量,用完需要清除: RouteContext.setRouteId(routeId); RouteContext.clear;

router's People

Contributors

liub112 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.