title: How to write conditional statements in Apache Camel
body: <p>I have started working with Apache Camel, and have run into a situation where I need to execute following conditional block.</p>
  
  <pre><code>if(Condition A) {
     then Activity A to determine Condition B;
     If(Condition B) {
         Then Activity B
     } else {
         Then Activity C
     }
  } else {
    Do nothing and end the route.
  }
  </code></pre>
  
  <p>Here is what i have come up with, but it is nothing more than guess. It is not written with proper understanding.</p>
  
  <pre><code>...
  ...
  .process(new SomeActivity())
  .choice()
     .when(header(ConditionA).isEqualTo(Boolean.TRUE))
        .process(new ActivityToSetConditionB())
     .choice()
        .when(header(ConditionB).isEqualTo(Boolean.TRUE))
           .process(new ActivityRelatedToB())
        .otherwise()
           .process(new ActivityRelatedToC())
     .endChoice()
  .end()
  </code></pre>
  
  <p>I have tried to understand from Apache camel documentation and few other sources, but it does not seem very intuitive for a beginner like me. Please help me understand this with some examples.</p>