camel-karavan
camel-karavan copied to clipboard
JBang - run in JVM debug mode so you can do JVM remote debugging
We should find out if we can launch jbang in JVM debug mode (there are some JVM flags you need to turn on, to make it debug mode on port 5005, and suspend=y etc.
And if so we should find out if we can make VSCode detect this and be able to debug the Camel code. Not sure how easy it is for it to know which JARs to have on its project and so on.
But its also a more general problem with jbang, so we can talk to Max about this.
I think this feature outside Karavan for now. If we have yaml route debugger in VSCode perhaps we could try to visualize it on the diagram.
If we have yaml route debugger in VSCode perhaps we could try to visualize it on the diagram.
The Camel route debugger for yaml dsl is now available: https://www.youtube.com/watch?v=GEQHexFKWcQ&list=PLU-T8l-XOWOPjrXPojx2WDSegigcNzKs4&index=4
Given that with latest version, JMX is supported, this other video can be interesting https://www.youtube.com/watch?v=YSr-FccRgms&list=PLU-T8l-XOWOPjrXPojx2WDSegigcNzKs4&index=2&t=37s
That said, the Camel route debugger for yaml dsl is a different kind of debugging than the JVM debug. The JVM debug is also possible to attach to a running process
documentation for jbang in debug mode https://www.jbang.dev/documentation/guide/latest/debugging.html
so basically would mean to add the --debug
and it will automatically open debug port 4004
- Karavan works as VS Code extension and web app (standalone and in kubernetes). Debug should somehow works in both.
- If I understand correctly Debug uses line number to be known. In that case we need first to make a new yaml-to-integration parser because the current one (js-yaml) does not provide this info.
Yesterday I tried the vscode camel debugger and with a bit of configuring those config files then made it work. I could debug camel jbang for yaml files.
I think in .java then vscode would set the breakpoint as a java breakpoint so that was not possible.
Also I added camel-debug always so its included https://github.com/apache/camel/commit/ae2997944e49f29b64aebfed9151507cf8b16bcf
I think in .java then vscode would set the breakpoint as a java breakpoint so that was not possible.
Unless I misunderstood the use case, it is working (cannot combine the task and the launch config, shoudl require extra configuration):
Also I added camel-debug always so its included apache/camel@ae29979
camel-jbang cannot be used in production?
cannot combine the task and the launch config, shoudl require extra configuration
managed to have teh single-click working.
.vscode/tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Start Camel application in debug with Jbang",
"type": "shell",
"command": "jbang",
"args": [
"-Dcamel.jbang.version=3.16.0",
"camel@apache/camel",
"run",
"${relativeFile}",
"--max-messages=100",
"--logging-level=info",
"--reload",
"--dep=org.apache.camel:camel-debug"
],
"group": "none",
"isBackground": true,
"problemMatcher": { // Problem matcher is mandatory to avoid a dialog warning on each launch but cannot find a good way to configure it
"owner": "camel",
"pattern": {
"regexp": "^.*$"
},
"severity": "error",
"source": "maven",
"background": {
"activeOnStart": true,
"beginsPattern": "^.*$",
"endsPattern": "^.*JMX Connector thread started and listening at.*$"
}
},
"presentation": {
"reveal": "always"
}
}
]
}
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Run with Camel Debugger",
"type": "apache.camel",
"request": "attach",
"preLaunchTask": "Start Camel application in debug with Jbang" // This must match the label provided as task
}
]
}
Will be implemented as a part of #151
Will be implemented as a part of #151
Java debugging and Camel debugging are 2 different things. Both functionnaly and technically behind the scenes. I think both issues should stay opened as they can be handled completely independently