[rules-users] Guvnor Integration with BPEL

Rabindra Kumar Srivastava RS0090916 at TechMahindra.com
Mon Sep 12 02:12:39 EDT 2011


Hi,

 

I am using guvnor to create rules and access it through java code in my
application.

I have create pachage "Mypackage" and one rule "Myrule" inside the
package.

 

The code to access the rules is -

 

public SubnetDTO getValidSubnet(SubnetDTO dto) {

            ClassLoader old =
Thread.currentThread().getContextClassLoader();

            try {

                  

                  System.out.println("reading working business rules
----------  ");

 
Thread.currentThread().setContextClassLoader(getClass().getClassLoader()
);

                  RuleAgent agent =
RuleAgent.newRuleAgent("/subnet.properties");

            RuleBase ruleBase = agent.getRuleBase();

            

 

            WorkingMemory workingMemory = ruleBase.newStatefulSession();

            workingMemory.insert(dto);

 

            workingMemory.fireAllRules();

 

            for (Iterator i = workingMemory.iterateObjects();
i.hasNext();) 

            {

                    System.out.println("getCanonicalName  >
"+i.next().getClass().getCanonicalName());

            }

            

            return dto;

            } catch (Throwable t) {

                  t.printStackTrace();

            }

            finally

            {

                  Thread.currentThread().setContextClassLoader(old);

            }

            return null;

      }

 

Subnet.properties contains url as - 

url=http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/Mypack
age/LATEST

 

Now I have created "Myrule1" in the package "Mypackage" and tried to
access the both rule with the same url in the properties file.

But it is only validating the first rule only.

So let me know what changes I have to make to access both rules from the
package.

If any other approach is possible then suggest that also.

 

Thanks

 

 Rabindra Kumar Srivastava | ATT04 | Tech Mahindra
Hinjewadi, Pune 411 057, INDIA

( Office: +91 20 42250000 | Mobile: +91 9892232699| Ext: 253918

Email: rs0090916 at techmahindra.com

www.techmahindra.com <http://www.techmahindra.com/> 

 


============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110912/7418883b/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 165 bytes
Desc: image001.png
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20110912/7418883b/attachment.png 


More information about the rules-users mailing list