Dubbo user configuration

Update time: 2022-10-01

Firstly, you should bootstrap raincat-manager, please refer to how to bootstrap Txmanager for details. Then, please add dependency in maven at your Dubbo service, and add @TxTransaction annotation in your distributed transaction method.


Configure TxTransactionBootstrap by Spring XML

    <context:component-scan base-package="org.dromara.*"/>
    <aop:aspectj-autoproxy expose-proxy="true"/>
    <bean id="txTransactionBootstrap" class="org.dromara.raincat.core.bootstrap.TxTransactionBootstrap">
        <property name="txManagerUrl" value="http://localhost:8761"/>
        <property name="serializer" value="kryo"/>
        <property name="nettySerializer" value="kryo"/>
        <property name="compensation" value="true"/>
        <property name="compensationCacheType" value="db"/>
        <property name="txDbConfig">
            <bean class="org.dromara.raincat.common.config.TxDbConfig">
                <property name="url"
                <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
                <property name="username" value="root"/>
                <property name="password" value="123456"/>

Configure TxTransactionBootstrap by spring boot starter

  • Firstly, please add maven dependency raincat-spring-boot-starter-dubbo provided by Raincat.

    • Secondly, configure the application.yml like follows.

       txManagerUrl: http://localhost:8761
       serializer: kroy
       nettySerializer: kroy
       compensation: true
       compensationCacheType : db
       txDbConfig :
              driverClassName  : com.mysql.jdbc.Driver
              url :  jdbc:mysql://;characterEncoding=utf8
              username : root
              password : 123456
  • txManagerUrl is the ip and port that you bootstrap txManager . Please add http:// at head.

  • serializer is the way of transaction log serialization.

  • nettySerializer is the serialization way of how to communicate with txManager. Please be caution that It should be consistent with the configuration in txManager.

  • compensation is the property whether the compensation is required or not, the service will compensate itself in some extreme cases.

  • compensationCacheType is the storage log types, and support Redis, Mongodb, Zookeeper, etc. For details, please refer to the config.

NOTICE:You need to open AOP when you want to use XML to configure.

PS: For any question, please refer to dubbo-sample.