-
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.
- Loading branch information
1 parent
20a63aa
commit 779e1a3
Showing
17 changed files
with
737 additions
and
17 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
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
21 changes: 21 additions & 0 deletions
21
...l-k-runtime-core/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener
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,21 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
org.apache.camel.k.listener.ContextConfigurer | ||
org.apache.camel.k.listener.ContextLifecycleConfigurer | ||
org.apache.camel.k.listener.RoutesConfigurer | ||
org.apache.camel.k.listener.RoutesDumper |
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,134 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>org.apache.camel.k</groupId> | ||
<artifactId>camel-k-runtime-parent</artifactId> | ||
<version>0.3.1-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>camel-k-runtime-health</artifactId> | ||
|
||
<dependencies> | ||
|
||
<!-- ****************************** --> | ||
<!-- --> | ||
<!-- RUNTIME --> | ||
<!-- --> | ||
<!-- ****************************** --> | ||
|
||
<dependency> | ||
<groupId>org.apache.camel.k</groupId> | ||
<artifactId>camel-k-runtime-core</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-netty4-http</artifactId> | ||
</dependency> | ||
|
||
<!-- ****************************** --> | ||
<!-- --> | ||
<!-- TESTS --> | ||
<!-- --> | ||
<!-- ****************************** --> | ||
|
||
<dependency> | ||
<groupId>org.apache.camel.k</groupId> | ||
<artifactId>camel-k-runtime-jvm</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit-jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit-jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${assertj.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
<version>${log4j2.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-slf4j-impl</artifactId> | ||
<version>${log4j2.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<profiles> | ||
<profile> | ||
<id>camel3</id> | ||
<activation> | ||
<property> | ||
<name>camel3</name> | ||
</property> | ||
</activation> | ||
<dependencies> | ||
<!-- runtime --> | ||
<dependency> | ||
<groupId>org.apache.camel.k</groupId> | ||
<artifactId>camel-k-adapter-camel-3</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<!-- test --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-properties</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
<profile> | ||
<id>camel2</id> | ||
<activation> | ||
<property> | ||
<name>!camel3</name> | ||
</property> | ||
</activation> | ||
<dependencies> | ||
<!-- runtime --> | ||
<dependency> | ||
<groupId>org.apache.camel.k</groupId> | ||
<artifactId>camel-k-adapter-camel-2</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
84 changes: 84 additions & 0 deletions
84
camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthConfigurer.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,84 @@ | ||
/** | ||
* 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.k.health; | ||
|
||
import org.apache.camel.k.Runtime; | ||
import org.apache.camel.spi.HasId; | ||
|
||
public class HealthConfigurer implements Runtime.Listener, HasId { | ||
public static final String ID = "endpoint.health"; | ||
public static final String DEFAULT_BIND_HOST = "0.0.0.0"; | ||
public static final int DEFAULT_BIND_PORT = 8081; | ||
public static final String DEFAULT_PATH = "/health"; | ||
|
||
private HealthEndpoint endpoint; | ||
|
||
private String bindHost; | ||
private int bindPort; | ||
private String path; | ||
|
||
public HealthConfigurer() { | ||
this.bindHost = DEFAULT_BIND_HOST; | ||
this.bindPort = DEFAULT_BIND_PORT; | ||
this.path = DEFAULT_PATH; | ||
} | ||
|
||
public String getBindHost() { | ||
return bindHost; | ||
} | ||
|
||
public void setBindHost(String bindHost) { | ||
this.bindHost = bindHost; | ||
} | ||
|
||
public int getBindPort() { | ||
return bindPort; | ||
} | ||
|
||
public void setBindPort(int bindPort) { | ||
this.bindPort = bindPort; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public void setPath(String path) { | ||
this.path = path; | ||
} | ||
|
||
@Override | ||
public void accept(Runtime.Phase phase, Runtime runtime) { | ||
try { | ||
if (phase == Runtime.Phase.Starting) { | ||
endpoint = new HealthEndpoint(runtime.getContext(), bindHost, bindPort, path); | ||
endpoint.start(); | ||
} else if (phase == Runtime.Phase.Stopping) { | ||
if (endpoint != null) { | ||
endpoint.stop(); | ||
} | ||
} | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public String getId() { | ||
return ID; | ||
} | ||
} |
Oops, something went wrong.