Skip to content

Commit

Permalink
feat: add retry json post with headers method (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
pangdayuan1 authored Sep 11, 2024
1 parent aed9418 commit 9773bb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions arex-schedule-web-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<parent>
<artifactId>arex-schedule-parent</artifactId>
<groupId>com.arextest</groupId>
<version>1.2.18</version>
<version>1.2.19</version>
</parent>

<profiles>
Expand Down Expand Up @@ -338,5 +338,5 @@
</properties>
</profile>
</profiles>
<version>1.2.18</version>
<version>1.2.19</version>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,18 @@ public <TRequest, TResponse> TResponse retryJsonPost(String url, TRequest reques
}
}

public <TRequest, TResponse> TResponse retryJsonPost(String url, TRequest request,
Class<TResponse> responseType, Map<String, String> headers) {
try {
return retryTemplate.execute(retryCallback -> {
retryCallback.setAttribute(URL, url);
return restTemplate.postForObject(url, wrapJsonContentType(request, headers), responseType);
});
} catch (Exception e) {
return null;
}
}

public <TRequest, TResponse> ResponseEntity<TResponse> retryJsonPost(String url, TRequest request,
ParameterizedTypeReference<TResponse> responseType) {
try {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -320,5 +320,5 @@
<url>https://github.com/arextest/arex-replay-schedule</url>
</scm>
<url>https://github.com/arextest/arex-replay-schedule</url>
<version>1.2.18</version>
<version>1.2.19</version>
</project>

0 comments on commit 9773bb2

Please sign in to comment.