File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
springboot-starter/src/main/java/com/codingapi/springboot/framework/rest Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 11package com .codingapi .springboot .framework .rest ;
22
3+ import com .alibaba .fastjson .JSONObject ;
34import com .codingapi .springboot .framework .rest .param .ApiGetParamBuilder ;
45import com .codingapi .springboot .framework .rest .param .ApiPostParamBuilder ;
56import com .codingapi .springboot .framework .rest .properties .RestApiProperties ;
@@ -43,7 +44,25 @@ public String get(String api) {
4344 }
4445
4546 private String _post (String api , ApiPostParamBuilder paramBuilder ) {
46- return httpClient .post (api , paramBuilder .build ());
47+ return _post (api , paramBuilder .build ());
48+ }
49+
50+
51+ private String _post (String api , JSONObject requestBody ) {
52+ return httpClient .post (api , requestBody );
53+ }
54+
55+
56+ public String post (String api , JSONObject requestBody ) {
57+ for (int i =0 ;i < RETRY_COUNT ;i ++){
58+ try {
59+ return _post (api , requestBody );
60+ }catch (Exception e ){
61+ log .warn ("api:{},error:{}" ,api ,e .getMessage ());
62+ sleep ();
63+ }
64+ }
65+ return EMPTY ;
4766 }
4867
4968
You can’t perform that action at this time.
0 commit comments