Skip to content

Conversation

@essobedo
Copy link
Contributor

Fix for https://issues.apache.org/jira/browse/CAMEL-18217

Motivation

Up to now when using the BacklogDebugger there is no easy way to suspend all messages before ensuring that all breakpoints have been defined. This can particularly be a problem when debugging an application with a very short lifetime like a test.

Modifications

  • Define a system variable CAMEL_DEBUGGER_SUSPEND to suspend the message processing at startup
  • Add methods attach and detach to respectively resume and suspend message processing when CAMEL_DEBUGGER_SUSPEND is set to true
  • Add junit-pioneer as test dependency to be able to set the value of an environment variable within the context of a Unit test.
  • Add some doc to describe it

Result

I could debug following the steps described in the blog post without the additional sleep by setting the environment variable and invoking manually attach (will be done by https://github.com/camel-tooling/camel-debug-adapter once this PR is merged).

@github-actions
Copy link
Contributor

🚫 There are (likely) no components to be tested in this PR

@essobedo
Copy link
Contributor Author

@davsclaus Using an environment variable to enable the feature is good enough for you? And if what about the name? do you have a better name in mind?

@davsclaus
Copy link
Contributor

Yeah - We may consider a

mvn camel:debug goal that can set this automatic, so users can run Camel in debug mode with this out of the box.

https://github.com/apache/camel/tree/main/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven

@essobedo
Copy link
Contributor Author

Yeah - We may consider a

mvn camel:debug goal that can set this automatic, so users can run Camel in debug mode with this out of the box.

https://github.com/apache/camel/tree/main/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven

@davsclaus Interesting, maybe it can be done in another PR, WDYT?

@davsclaus
Copy link
Contributor

Yeah in another PR

@essobedo essobedo merged commit ad75186 into main Jun 23, 2022
@essobedo essobedo deleted the CAMEL-18217/suspend-messages branch June 23, 2022 14:02
@essobedo
Copy link
Contributor Author

The ticket for this feature https://issues.apache.org/jira/browse/CAMEL-18223

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.

2 participants