Skip to content

Dubbo Quick Start

纳兰丶 edited this page Sep 19, 2018 · 5 revisions
spring:
  datasource:
      driver-class-name:  com.mysql.jdbc.Driver
      url: jdbc:mysql://192.168.1.68:3306/tcc_account?useUnicode=true&characterEncoding=utf8
      username: xiaoyu
      password: Wgj@555888
  • Modifiy applicationContext.xml on Indicator Item And choose repositorySupport and modifiy it
    • If you use database compensation , You have to create a new database 。 for example:tcc

     <context:component-scan base-package="com.hmily.tcc.*"/>
     <aop:aspectj-autoproxy expose-proxy="true"/>
    <bean id="hmilyTransactionBootstrap" class="com.hmily.tcc.core.bootstrap.HmilyTransactionBootstrap">
        <property name="serializer" value="kryo"/>
        <property name="recoverDelayTime" value="120"/>
        <property name="retryMax" value="3"/>
        <property name="scheduledDelay" value="120"/>
        <property name="scheduledThreadMax" value="4"/>
        <property name="repositorySupport" value="db"/>
        <property name="tccDbConfig">
            <bean class="com.hmily.tcc.common.config.TccDbConfig">
                <property name="url"
                          value="jdbc:mysql://192.168.1.98:3306/tcc?useUnicode=true&amp;characterEncoding=utf8"/>
                <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
                <property name="username" value="root"/>
                <property name="password" value="123456"/>
            </bean>
        </property>
    </bean>
  • Modifiy spring-dubbo.xml on Indicator Item And modifiy zookeeper url
    <dubbo:application name="account-service"/>
    
    <dubbo:registry protocol="zookeeper" address="192.168.1.148:2181"/>
    
    <dubbo:protocol accesslog="true" name="dubbo" port="20888"/>
    
    <dubbo:service interface="com.hmily.tcc.demo.dubbo.account.api.service.AccountService"
                 ref="accountService"/>
  • run DubboTccAccountApplication.java
  • run DubboTccInventoryApplication.java
  • run DubboTccOrderApplication.java