Unlike other components that handle external requests in this project, Servlet acts as the service provider.
Common Configuration (Logging, Persistence, Retry, etc.)
<dependency>
<groupId>io.github.requestlog</groupId>
<artifactId>request-log-servlet-starter</artifactId>
<version>${latest_stable_version}</version>
</dependency>
Use @ReqLog
to decorate the endpoint.
import io.github.requestlog.servlet.annotation.ReqLog;
@RestController
public class SomeController {
@ReqLog(whenException = {Exception.class, IOException.class},
retry = true, retryInterval = 10, retryWaitStrategy = RetryWaitStrategy.FIXED,
maxExecuteCount = 10)
@GetMapping("/some-path")
public String get() {
return "some result";
}
}
whenException
:Specifies whichException
to record.retry
:Enable retry.retryInterval
:Retry interval.retryWaitStrategy
:Retry interval calculation strategy.maxExecuteCount
:Maximum expected execution count after enabling retry (including the first execution).
To temporarily disable the functionality, configure request-log.servlet.disable=true
If rewriting request information is involved during retry, refer to Common Usage - Retry