-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
knative: split producer and consumer #521
- Loading branch information
1 parent
c9ada01
commit d3e54ee
Showing
19 changed files
with
378 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...tive-api/src/main/java/org/apache/camel/component/knative/spi/KnativeProducerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.camel.component.knative.spi; | ||
|
||
import org.apache.camel.Endpoint; | ||
import org.apache.camel.Producer; | ||
import org.apache.camel.Service; | ||
|
||
public interface KnativeProducerFactory extends Service { | ||
/** | ||
* Create a camel {@link Producer} in place of the original endpoint for a specific protocol. | ||
* | ||
* @param endpoint the endpoint for which the producer should be created | ||
* @param configuration the general transport configuration | ||
* @param service the service definition containing information about how make reach the target service. | ||
* @return | ||
*/ | ||
Producer createProducer( | ||
Endpoint endpoint, | ||
KnativeTransportConfiguration configuration, | ||
KnativeEnvironment.KnativeResource service); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...ttp/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.camel.component.knative.http; | ||
|
||
import java.util.Objects; | ||
|
||
import io.vertx.ext.web.Router; | ||
import org.apache.camel.CamelContext; | ||
import org.apache.camel.CamelContextAware; | ||
import org.apache.camel.Consumer; | ||
import org.apache.camel.Endpoint; | ||
import org.apache.camel.Processor; | ||
import org.apache.camel.component.knative.spi.KnativeConsumerFactory; | ||
import org.apache.camel.component.knative.spi.KnativeEnvironment; | ||
import org.apache.camel.component.knative.spi.KnativeTransportConfiguration; | ||
import org.apache.camel.support.service.ServiceSupport; | ||
|
||
public class KnativeHttpConsumerFactory extends ServiceSupport implements CamelContextAware, KnativeConsumerFactory { | ||
private Router router; | ||
private CamelContext camelContext; | ||
|
||
public Router getRouter() { | ||
return router; | ||
} | ||
|
||
public KnativeHttpConsumerFactory setRouter(Router router) { | ||
this.router = router; | ||
return this; | ||
} | ||
|
||
@Override | ||
public void setCamelContext(CamelContext camelContext) { | ||
this.camelContext = camelContext; | ||
} | ||
|
||
@Override | ||
public CamelContext getCamelContext() { | ||
return camelContext; | ||
} | ||
|
||
@Override | ||
public Consumer createConsumer(Endpoint endpoint, KnativeTransportConfiguration config, KnativeEnvironment.KnativeResource service, Processor processor) { | ||
Objects.requireNonNull(this.router, "router"); | ||
|
||
return new KnativeHttpConsumer( | ||
config, | ||
endpoint, | ||
service, | ||
this.router, | ||
processor); | ||
} | ||
|
||
} |
Oops, something went wrong.