-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kamelets: load templates at build time
- Loading branch information
1 parent
4b8aef4
commit ca8083a
Showing
12 changed files
with
327 additions
and
2 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
33 changes: 33 additions & 0 deletions
33
...untime/src/main/java/org/apache/camel/quarkus/component/kamelet/KameletConfiguration.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,33 @@ | ||
/* | ||
* 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.quarkus.component.kamelet; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
|
||
@ConfigRoot(name = "camel.kamelet", phase = ConfigPhase.BUILD_TIME) | ||
public class KameletConfiguration { | ||
/** | ||
* List of kamelets. | ||
*/ | ||
@ConfigItem | ||
public Optional<List<String>> kamelets; | ||
} |
42 changes: 42 additions & 0 deletions
42
...let/runtime/src/main/java/org/apache/camel/quarkus/component/kamelet/KameletRecorder.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,42 @@ | ||
/* | ||
* 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.quarkus.component.kamelet; | ||
|
||
import java.util.List; | ||
|
||
import io.quarkus.runtime.RuntimeValue; | ||
import io.quarkus.runtime.annotations.Recorder; | ||
import org.apache.camel.CamelContext; | ||
import org.apache.camel.model.Model; | ||
import org.apache.camel.model.RouteTemplateDefinition; | ||
import org.apache.camel.quarkus.core.CamelContextCustomizer; | ||
|
||
@Recorder | ||
public class KameletRecorder { | ||
public RuntimeValue<CamelContextCustomizer> createTemplateLoaderCustomizer(List<RouteTemplateDefinition> definitions) { | ||
return new RuntimeValue<>(new CamelContextCustomizer() { | ||
@Override | ||
public void customize(CamelContext context) { | ||
try { | ||
context.getExtension(Model.class).addRouteTemplateDefinitions(definitions); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
}); | ||
} | ||
} |
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
51 changes: 51 additions & 0 deletions
51
integration-tests/kamelet/src/main/resources/camel/kamelets/injector.yaml
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,51 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
apiVersion: camel.apache.org/v1alpha1 | ||
kind: Kamelet | ||
metadata: | ||
name: injector-source-v1alpha1 | ||
labels: | ||
camel.apache.org/kamelet.type: "source" | ||
camel.apache.org/kamelet.name: "injector" | ||
camel.apache.org/kamelet.version: "v1alpha1" | ||
camel.apache.org/kamelet.revision: "1" | ||
spec: | ||
definition: | ||
title: "Injector" | ||
description: "Inject Data" | ||
properties: | ||
delay: | ||
title: Delay | ||
description: Delay | ||
type: string | ||
default: "1s" | ||
types: | ||
out: | ||
mediaType: application/json | ||
dependencies: | ||
- "camel:timer" | ||
flow: | ||
from: | ||
uri: timer | ||
properties: | ||
timerName: "{{routeId}}" | ||
period: "{{delay}}" | ||
steps: | ||
- set-body: | ||
exchange-property: "CamelTimerCounter" | ||
- to: "kamelet:sink" |
56 changes: 56 additions & 0 deletions
56
integration-tests/kamelet/src/main/resources/camel/kamelets/logger.yaml
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,56 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
apiVersion: camel.apache.org/v1alpha1 | ||
kind: Kamelet | ||
metadata: | ||
labels: | ||
camel.apache.org/kamelet.type: "sink" | ||
camel.apache.org/kamelet.name: "log" | ||
camel.apache.org/kamelet.version: "v1alpha1" | ||
spec: | ||
definition: | ||
title: "Logger" | ||
description: "Logger" | ||
properties: | ||
loggerName: | ||
title: Name of the logging category | ||
description: Name of the logging category | ||
type: string | ||
default: "logger" | ||
showAll: | ||
title: Show All | ||
description: Show All | ||
type: boolean | ||
default: false | ||
multiLine: | ||
title: Multi Line | ||
description: Multi Line | ||
type: boolean | ||
default: false | ||
dependencies: | ||
- "camel:log" | ||
flow: | ||
from: | ||
uri: "kamelet:source" | ||
steps: | ||
- to: | ||
uri: "log" | ||
properties: | ||
loggerName: "{{loggerName}}" | ||
showAll: "{{showAll}}" | ||
multiline: "{{multiLine}}" |
Oops, something went wrong.