No problem.  I'm not sure how you'd do this in a decision table (it's probably pretty trivial) but in DRL you'd do:

rule "makePhoneNumber"
when
  s: String()
then
  insert(new PhoneNumber(s));
  retract(s);
end

With two caveats:

1) you need some conditions on the String matched if there are other Strings that don't make PhoneNumbers.
2) The rule could use a salience value higher than the pricing rules, but that isn't necessary.

Actually, there's a third caveat, and it's a big one: this won't work with sequential mode. This is because the rule above would alter working memory with the expectation that the pricing rules would react to the change.  If you want to use sequential mode you'll have to convert to PhoneNumber objects before hand.  I understand that you're using this Jbilling package, but is there no way you can put an intermediate adapter between the two?  It'd be as simple as inserting "new PhoneNumber(someString)" instead of "someString".

--- On Fri, 5/14/10, Antonio Anderson Souza <antonio@voicetechnology.com.br> wrote:

From: Antonio Anderson Souza <antonio@voicetechnology.com.br>
Subject: Re: [rules-users] Jbilling Drools performance
To: "Rules Users List" <rules-users@lists.jboss.org>
Date: Friday, May 14, 2010, 2:16 PM

Dear Greg,

Thanks very much for your reply.

I'm using sequential mode = true

Is there a way to create this PhoneNumber class, and convert the String to the PhoneNumber object inside the Drools? Because I'm using a system called JBilling and it send the phoneNumber as a String.

Sorry if those are basic questions, but I'm a newbie in Drools...

Thank you very much,

Antonio Anderson Souza
Voice Technology
http://www.antonioams.com


2010/5/14 Greg Barton <greg_barton@yahoo.com>
Right off the bat I'd say try to get rid of the eval usage.  Can you put the phone number into an object like this:

class PhoneNumber {
  private char digit0;
  private char digit1;
  ///...same for the rest of the digits

  public char getDigit0() { return digit0; }
  public char getDigit1() { return digit1; }
}

Then the conditions would look like this:

digit0 == '$param'

Behind the scenes hopefully this will optimize better.  The use of eval won't optimize well.

Are you using sequential mode?  This might be a good candidate for that if setting the price does not trigger any other rules to fire.

--- On Fri, 5/14/10, Antonio Anderson Souza <antonioams@gmail.com> wrote:

From: Antonio Anderson Souza <antonioams@gmail.com>
Subject: [rules-users] Jbilling Drools performance
To: "Drools Users Mailing list" <rules-users@lists.jboss.org>
Date: Friday, May 14, 2010, 1:28 PM


Dear All,

I'm deploying  a JBilling using Drools in a Telecom Carrier in Brazil, and I'm using Decision tables in xls files to execute the pricing, my pricing table has about 40.000 rules, and I'm getting a terrible performance about 1.5 minute to execute the price of each CDR (Call Detail Record) mediated.

Follow bellow a small piece of my decision table:

RuleTable Padrao














CONDITION CONDITION ACTION PRIORITY
PricingField PricingManager manager salience
name eval (strValue.charAt(0) == '$param') eval (strValue.charAt(1) == '$param') eval (strValue.charAt(2) == '$param') eval (strValue.charAt(3) == '$param') eval (strValue.charAt(4) == '$param') eval (strValue.charAt(5) == '$param') eval (strValue.charAt(6) == '$param') eval (strValue.charAt(7) == '$param') eval (strValue.charAt(8) == '$param') eval (strValue.charAt(9) == '$param') eval (strValue.charAt(10) == '$param') eval (strValue.charAt(11) == '$param') itemId setPrice($param)
Campo Digito1 Digito2 Digito3 Digito4 Digito5 Digito6 Digito7 Digito8 Digito9 Digito10 Digito11 Digito12 ID do Item Preço Ordem
destinationnumber 5 5 1 1 3 5 8 8 0 1 8 8 300 0.00000 1
destinationnumber 5 5 1 1 3 5 8 8 0 1 8 7 300 0.00000 2
destinationnumber 5 5 1 1 3 5 8 8 0 1 8 6 300 0.00000 3
destinationnumber 5 5 1 1 3 5 8 8 0 1 8 5 300 0.00000 4
destinationnumber 5 5 1 1 3 5 8 8 0 1 8 4 300 0.00000 5
destinationnumber 5 5 1 1 3 5 8 8 0 1 8 3 300 0.00000 6
destinationnumber 5 5 1 1 3 5 8 8 0 1 8 2 300 0.00000 7
destinationnumber 5 5 1 1







300 0.40000 8


Is it normal? Are there somebody using Jbilling in a similar way? Does anybody can help me?

Best regards,

Antonio Anderson Souza
Voice Technology
http://www.antonioams.com



-----Inline Attachment Follows-----

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



-----Inline Attachment Follows-----

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users