Java client based on new HttpClient (java 11+)
https://mvnrepository.com/artifact/org.fintecy.md/ecb-client/1.0.1
implementation 'org.fintecy.md:ecb-client:1.0.1'
<dependency>
<groupId>org.fintecy.md</groupId>
<artifactId>ecb-client</artifactId>
<version>1.0.1</version>
</dependency>
EcbApi client = EcbClient.api();
var client = ecbClient()
.useClient(HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.ALWAYS)
.priority(10)
.connectTimeout(Duration.ofMillis(500))
.executor(Executors.newSingleThreadExecutor())
.build())
.with(CircuitBreaker.ofDefaults())
.with(RateLimiter.smoothBuilder(Duration.ofMillis(100))
.build())
.with(RetryPolicy.ofDefaults())
.with(Timeout.of(Duration.ofMillis(400)))
.rootPath("https://www.ecb.europa.eu/stats/eurofxref") -- just to use stub in tests
.build();
var client = EcbClient.api();
int rates = client.rates();
var client = EcbClient.api();
var currencies = client.supportedCurrencies();
- Java 11+
- FailSafe
- Slf4j api
- jackson
- WireMock (tests)
- Junit5 (tests)
Anton Batiaev anton@batiaev.com