UPDATED ON 17 May 2021: More recent related content available in this blogpost.
Camel K 1.3.0 is providing a new feature to Java debug deployed integrations. Even if Camel K 1.3.0 is not fully compatible with VS Code Tooling for Apache Camel K extension, it remains possible to leverage the VS Code Java debugging capabilities.
I recorded a video which is following the steps in this blogpost. I let you choose your preferred way to discover how to java debug your Camel K integration in VS Code.
To have a breakpoint during the execution of the Camel Route, as opposite at the creation of the Camel Route, you need to add a small piece of code. This is a classical trick for Java debugging of Camel Routes, not specific to Camel K.
The trick consists of adding a Processor between the steps you want to observe. It will be something like:
.process(new Processor(){ @Override public void process(Exchange exchange) throws Exception { System.out.println("can be breakpoint on this line"); } })
Then, you can add a breakpoint to the line by clicking in the left ruler. A red dot will appear.
You can then start the integration:
Note: If starting in --dev, it will allow to automatically reload the Integration. But take care, debugger will need to be restarted on each change. Meaning that the next two steps will need to be repeated.
Note: Take care to use the kamel 1.3.0 binaries.
Now, it is time to enjoy. You can notice that you have access to the message content. It is providing a good insight into what is going on in the Camel Route.
There is room for improvements, provide your feedback and ideas!
You can start discussions on Zulip camel-tooling channel.
You can create and vote for issues on GitHub VS Code Tooling support for Apache Camel K repository.
You can create and vote for issues on the related epic in Jira which is used by the Red Hat Integration tooling team.