Skip to content

Commit

Permalink
Fixed knative after change of CAMEL-21358
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriOndrusek committed Nov 7, 2024
1 parent 107fb1b commit c4a33ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.vertx.core.deployment.CoreVertxBuildItem;
import io.quarkus.vertx.http.deployment.VertxWebRouterBuildItem;
import org.apache.camel.CamelContext;
import org.apache.camel.component.knative.KnativeComponent;
import org.apache.camel.component.knative.KnativeConstants;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
import org.apache.camel.component.knative.spi.KnativeResource;
import org.apache.camel.quarkus.component.knative.KnativeConsumerRecorder;
import org.apache.camel.quarkus.component.knative.KnativeProducerRecorder;
import org.apache.camel.quarkus.component.knative.KnativeRecorder;
import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
import org.apache.camel.quarkus.core.deployment.spi.CamelRuntimeBeanBuildItem;
import org.apache.camel.quarkus.core.deployment.spi.CamelServiceFilter;
import org.apache.camel.quarkus.core.deployment.spi.CamelServiceFilterBuildItem;
Expand Down Expand Up @@ -92,12 +95,15 @@ CamelRuntimeBeanBuildItem knativeConsumerCustomizer(
@Record(ExecutionTime.RUNTIME_INIT)
@BuildStep
CamelRuntimeBeanBuildItem knativeProducerCustomizer(
CamelContextBuildItem context,
KnativeProducerRecorder recorder,
CoreVertxBuildItem vertx) {

RuntimeValue<CamelContext> camelContext = context.getCamelContext();

return new CamelRuntimeBeanBuildItem(
FEATURE + "-producer-customizer",
ComponentCustomizer.class.getName(),
recorder.createKnativeProducerFactoryCustomizer(vertx.getVertx()));
recorder.createKnativeProducerFactoryCustomizer(camelContext, vertx.getVertx()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
import io.vertx.core.Vertx;
import org.apache.camel.CamelContext;
import org.apache.camel.Component;
import org.apache.camel.component.knative.KnativeComponent;
import org.apache.camel.component.knative.http.KnativeHttpProducerFactory;
import org.apache.camel.spi.ComponentCustomizer;

@Recorder
public class KnativeProducerRecorder {
public RuntimeValue<ComponentCustomizer> createKnativeProducerFactoryCustomizer(Supplier<Vertx> vertx) {
public RuntimeValue<ComponentCustomizer> createKnativeProducerFactoryCustomizer(RuntimeValue<CamelContext> context, Supplier<Vertx> vertx) {
KnativeHttpProducerFactory factory = new KnativeHttpProducerFactory();
factory.setVertx(vertx.get());
factory.setCamelContext(context.getValue());

ComponentCustomizer cf = new ComponentCustomizer() {
@Override
Expand Down

0 comments on commit c4a33ed

Please sign in to comment.