Skip to content

[CAMEL 21975] Jbang diagram command to visualize camel routes#21534

Open
vignesh-manel wants to merge 8 commits intoapache:mainfrom
vignesh-manel:CAMEL-21975
Open

[CAMEL 21975] Jbang diagram command to visualize camel routes#21534
vignesh-manel wants to merge 8 commits intoapache:mainfrom
vignesh-manel:CAMEL-21975

Conversation

@vignesh-manel
Copy link
Contributor

Description

Added Playwright-based PNG export for camel diagram via hawtio and Jolokia

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

@davsclaus
Copy link
Contributor

Thanks for helping with jbang. Can you make this into its own plugin as this should not be in the core.

You can look at one of the existing pluigins such as the new validate
https://github.com/apache/camel/tree/main/dsl/camel-jbang/camel-jbang-plugin-validate

Copy link
Contributor

@orpiske orpiske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea, I'm but I'm under the impression this would be better done as a plugin. Let's see what others think about it ...

@github-actions
Copy link
Contributor

🌟 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:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@vignesh-manel vignesh-manel marked this pull request as ready for review March 11, 2026 16:02
@vignesh-manel
Copy link
Contributor Author

@davsclaus @Croway @orpiske Refactored as plugin, please review

@Croway
Copy link
Contributor

Croway commented Mar 11, 2026

Nice @vignesh-manel , were you able to test everything locally? can you provide some commands and outputs?

@davsclaus
Copy link
Contributor

there are changes to camel-launcher / camel-jbang run etc - that is of course a bit more worring since this plugin should not break existing behaviour.

And what web browsers and OS does this work on ? Is it only google chrome ?

@davsclaus davsclaus force-pushed the CAMEL-21975 branch 2 times, most recently from b0c5839 to 1638a5c Compare March 12, 2026 10:31
@vignesh-manel
Copy link
Contributor Author

Nice @vignesh-manel , were you able to test everything locally? can you provide some commands and outputs?

I tested with the jar locally using below command from camel-launcher directory, it requires a browser executable which is compatible with chromium

java -jar target/camel-launcher-4.19.0-SNAPSHOT.jar diagram ../camel-jbang-core/src/test/resources/hello.yaml --output=hello.png --playwright-browser-path="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

if --output is not specified it will open the hawtio console, where the integration can be viewed
if --keep-running option is provided, the integration will keep running in the background
--name=hello can be provided to capture diagram of integration which is already running in the background
--route-id=xyz can be provided if a there are multiple routes to capture diagram of specific route

@vignesh-manel
Copy link
Contributor Author

there are changes to camel-launcher / camel-jbang run etc - that is of course a bit more worring since this plugin should not break existing behaviour.

And what web browsers and OS does this work on ? Is it only google chrome ?

I tried to simplify the changes, right now any chromium based browser is supported, I have tested it only in MacOS

@davsclaus
Copy link
Contributor

Nice @vignesh-manel , were you able to test everything locally? can you provide some commands and outputs?

I tested with the jar locally using below command from camel-launcher directory, it requires a browser executable which is compatible with chromium

java -jar target/camel-launcher-4.19.0-SNAPSHOT.jar diagram ../camel-jbang-core/src/test/resources/hello.yaml --output=hello.png --playwright-browser-path="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

if --output is not specified it will open the hawtio console, where the integration can be viewed if --keep-running option is provided, the integration will keep running in the background --name=hello can be provided to capture diagram of integration which is already running in the background --route-id=xyz can be provided if a there are multiple routes to capture diagram of specific route

I think this information would be good to add to the documentation, with that little example so others better can understand how to use this feature


=== Visualizing routes with diagram

The `camel diagram` command uses Hawtio to visualize Camel routes. You can run route files in the background and open Hawtio in a browser:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the diagram is a plugin you need to install first via camel plugin add diagram

also I think there is some code where we have a known list of plugins we ship so diagram should be added there also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

camel diagram routes.yaml --output=routes.png --playwright-browser-path=/path/to/chrome
----

When using `--output`, Hawtio runs headless and the PNG is captured automatically.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good idea is to add that actual long command you typed to run on your mac, as mac users need to point to that /Content/XXX or whatever inside those apps - so users would maybe struggle if they dont have a real working example to see

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@davsclaus
Copy link
Contributor

btw I read on social media about a new zig rewritten browser that was headless for AI agents only - it was much faster to launch and supported playwright.

@vignesh-manel
Copy link
Contributor Author

vignesh-manel commented Mar 14, 2026

btw I read on social media about a new zig rewritten browser that was headless for AI agents only - it was much faster to launch and supported playwright.

Is it this? https://github.com/lightpanda-io/browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants