3 Replies Latest reply on Dec 8, 2011 12:40 PM by Tom Cunningham

    Regex Content Based Routing Question

    David Cook Newbie

      I'm new to JBoss ESB and I'm trying to get the regex content-based-router to work.  Basically I have several different types of fixed-length files that I want to route to different transformers based on their content.

       

      The fun_cbr quickstart and the documentation (Section are both pretty clear on the syntax.

       

      I have a file listener set up listening to a local folder (that works because I'm System PrintLn the file to the console and I see it).

       

      The first line of the file looks like this:

       

       

      1540ER00032006000000010

       

      My CBR action looks like the following:

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <

      action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="TraqsReportType">

       

       

      <property name="cbrAlias" value="Regex"/>

       

       

      <property name="ruleLanguage"/>

       

       

      <property name="ruleReload" value="true"/>

       

       

      <property name="destinations">

       

       

      <route-to destination-name="Payroll" service-category="Payroll" service-name=expression="1540RP10" />

       

       

      <route-to destination-name="ER" service-category="ER" service-name="ER" expression="1540ER"/>

       

       

      </property>

       

       

      </action>

       

      When the file referenced above get dropped into the watch folder, my previous action in the action chain properly displays the message on the console and then my content-based router action generates the following error message

      16:04:13,516 ERROR [ContentBasedWiretap] No rule destination(s) [ER, Payroll] were matched, . Please fix your configuration and/or routing rules.

       

      I've tried switching to a regex-rules.properties and even tried .* as a regex to match and I always get the No rule destinations were matched error.

       

      I'm clearly missing something fundamental, but I don't know what it is.

       

      djc

       

       

       

        • 1. Re: Regex Content Based Routing Question
          Tom Cunningham Master

          <route-to destination-name="Payroll" service-category="Payroll" service-name=expression="1540RP10" />

           

          Didn't take a long look at this but service-name=expression= obviously a problem.       If you fix that does it help?

          • 2. Re: Regex Content Based Routing Question
            David Cook Newbie

            DOH! Sorry to waste time with that silly typo.  Unfortunately that wasn't the issue.  Still getting same errors.  I'm sure, it's some basic knob I haven't turned the right way, but I can't find the right knob or the right way to turn it.

             

            I've attached my complete jboss.esb file rather than trying to copy and paste it in.

             

            djc

            • 3. Re: Regex Content Based Routing Question
              Tom Cunningham Master

              Okay, it looks like the problem is your expressions.      This is what is being tested :

               

                              return regexExpression.matcher((CharSequence) objectToTest).matches();

               

              where objectToTest is the file contents and regexExpression is your expression as a java.util.regex.Pattern, which are somewhat different from Perl-style regexes.      I bet if you compile a small example program focusing on testing your input and regexes with  just that line above, you could have this worked out in minutes.