Guvnor data enumeration issue
by GPatel@tsys.com
I am trying to use data enumerations and running into a problem. Following
the Vehicle engineType/fuelType data enumeration example in the Guvnor
manual, I created the following enumeration list and it works:
'Vehicle.engineType' : (new test.VehicleHelper()).getEngineTypes()
'Vehicle.fuelType[engineType]' : '(new
test.VehicleHelper()).getFuelTypes("@{engineType}")'
VehicleHelper:
------------
public class VehicleHelper {
public List<String> getEngineTypes(){
List<String> engineTypes = new ArrayList<String>();
engineTypes.add("Petrol");
engineTypes.add("Diesel");
return engineTypes;
}
public List<String> getFuelTypes(String engineType){
List<String> fuelTypes = new ArrayList<String>();
if("Petrol".equalsIgnoreCase(engineType)){
fuelTypes.add("ULP");
fuelTypes.add("PULP");
}
else if("Diesel".equalsIgnoreCase(engineType)){
fuelTypes.add("BIO");
fuelTypes.add("NORMAL");
}
else{
fuelTypes.add("Default Fuel 1");
fuelTypes.add("Default Fuel 2");
}
return fuelTypes;
}
}
Above works as expected.
Problem:
I want to only have an enumeration on Vehicle.fuelType that depends on the
value of engineType, without specifying an enumeration on engineType. So,
I took out the first line in my enumeration list so that it is now:
'Vehicle.fuelType[engineType]' : '(new
test.VehicleHelper()).getFuelTypes("@{engineType}")'
But that does not work. When I create a rule, VehicleHelper.getFuelTypes
does not get called and the dropdown for fuelType is not a list.
How do I get this working?
Thanks
G. Patel
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
13 years, 10 months
Some problems with Deploying drools-camel-sever 5.3.x in Weblogic 10.x
by ndipiazza
Hey everyone,
We have been trying to deploy drools-camel-server-5.3.x.Final.war from
droolsjbpm-integration-distribution-5.3.0.Final on WebLogic 10.3.3.
We hit a series of issues, of which I've opened up some issue tickets to
address:
1) strict web application container complains about web.xml (JBRULES-3403 -
https://issues.jboss.org/browse/JBRULES-3403) - web.xml needs to be
re-arranged to get it to work in weblogic 10.x.
2) There seems to be duplicate JPA persistence units
(https://issues.jboss.org/browse/JBRULES-3404)
I also experienced two other issues that I do not feel comfortable putting
on the issue tracker because they may be weblogic-specific:
3) When I tried to run a SOAP UI test on the drools server in Weblogic
10.3.3 I get this:
WARNING: Interceptor for {http://soap.jax.drools.org/}CommandExecutor has
thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: This class does not support SAAJ 1.1
at
org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer
.java:123)
at
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:
102)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInv
okerInterceptor.java:58)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:44
1)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecu
tor.java:37)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(Se
rviceInvokerInterceptor.java:106)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:263)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti
ationObserver.java:118)
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(Abstract
HTTPDestination.java:208)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(
ServletController.java:223)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletCont
roller.java:205)
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpr
ingServlet.java:113)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Ab
stractHTTPServlet.java:184)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractH
TTPServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(Abstract
HTTPServlet.java:163)
at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:125)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:300)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:183)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.doIt(WebAppServletContext.java:3686)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3650)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2268)
at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:2174)
at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.lang.UnsupportedOperationException: This class does not
support
SAAJ 1.1
at
weblogic.webservice.core.soap.SOAPMessageImpl.getSOAPBody(SOAPMessage
Impl.java:631)
at
org.drools.jax.soap.PreCxfTransportSoapProcessor.process(PreCxfTransp
ortSoapProcessor.java:42)
at
org.drools.camel.component.DroolsPolicy$DroolsProcess.process(DroolsP
olicy.java:341)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
ToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:70)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat
eAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:89)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:70)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat
eAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:89)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(Trace
Interceptor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:70)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler
(RedeliveryErrorHandler.java:290)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryE
rrorHandler.java:202)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java
:256)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
essor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:70)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat
eAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(Instrume
ntationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:91)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:85)
at
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:
97)
... 29 more
Seems to be two possible ways to solve this (have not tested these yet!)
Option One: Use axis.jar instead of saaj-impl.jar
1. add axis.jar file to bea class path
2. in startWebLogic.sh/cmd
set JAVA_OPTIONS=%SAVE_JAVA_OPTIONS%
-Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl
Option Two: Make a code fix to allow the saaj to function
Follow the below steps to resolve "UnsupportedOperationException"
a. Set classpath to latest saaj-impl.jar in startweblogic.cmd
b. Set the below 2 system properties in code.
System.setProperty("javax.xml.soap.MessageFactory","com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");
System.setProperty("javax.xml.soap.SOAPConnectionFactory","weblogic.wsee.saaj.SOAPConnectionFactoryImpl");
c. Note that the above 2 classes are available in the saaj-impl.jar which i
have used and set classpath in step1. If you are using different version of
saaj-impl.jar, set the exact "MessageFactory" and "SOAPConnectionFactory"
classes which are avilable in your saaj-impl.jar. (Just extract your
saaj-impl.jar and findout the exact classes).
Obviously we cannot expect Drools team to make any code changes with respect
to WebLogic, so I would imagine trying Step 1 is the best way to go.
4) The drools-camel-server.war’s test.jsp apparently runs an example that
uses a Camel route leading to a REST web service. This does not work for me
either off the bat:
WARNING: Interceptor for {http://soap.jax.drools.org/}CommandExecutor has
thrown
exception, unwinding now
org.apache.cxf.interceptor.Fault: Unable to create message factory for SOAP:
Pro
vider org.apache.axis.soap.MessageFactoryImpl not found
at
org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer
.java:123)
at
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:
102)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInv
okerInterceptor.java:58)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:44
1)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecu
tor.java:37)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(Se
rviceInvokerInterceptor.java:106)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:263)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti
ationObserver.java:118)
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(Abstract
HTTPDestination.java:208)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(
ServletController.java:223)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletCont
roller.java:205)
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpr
ingServlet.java:113)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Ab
stractHTTPServlet.java:184)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractH
TTPServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(Abstract
HTTPServlet.java:163)
at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:125)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:300)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:183)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.doIt(WebAppServletContext.java:3686)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3650)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2268)
at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:2174)
at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: javax.xml.soap.SOAPException: Unable to create message factory
for SO
AP: Provider org.apache.axis.soap.MessageFactoryImpl not found
at
javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:116)
at
org.drools.jax.soap.PreCxfTransportSoapProcessor.process(PreCxfTransp
ortSoapProcessor.java:40)
at
org.drools.camel.component.DroolsPolicy$DroolsProcess.process(DroolsP
olicy.java:341)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
ToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:70)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat
eAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:89)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:70)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat
eAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:89)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(Trace
Interceptor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:70)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler
(RedeliveryErrorHandler.java:290)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryE
rrorHandler.java:202)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java
:256)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
essor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:70)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat
eAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(Instrume
ntationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:91)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:85)
at
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:
97)
... 29 more
<Feb 26, 2012 3:58:31 PM CST> <Error> <HTTP> <BEA-101020>
<[ServletContext@12863
942[app:_appsdir_drools-5.3.0A_dir module:drools-5.3.0A path:/drools-5.3.0A
spec
-version:null]] Servlet failed with Exception
org.apache.camel.CamelExecutionException: Exception occurred during
execution on
the exchange: Exchange[Message: <batch-execution lookup="ksession1">
<insert out-identifier="message">
<org.test.Message>
<text>Hello World</text>
</org.test.Message>
</insert>
</batch-execution>
]
at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(Object
Helper.java:1142)
at
org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper
.java:452)
at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(Defau
ltProducerTemplate.java:441)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProduce
rTemplate.java:119)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProduce
rTemplate.java:135)
Truncated. see log file for complete stacktrace
Caused By: org.apache.camel.CamelExchangeException: No consumers available
on en
dpoint: Endpoint[direct://kservice/rest]. Exchange[Message: <batch-execution
loo
kup="ksession1">
<insert out-identifier="message">
<org.test.Message>
<text>Hello World</text>
</org.test.Message>
</insert>
</batch-execution>
]
at
org.apache.camel.component.direct.DirectProducer.process(DirectProduc
er.java:56)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
essor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
er.java:91)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
ncProcessor.java:85)
at
org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProdu
cer.java:63)
Truncated. see log file for complete stacktrace
Apparently the camel endpoint did not deploy at all, or something.
I'm wondering what of these issues are totally specific to WebLogic, and
which are just plain 'ole issues. Can anyone share their experiences or
expectations of using the drools camel server WAR within the various app
servers? How much are we expected to make custom changes?
--
View this message in context: http://drools.46999.n3.nabble.com/Some-problems-with-Deploying-drools-cam...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months
Knowing which constraints are broken for final best solution in drools-planner
by Manuel Aráoz
Hi! I'm new to this forum so... my name is Manuel and I'm using drools
planner to solve an exam scheduling problem :)
I need to analyze which constraints are broken while the algorithm is
running and when the solver finishes also. Geoffrey pointed me to the
examples, where that is done.
I copied the getScoreDetailList() idea from that example, and it works
perfectly fine for when the algorithm is running (constraints are found and
I can inspect them). The basic idea is that this method obtains the working
memory and obtains from it the objects of type ConstraintOccurrence.
The thing is, when the solver finishes and I call this method, it returns
no constraints, even though I know by the score that some constraints are
still broken. Am I doing something wrong? Or is this the expected
behaviour? It seems as if working memory erases the ConstraintOccurrences
when the solver finishes, but I don't really know. In that case, how can I
obtain the constraints broken for the final solution?
Hope I made myself clear! Thanks!
Manuel
13 years, 11 months
make the Guvnor interface into French
by freelance developpement
Hi every one,
For simplicity I must make the interface Guvnor for administration of
business rules, in French and not English under Internet Explorer or
Firefox.
Have you ant idea?
thanx in advance
13 years, 11 months
KnowledgeAgent Changeset problems
by albertorugnone
Hi all,
I have some problem with KnowledgeAgent, maybe you can help me. I will list
these in the following
1) during change set loading I have the following error
(null: 1, 207): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
(null: 1, 207): cvc-elt.1: Cannot find the declaration of element
'change-set'.
(null: 1, 216): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
(null: 1, 311): schema_reference.4: Failed to read schema document
'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>
I suppose this is because change-set.xml can be reached. What is a correct
setting for xs:schemaLocation.
2) I would like scan also a directories in order to add knowledge to my rule
set if I add a new file. How I can do that?
3) KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.newInstance", "true") <== what is the
meaning of this property? Where I can find documentation about those
properties
4) why when I would set a global variable I receive
Exception in thread "main" java.lang.RuntimeException: Unexpected global
[service]
at
org.drools.common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:615)
at
org.drools.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessionImpl.java:332)
at
com.sample.DroolsKnowledgeAgentTest.main(DroolsKnowledgeAgentTest.java:90)
I the following an example about my question
@SuppressWarnings("restriction") public class DroolsKnowledgeAgentTest {
public static class Service {
}
DroolsKnowledgeAgentTest() {
KnowledgeBase newKnowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
ResourceFactory.getResourceChangeNotifierService()
.start();
ResourceFactory.getResourceChangeScannerService()
.start();
final ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "2");
ResourceFactory.getResourceChangeScannerService()
.configure(sconf);
final KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.scanDirectories", "true");
aconf.setProperty("drools.agent.scanResources", "true");
aconf.setProperty("drools.agent.newInstance", "true");
final KnowledgeAgent agent =
KnowledgeAgentFactory.newKnowledgeAgent("pch.sel.knowledge.agent",
newKnowledgeBase, aconf);
// if (_l.isDebugEnabled()) {
/* we need some log every time */
agent.setSystemEventListener(new PrintStreamSystemEventListener());
// }
}
public static void main(String[] args) throws IOException {
ResourceFactory.getResourceChangeNotifierService()
.start();
ResourceFactory.getResourceChangeScannerService()
.start();
String xml = "";
xml += "<change-set xmlns='http://drools.org/drools-5.0/change-set'";
xml += "
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'";
xml += "
xs:schemaLocation='http://drools.org/drools-5.0/change-set
drools-change-set-5.0.xsd' >";
xml += " <add> ";
xml += " <resource
source='Z:/WSP/drools-test/src/main/java/com/sample/rule1.drl' type='DRL'
/>";
xml += " </add> ";
xml += "</change-set>";
FileManager fileManager = new FileManager();
File fxml = fileManager.newFile("changeset.xml");
BufferedWriter output = new BufferedWriter(new FileWriter(fxml));
output.write(xml);
output.close();
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "2");
ResourceFactory.getResourceChangeScannerService()
.configure(sconf);
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.scanDirectories", "true");
aconf.setProperty("drools.agent.scanResources", "true");
aconf.setProperty("drools.agent.newInstance", "true");
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("test
agent", kbase, aconf);
kagent.applyChangeSet(ResourceFactory.newUrlResource(fxml.toURI()
.toURL()));
StatefulKnowledgeSession ksession = kagent.getKnowledgeBase()
.newStatefulKnowledgeSession();
ksession.setGlobal("service", new Service());
}
}
and rule named rule1.drl
#created on: 29-Feb-2012
package com.sample
#list any import classes here.
#declare any global variables here
global DroolsKnowledgeAgentTest.Service service;
rule "Your First Rule"
when
#conditions
then
#actions
end
Thank you very much for your answers and kind regards
Alberto
--
View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgent-Changeset-problems-tp378...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 11 months
[rules user] different behavior on double type
by Zeke
Hi, guys:
I am using Drools 4.0.7. I find a strange behavior. When my LHS is
"Message( varDouble == 99.9 )" and "varDouble" equals "new Double(99.9)",
the condition is true. But when my LHS is "Message( types.doubleType ==
99.9 )" and the "doubleType" field is also equal to "new Double(99.9)", the
condition is false. I debug the code, and find that:
When the LHS is "Message( varDouble == 99.9 )", the logic will handle the
literal 99.9 as *Double.valueOf( “99.9” )*, and the comparison is between *(new
Double(99.9)).doubleValue(*) and *Double.valueOf( “99.9” ).doubleValue()*,
When the LHS is "Message( types.doubleType == 99.9 )", the logic is
different from above. The comparison is between *new BigDecimal((Double)
99.9, MathContext.DECIMAL64)* (which double value is 99.90000000000001) and
*new BigDecimal(“99.9”, MathContext.DECIMAL64)* (which double value is
99.9).
I think we need make things consistent. "varDouble" and
"types.doubleType" are of the same type and value. It doesn't make sense to
have different behavior just because of one field is nesting while the
other is not. I know Drools is using MVEL to evaluate the condition. But I
am not sure it is a MVEL bug or Drools uses MVEL wrong. It will be much
appreciated if you can give me any comments!
13 years, 11 months
Possible "memory leak" in 5.3 with update?
by thenim
I'm using a stateful session (in a slightly odd way - obviously this is the
problem), I have a stream of "messages" coming into my system and each
message one of a set of unique keys. Now my rules test various attibutes of
this message and makes some changes (to the messages) etc. (the rules aren't
the problem here - infact in my test case, I have no rules).
I tested the "normal" approach where each message is inserted and the fact
handle retained, and subsequently after firing, the handle is removed (yes
this sounds like a good case for Fusion, except for the making changes bit.)
I noticed that I could get better throughput, if took the following
approach:
1. On the first time the unique key is detected, the handle is saved
2. Then each time a message with that key is received, "update" is called
with the handle for that key
Now, the important thing here is that the "fact" is a *different* object not
an updated version of the original associated with the handle.
Now with this approach, I was getting better numbers, however every so often
there would be a "pause", with GC details being printed out, I see
immediately that it's sitting there doing full GC's very frequently, and
switching to the concurrent collector, I can see mode failures regularly
(i.e. full GCs). With a low message rate, I didn't notice it initially, but
with higher message rates, this is a serious issue.
It appears that the approach I've taken highlights a "leak". I wanted to
find out if others have encountered this before digging around in the code,
for the moment, I will "fix" my approach so that I update the "same object"
- but is "update" not meant to be used this way?
Thanks,
Nim
--
View this message in context: http://drools.46999.n3.nabble.com/Possible-memory-leak-in-5-3-with-update...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 11 months
How best to get back the updates that rules perform on declarative fact objects onto the domain objects (Dynamic fact generation with Declarative Fact Model)
by Vidya
Hi,
I am trying to evaluate using Drools in our EDM product. Our domain model is
very generic and complicated to be used as is as the fact model. Also new
domain entities will be added frequently and we would not want to write the
java fact model and supply the jar to the application (which needs
application bouncing...). So we may have to implement dynamic code
generation (using say javaassist).
Now I see that it can be partly achieved with the use of declarative fact
model (which does the dynamic code generation part for us).
But I have these questions -
When the rules fire, any update it makes on the fact needs to be updated
back onto our domain object obviously. Given that the fact model could be
potentially big, we were wondering
- if there can be anyway by which the application can be notified of
updates to the declared fact so we can copu only the changed attributes
backour domain object instead of copying all attributes back
OR
- if there was any way to introduce a dynamic proxy to the declared facts
so that the update (setXXX()) would have been called on the proxy which in
turn could update our domain object directly. As I see, this cannot be done
currently as the declarative facts are concrete classes and do not implement
any interface (its not possible to declare interfaces in drl files)
Is there any other better way to achieve this or should we go for dynamic
code generation in our application itself as mentioned in the beginning and
supply them as facts?
Thanks
Vidya
--
View this message in context: http://drools.46999.n3.nabble.com/How-best-to-get-back-the-updates-that-r...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 11 months
Drools performance
by Hassan
Hi everyone,
In one of my tests, I inserted 1000000 objects into the working memory,
drools engine made a lot of time to execute the program and it throws
Exception : "java.lang.OutOfMemoryError !!
Please if someone could help me to improve drools performance and specially
reduce the drools execution time
thanks
-----
Youssef AZBAKH.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-performance-tp3870569p3870569.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 11 months