Drools Flow: Find a Session ID to reload the JPA Stateful session
by tolitius
Wait state is reached (request is sent to an external system), the flow is
persisted, the thread that persisted the flow is gone.
Now, the response came back from the external system, and now would be a
good time to resume the flow (reload the session):
StatefulKnowledgeSession ksession =
JPAKnowledgeService.loadStatefulKnowledgeSession( sessionId, kbase, null,
env );
What would be the best approach to find this SessionID that was suspended?
Is there any out of the box [ flow / business ] mapping that can be used?
Thank you,
/Anatoly
--
View this message in context: http://n3.nabble.com/Drools-Flow-Find-a-Session-ID-to-reload-the-JPA-Stat...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
Drools Flow: WORK_ITEM_ID as a flow variable
by tolitius
Not using WS Human Task Handler, just a custom work item handler (since not
every long running process is a human task):
Is there a way to use a Variable Persistence mechanism, to automatically
persist an ID of the work item that causes a flow to suspend [ puts it in a
wait state ]? This way when the flow resumes all we have to do is
processInstance.getVariable("workItemId") to get exactly _that_ work item ID
that needs to be completed.
[ I understand this can be done manually from the a custom work item
handler, but then a different approach is used, different tables get
updated, artificial relationship between session / processInstance and
workItem needs to be manually established, etc.. + we would not be able to
do "processInstance.getVariable("workItemId")" ]
Thank you,
/Anatoly
--
View this message in context: http://n3.nabble.com/Drools-Flow-WORK-ITEM-ID-as-a-flow-variable-tp680939...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
Drools Guvnor: Loading enums programmatically
by Nilima R
Hi All,
I'm trying to do a simple example of loading enums programmatically
following the Drools Guvnor Docuemntation.
I'm on Drools Guvnor 5, Java 1.6 running under Jboss.
I'm trying to define this 'data enumeration/drop down list'
package opensource.test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SampleDataSource2 {
public Map<String, List<String>> loadData() {
Map<String, List<String>> data =
new HashMap<String,List<String>>();
List<String> d = new ArrayList<String>();
d.add("A");
d.add("B");
d.add("C");
d.add("D");
d.add("E");
data.put("Employee.band", d);
return data;
}
}
The jar containing the SampleDataSource2 has been defined as a model
within Guvnor and I defined another declarative model Employee with fields
name,band,rating.
Here's what I put in the 'Data enumeration' text window
Employee.band =(new SampleDataSource2()).loadData()
When validating the Data enumeration from Guvnor, I get the following
error:
Unable to load enumeration data.
unable to resolve class: DataEnumSource
Error type: org.mvel.CompileException
Any help will be highly appreciated ...
Thanks,
Nilima
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
15 years, 11 months
StatefulKnowledgeSessions
by alim
Hi everyone,
I'm trying to find a solution to the following situation:
- KnowledgeBase with approx. 1000 rules
- Approx. 200 users (hence 200 simultaneous sessions) whereas each session
might most likely have different values for the working memory facts
So let's say we create a KnowledgeBase (with those 1000 rules) and out of
this one KnowledgeBase we create for each existing session its own
StatefulKnowledgeSession.
Now, how expensive (memory-wise) are these StatefulKnowledgeSessions? Is it
reasonable to have more than just a few StatefulKnowledgeSessions?
Or is there an other, better approach?
Thank you very much!
--
View this message in context: http://n3.nabble.com/StatefulKnowledgeSessions-tp688305p688305.html
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
(Urgent) Runtime error: java.lang.RuntimePermission createClassLoader
by Gaurav
Hi All,
I need urgent help in resolving this run time error.
This is the first time we are deploying drools to websphere 6.1 and getting
following error.
Our organization does not allow us to do 'createClassLoader' in was.policy.
Can some one please help.
java.security.AccessControlException: Access denied
(java.lang.RuntimePermission createClassLoader)
at
java.security.AccessController.checkPermission(AccessController.java:108)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:558)
at
com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java:212)
at
java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:620)
at java.lang.ClassLoader.<init>(ClassLoader.java:136)
at
org.drools.rule.CompositeClassLoader.<init>(CompositeClassLoader.java:16)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:249)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:142)
at
org.drools.builder.impl.KnowledgeBuilderProviderImpl.newKnowledgeBuilder(KnowledgeBuilderProviderImpl.java:29)
at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:29)
Thanks,
Gaurav
--
View this message in context: http://n3.nabble.com/Urgent-Runtime-error-java-lang-RuntimePermission-cre...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
Performance of compiler
by Christian Nedregård
Hi.
My environment: Win XP SP3, 2x2.13 GHz cpu, 3GB RAM, Drools 4.0.7, JDK
1.4.2_11, java compiler: JANINO, dialect: java.
We have about 850 drl's with 5 - 10 conditions in each. 0 -2 evals in each.
The drl's only contain one rule each.
We are using Drools programatically by compiling the drls using
PackageBuilder.addPackageFromDrl and adding them to a RuleBase using
RuleBase.addPackage(PackageBuilder.getPackage())
When we are building our rule base we are never able to compile more than 1
-2 rules per second, which means we need over 10 minutes (at 100% cpu) to
build our rulebase.
Profiling shows 68% cpu time in
org.drools.rule.builder.GroupElementBuilder.build and 18% cpu time in
org.codehaus.janino.Compiler.compile.
We have experimented by changing the compiler to ECLIPSE and the dialect to
mvel but the results are the same.
We have experimented using one PackageBuilder instance per drl or grouping
drls by package and sharing a builder per package. Same result in both
scenarios.
We have also expermimented with compiling concurrently in serveral threads.
Again, about the same result.
My question is: Is this the performance we can expect from the compiler or
are we doing something fundamentally wrong?
Below is an example of one of our drls. This one contains no evals, but
still takes more than 1 second to compile. If anyone can spot some issues
with the way we are doing things the feedback would be much apreciated :)
------------------------------------
package domain.core.productoffer.rules.subscriptiontype
import type.productoffer.ProductOfferRuleEvent
import domain.core.subscription.Subscription
import domain.core.subscription.SubscribedService
import type.subscription.ActionTypeEnum
import domain.core.productoffer.ProductOffer
import domain.rules.RuleEvent
global domain.core.productoffer.RuleValidationReport validationResult
rule "RequiredVProducts"
when
ProductOfferRuleEvent(id == '3')
ProductOffer(id.value == 31963)
$subscription:Subscription()
not ( SubscribedService(status != ActionTypeEnum.REMOVE_CANCEL &&
productId.value in (57, 69) ) from
$subscription.getAllChildSubscribedServices())
then
validationResult.addValidationMessage("2069", "For product offer
rule event with id '3' and product offer with id=31963 subscription must
have one of the following VProducts: 57, 69.");
end
------------------------------------
Regards
Christian Nedregård
15 years, 11 months
refactoring drools
by Franz Schwab
Hi,
I'm a computer science student and am writing the related-work part for
my diploma thesis and would be interested in (scientific) papers or
information about refactoring or transformation possibilities which can
be done with drools / jboss rules. I have to admit that I never worked
with one of them, as I said I just need that for the related-work part.
Could you please give me some hints?
Thanks,
Franz
15 years, 11 months
refactoring drools
by Franz Schwab
Hi,
I'm a computer science student and am writing the related-work part for
my diploma thesis and would be interested in (scientific) papers or
information about refactoring or transformation possibilities which can
be done with drools / jboss rules. I have to admit that I never worked
with one of them, as I said I just need that for the related-work part.
Could you please give me some hints?
Thanks,
Franz
15 years, 11 months
Sliding Windows - Error
by Paul R.
Hi,
I'm using an accumulate on a sliding window to count the number of events,
which occur in a 30 second window;
the events are inserted every 5 seconds - so with a 30 second window, I
would expect 6 events to occur.
The rule below never fires, though from the log output, it looks as though
the condition has matched successfully?
declare Foo
@role ( event )
@expires ( 60s )
@timestamp ( date )
end
rule "Count Foo"
when
c : Number(intValue > 5) from accumulate
$f : Foo()
over window:time ( 30s )
from entry-point ChannelDataStream,
count($f))
then
System.out.println("Count [30s] = " + c);
end
OBJECT ASSERTED value:com.test.DroolsTest$Foo@c52200 factId: 1
OBJECT ASSERTED value:com.test.DroolsTest$Foo@128edf2 factId: 3
OBJECT ASSERTED value:com.test.DroolsTest$Foo@1dddba factId: 4
OBJECT ASSERTED value:com.test.DroolsTest$Foo@c7e8a7 factId: 5
OBJECT ASSERTED value:com.test.DroolsTest$Foo@7b4703 factId: 6
ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
OBJECT ASSERTED value:com.test.DroolsTest$Foo@1732ed2 factId: 7
ACTIVATION CANCELLED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
OBJECT ASSERTED value:com.test.DroolsTest$Foo@be76c7 factId: 8
ACTIVATION CANCELLED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
Can anybody explain why this is happening? I've attached a test case, which
demonstrates the problem.
Thanks in advance.
- Paul
15 years, 11 months