codingapi / codingapi/tx-lcn

SpringCloud + Feign 事务不回滚 解决方案

Ouverte
#481 6 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
4.2k
Forks
1.4k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

看issue发现很多人也有这个问题,我最近也碰到了,然后跟踪了一下源码,总算解决了。

下面给出我的解决步骤:

1. 打开LCN Logger
`logging.level.com.codingapi.txlcn = debug`

2. 检查日志中是否包含以下log。如包含,转6
`com.codingapi.txlcn.tracing.Tracings : tracing apply group:693a5ae3226537.....`

3. 检查日志中的各服务log中groupId是否一致 。如一致,转6
`c.c.t.t.c.context.DefaultGlobalContext : Start TxContext[693a5ae3226537]`

4. 检查是否用了 @EnableWebMvc 注解。如用了,转6
5. 添加MVC拦截器
```
public class WebMvcConfiguration extends WebMvcConfigurationSupport {
.........其它配置省略...........
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new SpringTracingApplier());
}
}
6. 结束
```

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start by reproducing the Spring Cloud and Feign transaction rollback problem described in the issue, then enable LCN debug logging and compare tracing group IDs across service logs. Check whether @EnableWebMvc is present and whether the SpringTracingApplier interceptor is registered; done means identifying and documenting the condition that prevents rollback or confirming the provided workaround.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, spring
Domaine
backend, distributed-systems
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.