You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2019/10/13 20:45:55 UTC

[GitHub] [camel-k-runtime] lburgazzoli commented on a change in pull request #153: Support Knative broker/trigger model

lburgazzoli commented on a change in pull request #153: Support Knative broker/trigger model
URL: https://github.com/apache/camel-k-runtime/pull/153#discussion_r334295892
 
 

 ##########
 File path: camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpTransport.java
 ##########
 @@ -146,74 +191,19 @@ protected void doShutdown() throws Exception {
         }
     }
 
-    @Override
-    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
-        Matcher matcher = KnativeHttp.ENDPOINT_PATTERN.matcher(remaining);
-        if (!matcher.find()) {
-            throw new IllegalArgumentException("Bad URI: " + remaining);
-        }
-
-        KnativeHttpEndpoint ep = new KnativeHttpEndpoint(uri, this);
-        ep.setHeaderFilter(PropertiesHelper.extractProperties(parameters, "filter.", true));
-
-        switch (matcher.groupCount()) {
-        case 1:
-            ep.setHost(matcher.group(1));
-            ep.setPort(KnativeHttp.DEFAULT_PORT);
-            ep.setPath(KnativeHttp.DEFAULT_PATH);
-            break;
-        case 2:
-            ep.setHost(matcher.group(1));
-            ep.setPort(parseInt(matcher.group(2)));
-            ep.setPath(KnativeHttp.DEFAULT_PATH);
-            break;
-        case 3:
-            ep.setHost(matcher.group(1));
-            ep.setPort(parseInt(matcher.group(2)));
-            ep.setPath(KnativeHttp.DEFAULT_PATH + matcher.group(3));
-            break;
-        default:
-            throw new IllegalArgumentException("Bad URI: " + remaining);
-        }
-
-        setProperties(ep, parameters);
-
-        return ep;
-    }
-
-    public Vertx getVertx() {
-        return vertx;
-    }
-
-    public void setVertx(Vertx vertx) {
-        this.vertx = vertx;
-    }
-
-    public VertxOptions getVertxOptions() {
-        return vertxOptions;
-    }
-
-    public void setVertxOptions(VertxOptions vertxOptions) {
-        this.vertxOptions = vertxOptions;
-    }
-
-    public HttpServerOptions getVertxHttpServerOptions() {
-        return vertxHttpServerOptions;
-    }
-
-    public void setVertxHttpServerOptions(HttpServerOptions vertxHttpServerOptions) {
-        this.vertxHttpServerOptions = vertxHttpServerOptions;
-    }
+    // *****************************
+    //
+    //
+    //
+    // *****************************
 
-    public WebClientOptions getVertxHttpClientOptions() {
-        return vertxHttpClientOptions;
-    }
-
-    public void setVertxHttpClientOptions(WebClientOptions vertxHttpClientOptions) {
-        this.vertxHttpClientOptions = vertxHttpClientOptions;
+    @Override
+    public Producer createProducer(Endpoint endpoint, KnativeEnvironment.KnativeServiceDefinition service) {
+        return new KnativeHttpProducer(this, endpoint, service, vertx, vertxHttpClientOptions);
     }
 
-    KnativeHttpConsumerDispatcher getDispatcher(KnativeHttp.ServerKey key) {
-        return registry.computeIfAbsent(key, k -> new KnativeHttpConsumerDispatcher(executor, vertx, k, vertxHttpServerOptions));
+    @Override
+    public Consumer createConsumer(Endpoint endpoint, KnativeEnvironment.KnativeServiceDefinition service, Processor processor) {
+        return new KnativeHttpConsumer(this, endpoint, service, processor);
 
 Review comment:
   this is invoked by `KnativeEndpoint::createConsumer`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services