-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAMEL-20361: camel-jbang - Make jolokia pluggable for camel-platform-http-main #12985
CAMEL-20361: camel-jbang - Make jolokia pluggable for camel-platform-http-main #12985
Conversation
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🤖 CI automation will test this PR automatically. 🐫 Apache Camel Committers, please review the following items:
|
/component-test camel-platform-http-main Result ✅ The tests passed successfully |
/component-test camel-jolokia Result ❌ The tests failed please check the logs |
🤖 The Apache Camel test robot will run the tests for you 👍 |
1 similar comment
🤖 The Apache Camel test robot will run the tests for you 👍 |
/** | ||
* Default {@link org.apache.camel.console.DevConsoleRegistry}. | ||
*/ | ||
@DevConsole("jolokia") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. @devconsole is only for camel-console type of consoles.
You need to come up with another annotation such as JdkFactory.
/component-test camel-jolokia Result ✅ The tests passed successfully |
🤖 The Apache Camel test robot will run the tests for you 👍 |
core/camel-api/pom.xml
Outdated
@@ -56,6 +56,13 @@ | |||
<scope>compile</scope> | |||
</dependency> | |||
|
|||
<dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camel-api should NOT have any other dependencies, this must be removed
/** | ||
* Factory to abstract the creation of the Jolokia HttpRequestHandler. | ||
*/ | ||
public interface JolokiaHttpRequestHandlerFactory extends StaticService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make a generic factory that just returns Object or / Class T so we can use this for other stuff we can plugin into http-server in the future.
@@ -370,6 +371,7 @@ protected void initPlugins() { | |||
camelContextExtension.lazyAddContextPlugin(AnnotationBasedProcessorFactory.class, | |||
this::createAnnotationBasedProcessorFactory); | |||
camelContextExtension.lazyAddContextPlugin(DumpRoutesStrategy.class, this::createDumpRoutesStrategy); | |||
camelContextExtension.lazyAddContextPlugin(JolokiaHttpRequestHandlerFactory.class, this::createJolokiaHttpRequestHandlerFactory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jolokia should only be discovered if enabled, eg that jolokiaEnabled option in camel-main
jolokia should be option and not in core at all. Instead there should be a more generic factory for platform-http, that can load jolokia and whatelse we add in the future. It should be platform-http that when it startup (doInit etc) will check if jolokia is configured to be enabled, and then use the factory to find the JAR (if present) and if present then create the factory and does what it need to do. If the JAR is not present then some exception is thrown. We do this elsewhere in Camel. |
@kulagaIA I wonder if you will get more time for this before start of next week, as that is the deadline where we will cut the next 4.4 LTS release. |
Inteding to finish before 12.02.24, is it ok? |
Yes |
ca3fea2
to
95323bb
Compare
/component-test camel-platform-http-main camel-platform-http camel-platform-http-jolokia Result ❌ The tests failed please check the logs |
🤖 The Apache Camel test robot will run the tests for you 👍 |
95323bb
to
579fe34
Compare
/component-test camel-platform-http-main camel-platform-http camel-platform-http-jolokia Result ✅ The tests passed successfully |
🤖 The Apache Camel test robot will run the tests for you 👍 |
Made PlatformHttpPluginRegistry in camel-platform-http to be a generic factory for platform-http, that can load jolokia and whatelse we add in the future. |
var jolokiaContext = serviceManager.start(); | ||
requestHandler = new HttpRequestHandler(jolokiaContext); | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
public void doStop() { | ||
serviceManager.stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add if (serviceManager != null)
...rm-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
Show resolved
Hide resolved
Sorry we have now updated main to 4.5.0-SNAPSHOT so you may need to update this PR a little bit, thanks |
9a248bb
to
84b7820
Compare
…http-main PlatformHttpPluginRegistry was made to resolve plugins for camel-platform-http. Jolokia is now camel-platform-http plugin
…http-main (apache#12985) * CAMEL-20361: camel-jbang - Make jolokia pluggable for camel-platform-http-main PlatformHttpPluginRegistry was made to resolve plugins for camel-platform-http. Jolokia is now camel-platform-http plugin * fix version and null check * up version
…http-main (apache#12985) * CAMEL-20361: camel-jbang - Make jolokia pluggable for camel-platform-http-main PlatformHttpPluginRegistry was made to resolve plugins for camel-platform-http. Jolokia is now camel-platform-http plugin * fix version and null check * up version
Description
camel-jolokia
is now a context plugin with@DevConsole
annotation.I was not able to generate file
core/camel-jolokia/src/generated/resources/META-INF/services/org/apache/camel/dev-console/jolokia
with thecamel-package-maven-plugin
. This file was added by hands, and it is possible that something is wrong withcamel-jolokia
maven configuration, or something is wrong with the maven plugin (see https://camel.zulipchat.com/#narrow/stream/364655-camel-core-dev/topic/how.20to.20add.20context.20plugin/near/419592914 ).Also added jolokia to example repo: apache/camel-examples#133
Tracking
https://issues.apache.org/jira/browse/CAMEL-20361