Home > Back-end >  Spring cloud feign client calls multiple server first server failure
Spring cloud feign client calls multiple server first server failure

Time:11-25

The client A service side B, C
A controller using the Resource annotations into B, C feign interface,
Call and then call C, B B fails, any call to 404, what reason be excuse me?

CodePudding user response:

May is a problem of interface address

CodePudding user response:

Success is not the first time, at the request of B, call C is also a success, but the next to come in, call it at 404 B, run directly call C code is a success

CodePudding user response:

Can stick a B, C interface code, and feignclient code

CodePudding user response:

@ the Resource
Private ApiDocumentFeign ApiDocumentFeign;

@ the Resource
Private ApiUserFeign ApiUserFeign;


/* *
* first normal call
*/
@ PostMapping (value=https://bbs.csdn.net/topics/Urls.DocumentGroup.QUERY_LIST)
Public Result queryList (@ RequestBody QueryReq the req) {
//the first call success
The List res=apiDocumentFeign. QueryList ();
//the first call success
The USer the userInfo=apiUserFeign. Query ();
}

/* *
* the second failure to 404
* @ param the req
* @ return
*/
@ PostMapping (value=https://bbs.csdn.net/topics/Urls.DocumentGroup.QUERY_LIST)
Public Result queryList (@ RequestBody QueryReq the req) {
//the second every time call fails
The List res=apiDocumentFeign. QueryList ();
//
The USer the userInfo=apiUserFeign. Query ();
}

/* *
* the order after a success
*/
@ PostMapping (value=https://bbs.csdn.net/topics/Urls.DocumentGroup.QUERY_LIST)
Public Result queryList (@ RequestBody QueryReq the req) {

//the second every time call success
The USer the userInfo=apiUserFeign. Query ();

//the second every time call fails
The List res=apiDocumentFeign. QueryList ();
}

CodePudding user response:

Alone is no problem in a controller problem

CodePudding user response:

If you feign interface configuration RequestMapping and corresponding feign controller configuration RequestMapping is different? Specific you can see here

https://blog.csdn.net/qq_31404603/article/details/88421363

CodePudding user response:

This is a single service calls and my problem is not the same

CodePudding user response:

You mean the first request B and C are successful, the second failure, B or C is successful, you here refers to the first, service is restarted after it, is the first time you can get the interface response data, but the second you get the response as a result of the 404, this kind of look you can break, after the first request data, and the second failure of the request data, and then determine whether impact after the execution of the C B, or you can only temporarily does not perform C B, B will fail, this kind of problem, unless you have met, otherwise you can only step by step

CodePudding user response:

Emmmmm, this is not a code problem, should be the problem of feign invocation mechanism, to see someone asked before but nobody answer, is a consumer end only to perform a service end feign

CodePudding user response:

I also encountered this problem, I am your rewrite rule, later you solved?

CodePudding user response:

See won't B interface in some cases failed transaction rollback, cause the entire service chain are wrong
  • Related