Releases: kumuluz/kumuluzee-rest-client
v2.0.0
Note: This version of kumuluzee-rest-client requires KumuluzEE version 4.0.0 or greater. Consequently, Java 11 or higher is also required.
We are excited to announce the next major version of KumuluzEE REST Client - 2.0.0. This release adds support for the newest KumuluzEE version 4 and adds support for Java 17 LTS and Java 18.
Since the support for Java 1.8 is dropped by KumuluzEE 4.0.0, the KumuluzEE REST Client 2.0.0 also drops support for Java 1.8.
Features
- Added support for KumuluzEE 4.0.0 and above
- Added support for Java 17 LTS and Java 18
Bugs
- Fixed issue with
@FormParam
processing and content-type header
v1.4.1.2
v1.4.1.1
v1.4.1
This release implements the MicroProfile Rest Client 1.4.1 specification.
Features
- Ensured CDI context in
ClientHeadersFactory
.
Enhancements
- Fix for
MethodHandle
to handle interface's default methods. - Query parameters with null values are now ignored and are not sent with request
Bugs
- Fixed generic object parsing.
v1.3.3
We are happy to present a new release of KumuluzEE Rest Client. This version implements the MicroProfile Rest Client 1.3.3 specification. It includes support for advanced SSL configuration, enables simpler configuration with configuration keys and other enhancements.
The RestClientBuilder
now supports methods for configuring SSL (sslContext
, trustStore
, keyStore
and hostnameVerifier
). SSL can also be configured through configuration which is especially useful when constructing rest clients using CDI.
The @RegisterRestClient
now supports additional argument configKey
which can replace fully qualified class name in the configuration. It also enables sharing of the configuration across multiple rest client interfaces. For example you could use the following definition:
@RegisterRestClient(configKey="test-client")
public interface TestClient {
@GET
Response test();
}
And then configure it like this (config.yml
):
kumuluzee:
rest-client:
registrations:
- class: test-client
url: https://my-test-service
read-timeout: 5000
All constructed rest client now implement Closeable
and AutoCloseable
interfaces. This means that all rest clients can now be closed and will clean up their resources when done so.
Rest clients now add a default header Accept: application/json
. If desired this can be overridden by adding a proper @Produces(...)
annotation on an interface or on a method. Dependency versions have also been updated in this release.
Features
- Added configurable SSL support.
- Added configKey support.
Enhancements
- Implemented
Closeable
andAutoCloseable
on the proxy. - Added default
Accept: application/json
header. - Upped dependency versions
v1.2.2
We are releasing a minor version of KumuluzEE Rest Client. This version contains fixes for integration with KumuluzEE Fault Tolerance. It also fully supports Java 12.
Rest client definitions now support Fault Tolerance interceptors. For example to retry a request in case of its failure the definition could look something like this:
@RegisterRestClient
@Path("/customers")
@Dependent
public interface CustomerClient {
@GET
@Retry(maxRetries = 5)
Customer getCustomer(int id);
}
NOTE: @Asynchronous
annotation is currently not supported. If required please use a wrapper instead.
Bugs
- Use regular beans instead of DeltaSpike (fixes FT and Java 12 issues)
v1.2.1
We are pleased to announce the release of KumuluzEE Rest Client 1.2.1. This release brings support for better header generation and propagation of headers from incoming requests, read and connect timeouts and other enhancements. KumuluzEE Rest Client 1.2.1 implements the MicroProfile Rest Client 1.2 specification.
Headers can now be generated using the @ClientHeaderParam
annotation. Headers can be statically defined or dynamically generated with a method reference. For example:
@Path("/somePath")
public interface MyClient {
@POST
@ClientHeaderParam(name="X-Http-Method-Override", value="PUT")
Response sentPUTviaPOST(MyEntity entity);
@POST
@ClientHeaderParam(name="X-Request-ID", value="{generateRequestId}")
Response postWithRequestId(MyEntity entity);
default String generateRequestId() {
return UUID.randomUUID().toString();
}
}
Headers can also be propagated from incoming requests. To propagate a header first enable the feature by annotating the API interface with @RegisterClientHeaders
annotation. Then specify which headers should be propagated in the KumuluzEE Configuration framework. For example if you wish to forward the Authorization header use the following configuration in config.yml file:
kumuluzee:
rest-client:
propagate-headers: Authorization
The @RegisterRestClient
annotation now includes a parameter baseUri
and allows you to specify the URI on which the API is present. This is an alternative to specifying the base URI in configuration.
Read and connect timeouts have been added. They can be specified in the configuration or by using the methods readTimeout()
and connectTimeout()
when constructing the client using RestClientBuilder
.
Support for interceptors has also been updated in this version. To use an interceptor with the client simply annotate the desired method/interface with an interceptor binding. Note however that KumuluzEE Fault Tolerance interceptors are not fully supported yet. We will be issuing a patch that fixes that shortly at KumuluzEE Fault Tolerance project, so stay tuned.
Features
- Added read/connect timeout
- Read URI from
@RegisterRestClient
annotation - added removeContext() to AsyncInterceptors
- Added RestClientListener support
@ClientHeaderParam
supportClientHeadersFactory
support- Propagate incoming headers
Enhancements
@Consumes
and@Produces
annotations add Accept and Content-Type headers.- Use dynamic proxy instead of DeltaSpike proxy when not using CDI
- Enabled SSL hostname verification by default
- Added EE Component dependency information
Bugs
- Properly forward JSON parsing exceptions
- Proper integration with JSON-P
v1.1.0
We are pleased to announce the release of KumuluzEE Rest Client 1.1.0. This release supports asynchronous requests and client builder interceptors. KumuluzEE Rest Client 1.1.0 implements the MicroProfile Rest Client 1.1 specification.
Asynchronous requests are now possible with the updated Rest Client. To make an request asynchronous, change the return type of the interface method to CompletionStage
.
Example of an asynchronous request definition:
@POST
CompletionStage<Void> createCustomerAsynch(Customer customer);
The defined method can then be used to make asynchronous requests. For example:
customerApi.createCustomerAsynch(c)
.toCompletableFuture().get();
Implementation of interceptors fired when a new client is being built is also now supported. This includes CDI clients that are built at the start of the application. To create an interceptor implement the RestClientBuilderListener
interface and register the implementing class in a service file. For example:
public class BuilderListener implements RestClientBuilderListener {
@Override
public void onNewBuilder(RestClientBuilder builder) {
// ...
}
}
Sample showcasing asynchronous requests has been updated and is available at KumuluzEE Rest Client sample.
v1.0.1
We're happy to announce the first release of KumuluzEE Rest Client. This release implements the MicroProfile Rest Client 1.0.1 specification.
KumuluzEE MicroProfile Rest Client supports generation of rest clients from simple definitions. APIs are defined using interfaces and well-known JAX-RS annotations. Generated rest clients provide a type-safe way to invoke defined APIs and support a wide variety of providers which allow fine-grained but natural configuration at various stages of requests.
Example of a simple API definition:
@Path("orders")
@RegisterRestClient
@Dependent
public interface SimpleApi {
@GET
@Path("{id}")
Order getById(@PathParam("id") long id);
}
The API invoker can then be injected using CDI and used to make requests to the described API:
@Inject
@RestClient
SimpleApi simpleApi;
public void processOrder() {
Order o = simpleApi.getById(1);
// ...
}
Sample showcasing various features is already available at KumuluzEE Rest Client sample.
We are happy to bring this extension into your hands!