Using Java Rule Engine JSR-94
by abhinay_agarwal
Hey,
I read about JSR-94 and found it quite useful, so was trying to do a POC on
its usage. These are the steps which i followed.
1. Made a new java application.
2. Added the JSR-94 api jars in its build path.
3. Made a rule as myRuleFile.drl
4. Wrote a RuleAdapter class as shown in drools expert document Chapter 5.
The Java Rule Engine
API (JSR94).
But when i tried to run the piece of code, it kept giving me errors related
to Class missing related to drools.
Are are the drools jar required to run this example,if yes, then what is the
avantage of using jsr-94 api ?
If any specific jars, can you please list them out?
If I am doing anything wrong, then, can you please point me to the correct
direction.
Thanks,
Abhinay
--
View this message in context: http://drools.46999.n3.nabble.com/Using-Java-Rule-Engine-JSR-94-tp4023852...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Drools Fusion Dropping Events?
by Jason Barto
I've been working to load test Drools 5.3 to determine if its a fit for a
project. As part of the test I programmatically insert events as rapidly
as possible; an example, my earlier test inserted 10k events in about
300ms. There is currently a single rule which reads the event and stores
the event's value into the only fact in Drools. I'm very happy to report,
and I'm sure it will be no surprise to anyone, that the engine processes
all the events in roughly 1 sec. However I have noticed that any large
number of events (~>1000) usually sees that a small number of events don't
get processed. I think after 10k events as many as 7 appear to have gone
unprocessed. If 100 events are inserted, rather than 10k, no events get
disregarded. Being new to Drools I can easily accept that my java code or
DRL code is off or unoptimized in some way. However not knowing how Drools
does its magic I'm currently inclined to think that Drools gets swamped
(10k in 300ms is a lot) and a few events get dropped so Drools can keep
operating. Is this a known or expected behavior from Drools? If not I am
happy to post my code, it is similar to the other code sets I've posted in
the last few days. I'm still new to Drools and trying to learn its behavior
so any insight or enlightenment is greatly appreciated.
Sincerely,
Jason
12 years, 10 months
Error : JAAS Authentication with Guvnor 5.5.0 and Authorization Error
by Zahid Ahmed
Hi,
I have run into a set of errors configuring JAAS Authentication for Guvnor. I have searched a lot on jboss community and for all the solutions nothing is working for me. I am getting either the login popup or I am getting "This User has no permissions setup". The Guvnor Manual is referring to jboss eap 5 and I am trying to do this on Jboss AS 7.1.
Note : I am unable to find login-config.xml file mentioned in the following link. http://docs.jboss.org/drools/release/5.5.0.Final/drools-guvnor-docs/html/... . Is guvnor deployment targeted only for JBOSS EAP 5.0 ?
Environment:
1. Guvnor 5.5.0.Final
2. JBOSS AS 7.1.0
Files Configured (Only these files I configured):
1. Standalone.xml
2. Guvnor.war/WEB-INF/beans.xml
3. Created users using "add-user.sh"
4. standalone/configuration/application-users.properties (attached).
5. standalone/configuration/application-roles.properties (attached)
6. standalone/configuration/management-users.properties
Configurations
Standalone.xml :
Only configured below tags. There's nothing else I changed for the purpose of JAAS Authentication and Guvnor Authorization. Added <security-domain name="drools-guvnor" cache-type="default"> to check if "other" is not working.
<security-domain name="other" cache-type="default">
<authentication>
<login-module code="Remoting" flag="optional">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
<login-module code="RealmUsersRoles" flag="required">
<module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
<module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
<module-option name="realm" value="ApplicationRealm"/>
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
<security-domain name="drools-guvnor" cache-type="default">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
<module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
<module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
<module-option name="realm" value="ApplicationRealm"/>
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
Drools-guvnor.war.
1. beans.xml (Tried 4 different configs as suggested on community)
a. Config 1 (Attached "Config1 beans.xml" and Config1 error.txt) . Error "This User has no permission setup".
<security:IdentityImpl>
<s:modifies/>
<!-- JAAS based authentication -->
<security:authenticatorName>jaasAuthenticator</security:authenticatorName>
</security:IdentityImpl>
<security:jaas.JaasAuthenticator>
<s:modifies/>
<jaasConfigName>other</jaasConfigName>
</security:jaas.JaasAuthenticator>
<!-- SECURITY AUTHORIZATION CONFIGURATION -->
<!--
This is used to enable or disable role-based authorization. By default it is disabled.
-->
<guvnorSecurity:RoleBasedPermissionResolver>
<s:modifies/>
<guvnorSecurity:enableRoleBasedAuthorization>true</guvnorSecurity:enableRoleBasedAuthorization>
</guvnorSecurity:RoleBasedPermissionResolver>
b. Config 2 (Attached "Config2 beans.xml" and Config2 error.txt). Error "This User has no permission setup".
<security:IdentityImpl>
<s:modifies/>
<!-- JAAS based authentication -->
<security:authenticatorName>jaasAuthenticator</security:authenticatorName>
</security:IdentityImpl>
<security:jaas.JaasAuthenticator>
<s:modifies/>
<security:jaasConfigName>drools-guvnor</security:jaasConfigName>
</security:jaas.JaasAuthenticator>
<!-- SECURITY AUTHORIZATION CONFIGURATION -->
<!--
This is used to enable or disable role-based authorization. By default it is disabled.
-->
<guvnorSecurity:RoleBasedPermissionResolver>
<s:modifies/>
<guvnorSecurity:enableRoleBasedAuthorization>true</guvnorSecurity:enableRoleBasedAuthorization>
</guvnorSecurity:RoleBasedPermissionResolver>
c. Config 3 (Attached "Config3 beans.xml" and Config1 error.txt). Error (Same error as of Config 1) "This User has no permission setup".
<security:IdentityImpl>
<s:modifies/>
<!-- JAAS based authentication -->
<security:authenticatorName>jaasAuthenticator</security:authenticatorName>
</security:IdentityImpl>
<security:jaas.JaasAuthenticator>
<s:modifies/>
<jaasConfigName>other</jaasConfigName>
</security:jaas.JaasAuthenticator>
<guvnorSecurity:RoleBasedPermissionResolver>
<s:modifies/>
<guvnorSecurity:enableRoleBasedAuthorization>true</guvnorSecurity:enableRoleBasedAuthorization>
</guvnorSecurity:RoleBasedPermissionResolver>
<component name="org.jboss.seam.security.roleBasedPermissionResolver">
<s:modifies/>
<property name="enableRoleBasedAuthorization">true</property>
</component>
I HAVE ALSO ADDED THIS COMPONENT TAG found every where on forums to resolve this issue. I tried Tried without this also but at that time I get LOGIN screen which always says Incorrect User/Password.Is this required or <guvnorSecurity:RoleBasedPermissionResolver> is the only authorization config.
<component name="org.jboss.seam.security.roleBasedPermissionResolver">;
<s:modifies/>
<property name="enableRoleBasedAuthorization">true</property>
</component>
Kindly help me in this configuration. I can't find a single authentic document for my environment.
Regards,
Zahid
12 years, 10 months
Drools 6.0.0.Beta2 Documentation and Examples
by 445511
I'm trying to use Drools 6.0.0.Beta2 but none of the examples appear to be
"Kie"-ified making it difficult to figure out. Is there more up to date
documentation concerning Drools 6 without pooring through source code?
I'm specifically interested in drools + jbpm, new annotations, git
integration, maven integration, new Drools UI (the uberfire one which I'm
still unclear whether this is going to be called guvnor or something
completely different).
I realize how hard it is to work on a project and document at the same time
- especially given the multi-continent talks coming up but this has been an
ongoing struggle with JBoss based projects. The early releases (and even
final) lack sufficient accurate documentation to even evaluate its use. I
can only assume that this substantially reduces support contract
opportunities and frustrates early adopters.
Any pointers will be greatly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-0-Beta2-Documentation-and-Ex...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
NPE from reteoo.AccumulateNode
by jpbarto
First the specifics: JDK 1.6, Mac OSX, using Drools 5.5 Final
The full source code and rules are pasted below but here's the gist, I have
a stateful knowledge session to which I am inserting events and running an
accumulate on the input events. I have a for loop generating the events and
inserting them as rapidly as possible. In the rules I use an accumulator to
calculate the average of the values contained within the events. The
behavior I'm observing is that if I insert ~120 events without any waiting I
receive an NPE. If I Thread.sleep for even just 1ms the test goes off
without a hitch. Have I uncovered a bug which should be logged in JIRA? I
would check through JIRA to see if something similar has been logged but I'm
so unfamiliar with the codebase, not to mention it could all just be user
error.
The NPE is as follows:
Exception in thread "main" java.lang.NullPointerException
at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:1050)
at
org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:345)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:259)
at
org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:676)
at
org.drools.reteoo.ReteooWorkingMemory$EvaluateResultConstraints.execute(ReteooWorkingMemory.java:590)
at
org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:350)
at
org.drools.rule.SlidingLengthWindow.assertFact(SlidingLengthWindow.java:119)
at org.drools.rule.BehaviorManager.assertFact(BehaviorManager.java:94)
at org.drools.reteoo.WindowNode.assertObject(WindowNode.java:167)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:127)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:55)
at drools5fusioneval.Average.main(Average.java:66)
### Average.java ###
package drools5fusioneval;
import java.io.IOException;
import java.util.Random;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseConfiguration;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.conf.EventProcessingOption;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.WorkingMemoryEntryPoint;
class AvgDFEChannel implements org.drools.runtime.Channel {
@Override
public void send(Object o) {
System.err.println ("Recieved channel message: "+ o);
}
}
public class Average {
public static void main(String[] args) throws InterruptedException,
IOException {
KnowledgeBaseConfiguration kbconfig =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kbconfig.setOption(EventProcessingOption.STREAM);
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase(kbconfig);
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("drools5fusioneval/average.drl"),
ResourceType.DRL);
if (kbuilder.hasErrors()) {
System.err.println(kbuilder.getErrors().toString());
}
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
final StatefulKnowledgeSession session =
kbase.newStatefulKnowledgeSession();
session.registerChannel("heartbeat", new AvgDFEChannel ());
WorkingMemoryEntryPoint ep01 =
session.getWorkingMemoryEntryPoint("ep01");
new Thread() {
public void run() {
session.fireUntilHalt();
}
}.start();
Thread.sleep (5000); // give the engine time to get setup
Server hiwaesdk = new Server ("hiwaesdk");
session.insert(hiwaesdk);
long LIMIT = 120;
Random rnd = new Random (System.nanoTime());
for (long i = LIMIT; i > 0; i--) {
int j = rnd.nextInt (212);
ep01.insert (new IntEvent (j));
//Thread.sleep (0x1);
}
System.out.println (hiwaesdk);
}
}
### average.drl ###
package drools5fusioneval
declare IntEvent
@role ( event )
@expires(15s)
end
declare Statistics
opsec : long
total : long
end
global Statistics stats;
rule "Init engine"
salience 100
when
then
stats = new Statistics ();
stats.setTotal (0);
stats.setOpsec (0);
drools.getWorkingMemory ().setGlobal ("stats", stats);
System.out.println ("Engine initialized");
end
rule "number rule"
when
$e : IntEvent () from entry-point ep01
$s : Server (hostname == "hiwaesdk")
then
$s.currentTemp = $e.data;
stats.setOpsec (stats.getOpsec () + 1);
stats.setTotal (stats.getTotal () + 1);
end
rule "average temp"
when
Number ($avg : intValue) from accumulate (
IntEvent ($temp : data) over window:length(10) from entry-point
ep01, average ($temp)
)
$s : Server (hostname == "hiwaesdk")
then
$s.avgTemp = $avg;
end
rule "Heartbeat"
timer ( int: 5s 5s)
when
then
channels["heartbeat"].send ("Heartbeat: "+ stats.getOpsec () / 5 +", "+
stats.getTotal ());
stats.setOpsec (0);
end
--
View this message in context: http://drools.46999.n3.nabble.com/NPE-from-reteoo-AccumulateNode-tp402381...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
clustering
by sara ibrahim
hi,
i need to configure Jboss clustering , i tried to apply it in the same server but i couldn't perform Failover
so now i'm trying two different ips at different machines , what should i do exactly?!
REGARDS,
SARA
12 years, 10 months
Optaplan6.0.0Beta1:chaining-simpleScore OK, DRL Score corruption
by Paul T
Requirement:Equip to tasks scheduling.Earlier tasks may not exceed a waittime
to latest endtime for each job.
2 JOBs to plan each with 2 identical TASKs with only 1 EQUIPMENT anchor:
J1 comprises T1,T2 and J2 comprises T1,T2.
problem Fact: EQUIPMENT E1
planning Entity: TASK T1|duration=3|waittime=2 and
T2|duration=5|waittime=3
OptaPlan Schedule attempt
-------------------------
anchor(E1:T1J1,T1J2,T2J1,T2J2) - so T1J1 is pos1,T1J2 is pos2 etc :
timings are 3+3+5+5 and respective waittimes are 2,2,3,3
Rule: get latest ending task by JOB and punish if waittime is exceeded
between the tasks for that specific JOB.
J1 latestendtime=11 which is T2J1
J2 latestendtime=16 which is T2J2
Punish if any task endtime for JOB exceeds waittime (so for J1:
T2J1-T1J1=(11-6-2)*-1 = -3 (SOFT)
- I believe that the score function remembers J1,T2J1 in position 3 and
T1J1 in position 1 with SOFT score -3
OptaPlan Schedule attempt
-------------------------
anchor(E1:T1J1,T2J2,T2J1,T1J2) - so T1J1 is pos1,T2J2 is pos2 etc :
timings are 3+5+5+3 and respective waittimes are 2,3,3,2
Rule: get latest ending task by JOB and punish if waittime is exceeded
between JOBs
J1 latestendtime=13 which is T2J1
J2 latestendtime=16 which is T1J2
Punish if any task endtime for JOB exceeds waittime (so for J1:
T2J1-T1J1=(13-6-2)*-1 = -5 (SOFT)
- I believe that the score function remembers J1,T2J1 in position 3 and
T1J1 in position 1 with SOFT score -5
Score corruption seems to occur as the DRL scoring function has 2 identical
set of entities/values but with different score results!
J1,T2J1 in position 3 and T1J1 in position 1 with SOFT score -3
J1,T2J1 in position 3 and T1J1 in position 1 with SOFT score -5
What has happened is that J2 has swapped its tasks around which are not(?)
taken into account for a chaining DRL score function and
hence does not see them as different.
Q?: Am I correct in my assumption that the DRL score function has
insufficient data to compare for my requirement?
Q?: If so any ideas to resolve?
--
View this message in context: http://drools.46999.n3.nabble.com/Optaplan6-0-0Beta1-chaining-simpleScore...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Erro : JAAS Authentication with Guvnor 5.5.0 and Authorization Error
by Zahid Ahmed
Hi,
I have run into a set of errors configuring JAAS Authentication for Guvnor. I have searched a lot on jboss community and for all the solutions nothing is working for me. I am getting either the login popup or I am getting "This User has no permissions setup". The Guvnor Manual is referring to jboss eap 5 and I am trying to do this on Jboss AS 7.1.
Note : I am unable to find login-config.xml file mentioned in the following link. http://docs.jboss.org/drools/release/5.5.0.Final/drools-guvnor-docs/html/... . Is guvnor deployment targeted only for JBOSS EAP 5.0 ?
Environment:
1. Guvnor 5.5.0.Final
2. JBOSS AS 7.1.0
Files Configured (Only these files I configured):
1. Standalone.xml
2. Guvnor.war/WEB-INF/beans.xml
3. Created users using "add-user.sh"
4. standalone/configuration/application-users.properties (attached).
5. standalone/configuration/application-roles.properties (attached)
6. standalone/configuration/management-users.properties
Configurations
Standalone.xml :
Only configured below tags. There's nothing else I changed for the purpose of JAAS Authentication and Guvnor Authorization. Added <security-domain name="drools-guvnor" cache-type="default"> to check if "other" is not working.
<security-domain name="other" cache-type="default">
<authentication>
<login-module code="Remoting" flag="optional">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
<login-module code="RealmUsersRoles" flag="required">
<module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
<module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
<module-option name="realm" value="ApplicationRealm"/>
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
<security-domain name="drools-guvnor" cache-type="default">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
<module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
<module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
<module-option name="realm" value="ApplicationRealm"/>
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
Drools-guvnor.war.
1. beans.xml (Tried 4 different configs as suggested on community)
a. Config 1 (Attached "Config1 beans.xml" and Config1 error.txt) . Error "This User has no permission setup".
<security:IdentityImpl>
<s:modifies/>
<!-- JAAS based authentication -->
<security:authenticatorName>jaasAuthenticator</security:authenticatorName>
</security:IdentityImpl>
<security:jaas.JaasAuthenticator>
<s:modifies/>
<jaasConfigName>other</jaasConfigName>
</security:jaas.JaasAuthenticator>
<!-- SECURITY AUTHORIZATION CONFIGURATION -->
<!--
This is used to enable or disable role-based authorization. By default it is disabled.
-->
<guvnorSecurity:RoleBasedPermissionResolver>
<s:modifies/>
<guvnorSecurity:enableRoleBasedAuthorization>true</guvnorSecurity:enableRoleBasedAuthorization>
</guvnorSecurity:RoleBasedPermissionResolver>
b. Config 2 (Attached "Config2 beans.xml" and Config2 error.txt). Error "This User has no permission setup".
<security:IdentityImpl>
<s:modifies/>
<!-- JAAS based authentication -->
<security:authenticatorName>jaasAuthenticator</security:authenticatorName>
</security:IdentityImpl>
<security:jaas.JaasAuthenticator>
<s:modifies/>
<security:jaasConfigName>drools-guvnor</security:jaasConfigName>
</security:jaas.JaasAuthenticator>
<!-- SECURITY AUTHORIZATION CONFIGURATION -->
<!--
This is used to enable or disable role-based authorization. By default it is disabled.
-->
<guvnorSecurity:RoleBasedPermissionResolver>
<s:modifies/>
<guvnorSecurity:enableRoleBasedAuthorization>true</guvnorSecurity:enableRoleBasedAuthorization>
</guvnorSecurity:RoleBasedPermissionResolver>
c. Config 3 (Attached "Config3 beans.xml" and Config1 error.txt). Error (Same error as of Config 1) "This User has no permission setup".
<security:IdentityImpl>
<s:modifies/>
<!-- JAAS based authentication -->
<security:authenticatorName>jaasAuthenticator</security:authenticatorName>
</security:IdentityImpl>
<security:jaas.JaasAuthenticator>
<s:modifies/>
<jaasConfigName>other</jaasConfigName>
</security:jaas.JaasAuthenticator>
<guvnorSecurity:RoleBasedPermissionResolver>
<s:modifies/>
<guvnorSecurity:enableRoleBasedAuthorization>true</guvnorSecurity:enableRoleBasedAuthorization>
</guvnorSecurity:RoleBasedPermissionResolver>
<component name="org.jboss.seam.security.roleBasedPermissionResolver">
<s:modifies/>
<property name="enableRoleBasedAuthorization">true</property>
</component>
I HAVE ALSO ADDED THIS COMPONENT TAG found every where on forums to resolve this issue. I tried Tried without this also but at that time I get LOGIN screen which always says Incorrect User/Password.Is this required or <guvnorSecurity:RoleBasedPermissionResolver> is the only authorization config.
<component name="org.jboss.seam.security.roleBasedPermissionResolver">;
<s:modifies/>
<property name="enableRoleBasedAuthorization">true</property>
</component>
Kindly help me in this configuration. I can't find a single authentic document for my environment.
Regards,
Zahid
12 years, 10 months
email
by noor jalillah jeffri
noorjalillahjeffri(a)gmail.com
12 years, 10 months
Optaplanner - Multiday / Periodic Vehicle Routing Problems
by Raoul Cousins
I am interested in solving periodic vehicle routing problems and other
multi-day (but static and deterministic) vehicle routing variants.
These are similar to standard VRP except that not every customer is visited
each day. In some variants, the days to visit each node are chosen from
some predefined schedules; in others, each node has to be visited a
specific number of times over the course of several days.
Would Optaplanner be a good choice to model such problems? I know it's not
a very well-defined question, but I'm wondering if there would be any
serious difficulties modeling this type of problem before I dive into the
programming.
Thank you!
12 years, 10 months