[QUESTION] 微服务 分布式事务 回滚没有生效 只能用http调用
- Dominant language
- PHP
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 4h 21m
- Merged PRs (30d)
- 4
Description
## Before you submit an issue, please be sure to search through existing issues as well as search through the [documentation](https://hyperf.wiki)
- [] I've searched all existing issues
- [] I've read all relevant documentation I could find
### Describe your question
调用外部服务
```php
xa->generateGid();
try {
$this->xa->globalTransaction($gid, function () use (&$res) {
$this->xa->callBranch(self::SERVICE_URI . '/RpcOrderServiceInterface/createTest', []);
$this->xa->callBranch(self::SERVICE_URI . '/RpcOrderServiceInterface/createTestError', []);
});
} catch (\Throwable $th) {
throw $th;
}
return $res;
}
}
```
路由
```php
createTest();
});
Router::post('/createTestError', function (RpcOrderServiceInterface $rpcOrderService) {
return $rpcOrderService->createTestError();
});
});
});
```
上面的写法测试了没有生效
不支持写成这样的 不能直接用rpc服务调用 只能用http请求 有什么好的办法吗
```php
$this->xa->globalTransaction($gid, function () use (&$res) {
// $this->xa->callBranch(self::SERVICE_URI . '/RpcOrderServiceInterface/createTest', []);
// $this->xa->callBranch(self::SERVICE_URI . '/RpcOrderServiceInterface/createTestError', []);
$this->xa->callBranch($this->rpcOrderService->createTest());
$this->xa->callBranch($this->rpcOrderService->createTestError());
});
```
Contributor guide
Assessment
This issue has not been assessed yet.