seata1.4.0+springboot+eureka+oracle集成

目录

一、seata1.4.0配置

1、seata-server下载

2、修改file.conf和registry.conf配置文件

3、lib目录增加oracle驱动包

4、seata-oracle表插入

5、windows启动

二、springboot集成

1、pom.xml文件引入

2、配置文件yml设置

3、事务使用


一、seata1.4.0配置

1、seata-server下载

https://seata.io/zh-cn/blog/download.html

2、修改file.conf和registry.conf配置文件

file.conf

 mode = "db"

  db {
    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) etc.
    datasource = "druid"
    ## mysql/oracle/postgresql/h2/oceanbase etc.
    dbType = "oracle"
    driverClassName = "oracle.jdbc.driver.OracleDriver"
    url = "jdbc:oracle:thin:@ip:1521:ORCL"
    user = "xxx"
    password = "xx"
    minConn = 5
    maxConn = 100
    globalTable = "GLOBAL_TABLE"
    branchTable = "BRANCH_TABLE"
    lockTable = "LOCK_TABLE"
    queryLimit = 100
    maxWait = 5000
  }

registry.conf

type = "eureka"


eureka {
    serviceUrl = "http://127.0.0.1:8761/eureka"
    application = "SEATA"  #注册到eureka的服务名
    weight = "1"
}

config {
  # file、nacos 、apollo、zk、consul、etcd3
  type = "file"

3、lib目录增加oracle驱动包

 默认是没有oracle驱动包的,需要增加:ojdbc6-11.2.0.3.jar

4、seata-oracle表插入

下载地址:https://download.csdn.net/download/u014704612/12844198

网盘:

链接:https://pan.baidu.com/s/1BHBQmc1DLCGpByGEBqbS6Q 
提取码:gkhw 

5、windows启动

seata-server.bat -p 8095 -m db

二、springboot集成

1、pom.xml文件引入

<dependency>
	<groupId>io.seata</groupId>
	<artifactId>seata-spring-boot-starter</artifactId>
	<version>1.4.0</version>
</dependency>

2、配置文件yml设置

#seata 配置, 代替file.conf和registry.conf配置
seata:
  enabled: true
  # 事务群组(可以每个应用独立取名,也可以使用相同的名字)
  tx-service-group: sfs_mis_tx_group
  client:
    rm-report-success-enable: true
    # 异步提交缓存队列长度(默认10000)
    rm-async-commit-buffer-limit: 1000
    # 一阶段全局提交结果上报TC重试次数(默认1次,建议大于1)
    tm-commit-retry-count:   3
    # 一阶段全局回滚结果上报TC重试次数(默认1次,建议大于1)
    tm-rollback-retry-count: 3
    support:
      # 数据源自动代理开关(默认false关闭)
      spring-datasource-autoproxy: true
  service:
    vgroup-mapping:
      # TC 集群(必须与seata-server保持一致)
      sfs_mis_tx_group: seata
    # grouplist配置不生效,不需要配置,只要将seata注册到相同的eureka即可
    grouplist:
      default: 127.0.0.1:8095
  registry:
    type: eureka
    eureka:
      serviceUrl: http://127.0.0.1:8761/eureka

3、事务使用

@GlobalTransactional
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值