title: Camel Choice by Example
body: <p>I have 2 POJOs:</p>
  
  <pre><code>public class Witch {
      private Broom broom;
      private List&lt;Spell&gt; spells;
  
      // constructors, getters/setters, etc.
  }
  
  public class ValidatedWitches {
      private List&lt;Witch&gt; goodWitches
      private List&lt;Witch&gt; badWitches;
  
      // constructors, getters/setters, etc.
  }
  </code></pre>
  
  <p>I have a Camel processor I wrote that will produce a <code>ValidatedWitches</code> instance (which again, consists of 2 <code>List&lt;Witch&gt;</code>):</p>
  
  <pre><code>public class WitchValidator implements Processor {
      @Override
      public void process(Exchange exchange) {
          List&lt;Witch&gt; witchesToValidate = (List&lt;Witch&gt;)exchange.getIn().getBody();
  
          ValidatedWitches validated = validate(witchesToValidate);
  
          exchange.getOut().setBody(validated);
      }
  
      private ValidatedWitches validate(List&lt;Witch&gt; toValidate) {
          // For each witch, determines if it is a good witch, or a bad witch,
          // and places it on an appropriate list.
          List&lt;Witch&gt; good = new ArrayList&lt;Witch&gt;();
          List&lt;Witch&gt; bad = new ArrayList&lt;Witch&gt;();
  
          // etc...
  
          return new ValidatedWitches(good, bad);
      }
  }
  </code></pre>
  
  <p>I now want to <strong>route</strong> my list of good witches 1 way, and my list of bad witches another way:</p>
  
  <pre><code>&lt;route id="witch-route"&gt;
      &lt;!-- Everything before my WitchValidator component... --&gt;
  
      &lt;to uri="bean:witchValidator?method=process" /&gt;
  
      &lt;choice&gt;
          &lt;when&gt;
              &lt;simple&gt;???&lt;/simple&gt;
              &lt;to uri="direct:goodWitches" /&gt;
          &lt;/when&gt;
          &lt;when&gt;
              &lt;simple&gt;???&lt;/simple&gt;
              &lt;to uri="direct:badWitches" /&gt;
          &lt;/when&gt;
      &lt;/choice&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>What can I put inside my <code>&lt;choice&gt;</code> to take the <code>ValidatedWitches.getGoodWitches()</code> and route them to <code>direct:goodWitches</code>, and to take the <code>ValidatedWitches.getBadWitches()</code> and route them to <code>direct:badWitches</code>?</p>