camel-idea-plugin icon indicating copy to clipboard operation
camel-idea-plugin copied to clipboard

[Debugger]Avoid need to modify pom.xml to support DataSonnet language

Open apupier opened this issue 3 years ago • 5 comments

currently to evaluate expressions using DataSonnet in debugger, you need to add to the pom.xml:

    <dependency>
        <groupId>org.apache.camel.springboot</groupId>
        <artifactId>camel-datasonnet-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>2.13.3</version>
    </dependency>

it is modifying the user project. it would be nice if these dependencies can be injected automatically when needed

apupier avatar Dec 24 '21 07:12 apupier

Yeah we should actually go the other way. That languages shown in that "list" is only languages that are available in the running Camel application.

The intention is not that you can run any languages "as you wish" but use the languages that your Camel application are using.

davsclaus avatar Dec 24 '21 08:12 davsclaus

I like this idea, but is there any way in the plugin or in Camel to obtain a list of all languages in the classpath?

javaduke avatar Dec 24 '21 17:12 javaduke

We can see from the JARs on the classpath which ones are langauges and via the camel-catalog find out their names.

An alternative is via JMX but then its "only languages that are active in use", eg you may have camel-datasonnet on classpath but it has not been in use yet, then its not registered in camel contexxt.

davsclaus avatar Dec 25 '21 08:12 davsclaus

Ah, the resolving the new language is taken care of in the ManagedBacklogDebugger, it calls camelContext.resolveLanguage() before evaluating the expression. So by "via JMX" did you mean there's an existing functionality that I can use or that we need to implement a new call? Perhaps add something like getResolvedLanguages() to the Camel context?

javaduke avatar Dec 25 '21 16:12 javaduke

Yeah I am adding JMX operations to the CamelContextMBean https://issues.apache.org/jira/browse/CAMEL-17383

davsclaus avatar Dec 26 '21 09:12 davsclaus