by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 30 06:54
    alwyngo edited #297
  • Jun 30 06:53
    alwyngo opened #297
  • Jun 29 03:07
    lanpf closed #294
  • Jun 29 03:07
    lanpf commented #294
  • Jun 28 08:32
    caoguofeng92 opened #296
  • Jun 28 00:11
    quaff commented #294
  • Jun 24 23:27
    benas labeled #295
  • Jun 24 23:27
    benas commented #295
  • Jun 24 22:48
    benas labeled #294
  • Jun 24 22:48
    benas commented #294
  • Jun 24 21:17
    benas unlabeled #294
  • Jun 24 21:17
    benas labeled #294
  • Jun 23 09:33
    benas commented #280
  • Jun 23 09:19
    M3lkior edited #295
  • Jun 23 09:18
    M3lkior opened #295
  • Jun 22 01:50
    quaff commented #294
  • Jun 22 01:50
    quaff commented #294
  • Jun 22 01:19
    quaff commented #294
  • Jun 21 23:55
    lanpf commented #294
  • Jun 21 23:44
    lanpf commented #294
Mahmoud Ben Hassine
@benas
@panneerselvamc You can use a rule listener for that. Take a look at j-easy/easy-rules#240 where you can find an example.
panneer selvam.c
@panneerselvamc

@benas thanks for your reply
Iam facing below error in rule definition reader

new JsonRuleDefinitionReader()

do we need to add any dependency for this

Mahmoud Ben Hassine
@benas
which error? JsonRuleDefinitionReader is in the easy-rules-support module, so you need to include this module to use the json reader.
panneer selvam.c
@panneerselvamc
pom.jpg
error.jpg
@benas please have a look at the above image
Mahmoud Ben Hassine
@benas
Is there a reason why each module has a different version? Have you tried to use the same version for all artifacts? You did not mention what is the error you have. Is it an exception or a compilation error? Please share a repo with your code and I will try to take a look. This is better than sharing screeshots.
panneer selvam.c
@panneerselvamc
@benas thanks for your reply, Issue is because of using old version.
Mahmoud Ben Hassine
@benas
ok glad you solved your issue!
niketa741
@niketa741
@benas
Hello, I am using jeasy rules in my project and I want to break from the rules engine if a particular rule has been successfully executed(So that no other rules get executed after that). Can anyone help me with a solution to this?
Mahmoud Ben Hassine
@benas
@niketa741 Set the parameter rulePriorityThreshold to the same value as the rule you want to break on.
niketa741
@niketa741
@benas Thank you
Hitesh
@hitech_twitter
Has anyone used easy-rules with MuleSoft? Any Experiences?
sudhirdharan
@sudhirdharan
Hello all.. Has anyone used easy-rules with camel intg over any osgi container like Jboss fuse? Thanks
msandig
@msandig
Hey all :) Is it possible to execute a rule for a list of objects? (I am using MVEL Expressions if it is important to know) For example: I got a list of person that I want to set as a fact. Now for each person the given rules should be evaluated.
Mahmoud Ben Hassine
@benas
@msandig You can do something like:
Facts facts = new Facts();
 for (Person person : persons) {
    facts.put("person", person);
    rulesEngine.fire(rules, facts);
}

@msandig @sudhirdharan

Has anyone used easy-rules with MuleSoft? Any Experiences?

Hello all.. Has anyone used easy-rules with camel intg over any osgi container like Jboss fuse? Thanks

Not in my experience, I will let other people in this room share their experience if any.

Hitesh
@hitech_twitter
Another question, has there been any web UI's developed that can be used by business analysts to easily create the underlying rules?
Mahmoud Ben Hassine
@benas
@hitech_twitter No, there is no UI developed for this purpose. If someone does it, I would be happy to add a reference to it in the home page.
sktr
@samkttr_twitter
Appreciate if any one can advise on the options or configuration that can be done to rule specific @Rule
sktr
@samkttr_twitter
if not through easy-rules are there any other workflows that can be considered for doing configuration of each rule, eample through versioning.
Mahmoud Ben Hassine
@benas
@samkttr_twitter thank you, glad you like Easy Rules!
What about versioning your rule descriptor file then reload rules each time you update the version?
Otherwise you can create custom rules in Java code (implement Rule or extend BasicRule) and add any field you need (version, boolean for active/inactive, etc).
Vish
@vishb_gitlab
@benas Is there a way to write multi-line commands in actions in json/yaml.
And what is feature parity of mvel/json vis-a-vis the programmatic way.
Mahmoud Ben Hassine
@benas
Easy Rules uses jackson to parse json/yaml file. If it is possible to write multi-line values in json/yaml, then you can do that for Easy Rules actions as well.
In regards to feature parity, you should be able to do everything both declaratively and programmatically (unless I'm missing something).
Fatih Keskin
@Fatihkeskin
Hello everyone, i have been reading the code recenlty. Very elegant work by the way. So, I wondered why the TreeSet structure is used instead of HashSet to contain Rules objects.
Fatih Keskin
@Fatihkeskin
@benas
Mahmoud Ben Hassine
@benas
@Fatihkeskin Thank you! a TreeSet is used in order to sort rules by priority.
Fatih Keskin
@Fatihkeskin
@benas Oh i get it know. Thanks :)
Fatih Keskin
@Fatihkeskin
@benas Another Question then; What does the trigger methods do (triggerListenersOnFailure, triggerListenersOnSuccess, triggerListenersBeforeExecute...) in DefaultRulesEngine class? Is it necessary for to RuleEngine work?
1 reply
ramnaresh2051
@ramnaresh2051
We can set skipOnFirstFailedRule to true and it says engine to skip next rules when a rule fails, what does mean fails rule ?
Fatih Keskin
@Fatihkeskin
@ramnaresh2051 As far as i know, the implementation of a rule may be faulty and can cause exceptions etc. So we may want to skip other rules to execute because an unexpected situation occured.
Mahmoud Ben Hassine
@benas
@ramnaresh2051 A rule is said to be failed when it is triggered (meaning its condition evaluates to true) and (one of) its action(s) throws an exception.
so as @Fatihkeskin mentioned, skipOnFirstFailedRule allows you to skip subsequent rules on first error.
@Fatihkeskin Thank you for the follow up!
mbbalci
@mbbalci
Hi team, is there a reason that rule has only one condition. I think it's useful to hava multiple condition to do action. So we will change it to manage multiple conditons.
Mahmoud Ben Hassine
@benas
Hi @mbbalci , the reason is that Easy Rules can't statically interpret the combination of conditions as a 'OR' or a 'AND'. You can find more details and examples in j-easy/easy-rules#193 and j-easy/easy-rules#266.
mbbalci
@mbbalci
i will read about it. your work very elegant and clean, thank you
Mahmoud Ben Hassine
@benas
@mbbalci Thank you!

Hi all,

Easy Rules version 4.0 is now released with a lot of new features and enhancements! Check out what's new here: https://github.com/j-easy/easy-rules/releases/tag/easy-rules-4.0.0.

I would like to thank all contributors who made this release possible by reporting issues, testing fixes, requesting features and participating in discussions: @readilychen, @elitacco, @snok3r, @AleksandrPalchuk, @turiandras, @Alexey1Gavrilov, @yunfengwang and @R-Gerard ! Thank you all for your contributions!

A special BIG thank you to @zhhaojie for following up on issues, helping in design discussions and all the time and effort put on Easy Rules!

Best regards,
Mahmoud

zhouhaojie
@zhhaojie
Thank you all.
Michael Brizic
@aquacode
How do I write an mvel yaml code to remove from a List; is it standard remove(Object) and removeAll(Collection) ?
Mahmoud Ben Hassine
@benas
@aquacode yes, here is a quick example:
import java.util.ArrayList;
import java.util.List;

import org.jeasy.rules.api.Facts;
import org.jeasy.rules.api.Rules;
import org.jeasy.rules.api.RulesEngine;
import org.jeasy.rules.core.DefaultRulesEngine;
import org.jeasy.rules.mvel.MVELRule;

public class Launcher {

    public static void main(String[] args) {

        // create facts
        Facts facts = new Facts();
        List<String> names = new ArrayList<>();
        names.add("foo");
        names.add("bar");
        names.add("toto");
        facts.put("list", names);

        // create rules
        MVELRule mvelRule = new MVELRule()
                .when("true")
                .then("list.remove(0)")
                .then("list.remove('bar')");

        Rules rules = new Rules();
        rules.register(mvelRule);

        // create a rules engine and fire rules on known facts
        RulesEngine rulesEngine = new DefaultRulesEngine();
        rulesEngine.fire(rules, facts);

        System.out.println("names = " + names); // prints: names = [toto]
    }
}
The same rule code could be put in a yaml/json descriptor, I just used the programmatic way here for convenience. HTH.
abhinavpatni602
@abhinavpatni602
In a spring application if I add a rule to the JSON file will it get updated in the runtime? or do I need to build the whole rule engine again?
Mahmoud Ben Hassine
@benas
@abhinavpatni602 No, you only need to reload the rule set (aka the Rules object).
abhinavpatni602
@abhinavpatni602

@benas Thanks for the quick reply. I have a problem in loading multiple rules from JSON file. My launcher code looks like this:

MVELRuleFactory factory = new MVELRuleFactory(new JsonRuleDefinitionReader());
Rules orderRule = factory.createRules(new FileReader("src/main/java/org/shopJSON/rules.json"));

    Rules rules = new Rules();
    rules.register(orderRule);


    RulesEngine rulesEngine = new DefaultRulesEngine();
    rulesEngine.fire(rules, facts);

The rule is not getting registered. What is the right way to register multiple rules from JSON format. I am not able to find a completely correct use case.