This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new b1ba5b9df6d CAMEL-21958: camel-core: Java DSL. Fix endChoice() to reuse end() and scope to current/nearest choice. b1ba5b9df6d is described below commit b1ba5b9df6d86e29457a40b7a7eaafde33211cdc Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Apr 16 18:25:45 2025 +0200 CAMEL-21958: camel-core: Java DSL. Fix endChoice() to reuse end() and scope to current/nearest choice. --- .../ROOT/pages/camel-4x-upgrade-guide-4_10.adoc | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_10.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_10.adoc index b39cb611c15..e86f2246307 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_10.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_10.adoc @@ -4,6 +4,63 @@ This document is for helping you upgrade your Apache Camel application from Camel 4.x to 4.y. For example, if you are upgrading Camel 4.0 to 4.2, then you should follow the guides from both 4.0 to 4.1 and 4.1 to 4.2. +== Upgrading from 4.10.3 to 4.10.4 + +=== Java DSL + +When using Choice EIP then in some situations you may need to use `.endChoice()` +to be able to either continue added more nodes to the current Choice EIP, or that you +are working with nested Choice EIPs (choice inside choice), then you may also need to use `endChoice` +to go back to the parent choice to continue from there. + +However, there has been some regressions from upgrading older Camel releases to 4.11, and therefore +we have refactored `endChoice` to work more consistent. + +For example the following code + +[source,java] +---- +from("direct:start") + .choice() + .when(header("foo").isGreaterThan(1)) + .choice() + .when(header("foo").isGreaterThan(5)) + .to("mock:big") + .otherwise() + .to("mock:med") + .endChoice() + .otherwise() + .to("mock:low") + .end(); +---- + +Should now be + +[source,java] +---- +from("direct:start") + .choice() + .when(header("foo").isGreaterThan(1)) + .choice() + .when(header("foo").isGreaterThan(5)) + .to("mock:big") + .otherwise() + .to("mock:med") + .end().endChoice() + .otherwise() + .to("mock:low") + .end(); +---- + +Notice that the `endChoice` is changed to `end().endChoice()`. This is required to be consistent +to end the current choice (inner) and then afterwards change the scope to be Choice EIP to be able to +continue in the outer Choice. Otherwise the Java DSL cannot know the scope is Choice EIP and you would +not be able to add the `otherwise` block to the outer Choice. + +== Upgrading from 4.10.2 to 4.10.3 + +No changes + == Upgrading from 4.10.1 to 4.10.2 === EIPs