So far, I have this solution which uses Camel Bean Language/Message Filter. 
I always want the route to send to the *firstToURIs*, but only send to the
mirror wiretap if the *mirrorEnabled* configuration value is set to true.

*      // ------------------------------------------------
      // This static variable and bean class allows for
      // conditional DSL wrt mirror functionality.
      // @see https://camel.apache.org/message-filter.html
      // @see http://camel.apache.org/bean-language.html
      // ------------------------------------------------
      private static Boolean mirrorEnabled = null; // Set based on the
mirror configuration. 
      public static class MirrorBean {
          public boolean isMirrorEnabled() {
              return mirrorEnabled.booleanValue();
          }
      }*

...

                from(fromURI)
                    .routeId(sourceRouteId)
                    .routePolicy(routePolicy)
                    .startupOrder(routeStartupOrder)
                    .setProperty(Exchange.CHARSET_NAME,
ExpressionBuilder.constantExpression(charsetName))
                    //
-----------------------------------------------------------
                    // This wiretap implements the mirror functionality.
                    // A traditional wiretap whereby Camel will copy the
original
                    // Exchange and set its Exchange Pattern to InOnly, as
we want
                    // the tapped Exchange to be sent in a fire and forget
style.
                    //
-----------------------------------------------------------
*                    .filter().method(MirrorBean.class, "isMirrorEnabled")
                        .wireTap(mirrorToURI).id(sourceRouteId + "_MIRROR")
                    .end()*
                    // -----------------------------------------------------
                    // to(backupFileToURI, throughputFileToURI, sedaMainURI)
                    // -----------------------------------------------------
                    .to(firstToURIs)
                        .id(sourceRouteId + "_TO_FIRST_URIS"); 






--
View this message in context: 
http://camel.465427.n5.nabble.com/Conditionally-omitting-a-portion-of-a-route-tp5770127p5770129.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to