Home > Back-end >  SpringCloud feign service call, participants throw exceptions, sponsors are not rolled back
SpringCloud feign service call, participants throw exceptions, sponsors are not rolled back

Time:11-25

SpringCloud + feign service call, participants don't rolled back, for example: sponsors A (annotations using the @ LcnTransaction, @ Transactional)
) party B through feign calls (annotations @ LcnTransaction (propagation=DTXPropagation. SUPPORTS)
@ Transactional), B throw exceptions, A insert data (not rollback),
Used in the solution:
1, feign cancel falback, not to fuse, the test is invalid;
2, feign not cancel falback, fuse, the adding methods of implementation to join DTXUserControls. RollbackGroup (TracingContext. Tracing (). The groupId ()), the test is invalid;

Production:
Tencent cloud
Using Docker TXLCN mirror, TM host IP is set to: 0.0.0.0:8070 (cannot be set to 127.0.0.1:8070, otherwise the TC bound less than TM host)
Service configuration of A TC host IP for: TM host IP load balancing: 8070, opens the LCN rewrite load strategy
Service configuration B TC host IP for: TM host IP load balancing: 8070, opens the LCN rewrite load strategy

Deployment TXLCN image log shows:
The An exceptionCaught () event was fired, and it reached the at the tail of the pipeline, it usually means the last handler in the pipeline did not handle the exception.
Java. IO. IOException: connection reset by the other end
I don't know whether impact?

TxManager system background:
Registered TC=2 (that is, A and B have binding TM)

Everything looks very normal, the correct use of the participants and sponsors of the annotations, but B service throws an exception, tried to cancel the fusing throw exceptions to A service and join the DTXUserControls rollbackGroup (TracingContext. Tracing (). The groupId ()) code, A service still submitted the transaction?

Please answer, thank you very much,
Note: in the local project transaction rollback, normal line not line, I don't know whether the online environment?

CodePudding user response:

Feign cancel falback, without fusing, exception to the caller, the transaction can be rolled back, I tried, but not much fusing if the request is all card that, the server can not stand, I also watched how to deal with, to solve

CodePudding user response:

Annotations @ LcnTransaction (propagation=DTXPropagation. SUPPORTS) to @ LcnTransaction (propagation=DTXPropagation. NEVER)
  • Related