zoukankan      html  css  js  c++  java
  • SEATA 1.0.0使用yaml配置替换file.conf 和 registry.conf

    Client Configure for SEATA 1.0.0

    在SEATA 1.0.0 中发布了一个新的feature,可以使用yaml/properties来替换掉我们在之前引入的file.confregistry.conf. 只需2步即可达到目的:

    • 第一步,更改依赖

      <!--seata-->
              <dependency>
                  <groupId>io.seata</groupId>
                  <artifactId>seata-spring-boot-starter</artifactId>
                  <version>1.0.0</version>
                  <exclusions>
                      <exclusion>
                          <artifactId>seata-all</artifactId>
                          <groupId>io.seata</groupId>
                      </exclusion>
                  </exclusions>
              </dependency>
              <dependency>
                  <groupId>io.seata</groupId>
                  <artifactId>seata-all</artifactId>
                  <version>1.0.0</version>
              </dependency>
      

      官方的说法是只需要依赖seata-spring-boot-starter即可,但是在实际的过程中,该依赖内部依然使用的是seata-all 0.9版本,会报错,因此我单独引入了seata-all 1.0.0,提交 github issue,

    • 第二步:修改配置

    server:
      port: 8001
    # 1.0新添加的enabled激活自动配置,使得我们可以在yaml/properties文件中配置,
    # 避免了以前需要客户端引入2个文件:
    # file.conf 和 registry.conf
    seata:
      enabled: true # 1.0新特性,需要依赖seata-spring-boot-starter,默认为true
      tx-service-group: geekplus_tx_group
    #  transport:
    #    type: TCP #default value is TCP
    #    server: NIO #default value is NIO
    #    heartbeat: true #enable heartbeat
    #    enable-client-batch-send-request: true
    #    serialization: seata
    #    compressor: none
    #    shutdown:
    #      wait: 3 #when destroy server, wait seconds
      registry:
        type: eureka
        eureka:
          service-url: http://localhost:8888/eureka
    #      application: default
    #      weight: 1
    #  service:
    #    vgroup-mapping: geekplus_tx_group
    #    disable-global-transaction: false
    #    disableGlobalTransaction: false
      client:
        support:
          spring:
            datasource-autoproxy: false
    spring:
      application:
        name: seata-1-0-transaction
    ...
    

    你可以在spring-configuration-metadata.json文件中找到相对应的配置属性. 在使用service属性时,同样存在1个问题,关于disableGlobalTransactiondisable-global-transaction都无法生效的问题。Git issue.
    详情演示可查看demo/mscx-seata-1-0-demo

  • 相关阅读:
    25个Apache性能优化技巧推荐 新风宇宙
    九个PHP很有用的功能 新风宇宙
    ubuntu nginx的安装 新风宇宙
    .net 下对winapi的调用
    jquery选中单选框、复选框、下拉框
    中国标准书号校验码的计算方式(附C#代码)
    NET中创建一个线程有几种方法
    ASP.NET中Cookie编程的基础知识
    js日期时间函数(经典+完善+实用)
    SQL语句大全
  • 原文地址:https://www.cnblogs.com/zhangpan1244/p/12201003.html
Copyright © 2011-2022 走看看