Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xyz327/transactional-rocketmq-spring-boot-starter
rocketmq 事务消息结合本地事务实现方便的发送事务
https://github.com/xyz327/transactional-rocketmq-spring-boot-starter
Last synced: about 1 month ago
JSON representation
rocketmq 事务消息结合本地事务实现方便的发送事务
- Host: GitHub
- URL: https://github.com/xyz327/transactional-rocketmq-spring-boot-starter
- Owner: xyz327
- License: mit
- Created: 2021-05-21T13:06:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-23T10:38:01.000Z (over 3 years ago)
- Last Synced: 2023-03-03T10:23:27.099Z (almost 2 years ago)
- Language: Java
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# transactional-rocketmq-spring-boot-starter
> rocketmq 事务消息结合本地事务实现方便的发送事务
+ 基于`rocketmq-spring-boot-starter`
+ 依赖本地事务记录表来完成事务消息## 增加依赖
```xml
cn.github.xyz327
transactional-rocketmq-spring-boot-starter
1.0-SNAPSHOT```
## 在业务数据库中增加事务记录表> 执行 script/init.sql
## 使用
```java
public class TransactionalMqTest {
@Autowired
private TransactionalRocketMqProducer transactionalRocketMqProducer;
@Autowired
private JdbcTemplate jdbcTemplate;@Transactional
public boolean transactionalMessage() throws Exception {
// 做本地事务操作
jdbcTemplate.queryForList("select 1 from dual");// 发送事务消息
Message message = new Message();
message.setTopic("trans_topic");
message.setBody("事务消息".getBytes(StandardCharsets.UTF_8));
transactionalRocketMqProducer.sendTransactionalMessage(message);
return true;
}
}
```