You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to understand how to use the openapi-generator generated vertx client code in A Quarkus application that is based on Vertx. It generates client code like this:
`ApiClient apiClient = new ApiClient(vertx, new JsonObject());
AddressGeocodeApi addressGeocodeApi = new AddressGeocodeApiImpl(apiClient);
addressGeocodeApi.addressGeocode("json", fullAddress, API_KEY, new Handler<AsyncResult>() { @OverRide public void handle(AsyncResult event) {
}
});`
So how to integrate the above in the Quarkus application?
I assumed it would be something like this:
`@Inject Vertx vertx;
CompletableFuture completable = new CompletableFuture<>();
ApiClient apiClient = new ApiClient(vertx, new JsonObject());
try {
final AddressGeocodeApi addressGeocodeApi = new AddressGeocodeApiImpl(apiClient);
addressGeocodeApi.addressGeocode("json", fullAddress, API_KEY, res -> {
if (res.failed()) {
completable.completeExceptionally(res.cause());
} else {
completable.complete(res.result());
}
});
// Block until the Vert.x worker thread provides its result.
return completable.get();
} catch (Exception e) {
// Handle exception
} finally {
apiClient.getWebClient().close();
}`
But I get this error at runtime:
Access to Context.put(), Context.get() and Context.remove() are forbidden as it can leak data between unrelated processing. Use Context.putLocal(), Context.getLocal() and Context.removeLocal() instead. Note that these methods can only be used from a 'duplicated' Context, and so may not be available everywhere.
How to resolve?
I tried using a CompletableFuture<> to handle the success/failure. And I am getting the Vertx instance from Quarkus framework.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to understand how to use the openapi-generator generated vertx client code in A Quarkus application that is based on Vertx. It generates client code like this:
`ApiClient apiClient = new ApiClient(vertx, new JsonObject());
AddressGeocodeApi addressGeocodeApi = new AddressGeocodeApiImpl(apiClient);
addressGeocodeApi.addressGeocode("json", fullAddress, API_KEY, new Handler<AsyncResult>() { @OverRide public void handle(AsyncResult event) {
So how to integrate the above in the Quarkus application?
I assumed it would be something like this:
`@Inject Vertx vertx;
CompletableFuture completable = new CompletableFuture<>();
But I get this error at runtime:
Access to Context.put(), Context.get() and Context.remove() are forbidden as it can leak data between unrelated processing. Use Context.putLocal(), Context.getLocal() and Context.removeLocal() instead. Note that these methods can only be used from a 'duplicated' Context, and so may not be available everywhere.
How to resolve?
I tried using a CompletableFuture<> to handle the success/failure. And I am getting the Vertx instance from Quarkus framework.
Beta Was this translation helpful? Give feedback.
All reactions