From 27e752af2875b53d5ad3a92ce3f22751e3b3ba6f Mon Sep 17 00:00:00 2001 From: Mirko Zizzari Date: Mon, 5 Aug 2024 18:26:46 +0200 Subject: [PATCH] issue #922: handles json decoding in uni --- .../io/openk9/datasource/listener/JobScheduler.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/app/datasource/src/main/java/io/openk9/datasource/listener/JobScheduler.java b/core/app/datasource/src/main/java/io/openk9/datasource/listener/JobScheduler.java index 00fbe38e6..08b413ff9 100644 --- a/core/app/datasource/src/main/java/io/openk9/datasource/listener/JobScheduler.java +++ b/core/app/datasource/src/main/java/io/openk9/datasource/listener/JobScheduler.java @@ -408,12 +408,16 @@ private static Behavior onInvokePluginDriverInternal( switch (pluginDriver.getType()) { case HTTP: { - VertxUtil.runOnContext( - () -> httpPluginDriverClient.invoke( + + VertxUtil.runOnContext(() -> Uni.createFrom().item(() -> Json.decodeValue( pluginDriver.getJsonConfig(), HttpPluginDriverInfo.class - ), + ) + ) + .flatMap(httpPluginDriverInfo -> httpPluginDriverClient + .invoke( + httpPluginDriverInfo, HttpPluginDriverContext .builder() .timestamp(lastIngestionDate) @@ -423,6 +427,7 @@ private static Behavior onInvokePluginDriverInternal( .datasourceConfig(new JsonObject(datasource.getJsonConfig()).getMap()) .build() ) + ) .onItem() .invoke(() -> ctx .getSelf() @@ -433,6 +438,7 @@ private static Behavior onInvokePluginDriverInternal( .tell(new CancelScheduling(tenantName, scheduler)) ) ); + } }