[rules-users] Executing Rules using BRMS Snapshot
Ashish Soni
ashish.usoni at gmail.com
Sun Jan 18 13:50:50 EST 2009
Hi ,
I have created a rules package using BRMS and then trying to execute rules
using below code can some one please let me know how i can see the modified
object back.
>
> The Rules is very simple as if the name of the customer is "Ashish' then
> set the phone to some value as given in the rule .
>
>
> public static void main(String[] args) {
>
> Properties properties = new Properties();
> try {
> properties.load(new
> FileInputStream("C:\\Dev\\MyTest\\src\\com\\mytest\\MyRules.properties"));
> } catch (IOException e) {
> }
>
> RuleAgent ruleAgent = RuleAgent.newRuleAgent(properties);
> RuleBase rb = ruleAgent.getRuleBase();
> StatefulSession session = rb.newStatefulSession();
> session.addEventListener( new DebugAgendaEventListener() );
> session.addEventListener( new DebugWorkingMemoryEventListener() );
> WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(
> session );
> Customer customer = new Customer();
> customer.setName("Ashish");
> logger.setFileName(
> "C:\\Dev\\MyTest\\src\\com\\mytest\\helloworld.txt" );
> session.insert(customer);
> session.fireAllRules();
>
> logger.writeToDisk();
> session.dispose();
>
>
> Properties File
>
> newInstance=true
> url=
> http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/AshwinPKG/AshwinSnap
> poll=30
> name=MyConfig
>
>
> Regards,
> Ashish soni
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090118/0e6bd07d/attachment.html
More information about the rules-users
mailing list