janwesterkamp commented on issue #7541:
URL: https://github.com/apache/camel-quarkus/issues/7541#issuecomment-3129410434

   I fixed the example above by replacing all the occurrences of .endChoice() 
with .end().endChoice():
   
   ```
         from("direct:test-route")
           .setBody(constant("Test"))
           .setHeader("test", constant("B"))
           .setHeader("test2", constant("X"))
           .log(LoggingLevel.INFO, "Processing choice level 0 before 
test=${header.test}")
           .log(LoggingLevel.INFO, "Processing choice level 0 before 
test2=${header.test2}")
           .choice()
             .when(header("test").isEqualTo("A"))
               .log(LoggingLevel.INFO, "Processing choice level 1 when 
test=${header.test}")
             .when(header("test").isEqualTo("B"))
               .log(LoggingLevel.INFO, "Processing choice level 1 when 
test=${header.test}")
               .choice()
                 .when(header("test2").isEqualTo("A"))
                   .log(LoggingLevel.INFO, "Processing choice level 2 when 
test2=${header.test2}")
                 .when(header("test2").isEqualTo("B"))
                   .log(LoggingLevel.INFO, "Processing choice level 2 when 
test2=${header.test2}")
                 .otherwise()
                   .log(LoggingLevel.INFO, "Processing choice level 2 otherwise 
test2=${header.test2}")
               //TODO .endChoice() replaced with .end().endChoice() for Quarkus 
3.24.0 and Camel 4.12.0
               .end().endChoice()
               .log(LoggingLevel.INFO, "Processing choice level 1 after 
.end().endChoice() test=${header.test}")
             .otherwise()
               .log(LoggingLevel.INFO, "Processing choice level 1 otherwise 
test=${header.test}")
               .choice()
                 .when(header("test2").isEqualTo("C"))
                   .log(LoggingLevel.INFO, "Processing choice level 2 when 
test2=${header.test2}")
                 .when(header("test2").isEqualTo("D"))
                   .log(LoggingLevel.INFO, "Processing choice level 2 when 
test2=${header.test2}")
                 .otherwise()
                   .log(LoggingLevel.INFO, "Processing choice level 2 otherwise 
test2=${header.test2}")
               //TODO .endChoice() replaced with .end().endChoice() for Quarkus 
3.24.0 and Camel 4.12.0
               .end().endChoice()
               .log(LoggingLevel.INFO, "Processing choice level 1 after 
.endChoice() test=${header.test}")
           .end()
           .log(LoggingLevel.INFO, "Processing choice level 0 after .end() 
test=${header.test}")
           .log(LoggingLevel.INFO, "Processing choice level 0 after .end() 
test2=${header.test2}")
         ;
   ```
   
   So replacing endChoice() with end().endChoice() everywhere in my real wold 
apps when updating (Camel) Quarkus to the latest version worked there too.
   
   So the remaining points would be: Why is it necessary to do this at all 
(It's not intuitive)? Could this not be solved by including the .end() methods 
logic into .endChoice() or doing an internal call of .end() within .endChoice() 
would have the same effect?
   
   If not, documenting the correct way of using nested Choice EIP (besides the 
Migration Guide) would be helpful.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to