Is transaction management required for Drools process / session persistence
by Gustavo Tenrreiro
Hi,
I am trying to do Drools persistence in Tomcat with Hibernate, but it
would seem it also requires transaction management. Is that true?
In the meantime I tried to setup Bittronix to provide the transaction
management, but I can't get Hibernate to find the datasource at all.
I ve followed the BTM integration instructions for Tomcat, I ve also
done followed the BTM integration instructions for Hibernate, but
still nothing, Hibernate keeps saying it can't find the datasource.
Can anyone shed some light on this ?
BTW: my database is SQL Server
Thanks
14 years, 3 months
OptionalDataException reading compiled Packages
by Manish Shah
Not sure what happened with this post yesterday, another chain got started
with it, so trying again.
I have the application setup where the drl is generated from the database
and then written to the file system. So far i have been working with the
drl's without any problems but have run into issues while working with
packages.
Any help is much appreciated. Thanks.
Here is what i am doing while serializing the package.
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new StringReader(drl));
Package pkg = builder.getPackage();
DroolsStreamUtils.streamOut(new ObjectOutputStream(new FileOutputStream(new
File(fileName+".pkg"))), pkg);
i also tried the writeExternal on package, this genereate the file but got a
class cast exception while trying to load it.
The pkg file is generated and i dont think it has a problem unless i am
missing something in the above code.
Now, on the other side i am using drools-spring which sets up the agent on
startup. I was doing some trial and error and found two configurations that
worked but needed
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
to be in code, just the spring configuration didnt work (again if i am
missing something please let me know).
here are the spring configuration
First
<drools:kagent id="agent" kbase="base" new-instance="true"/>
<drools:kbase id="base">
<drools:resources>
<!--drools:resource type="DRL"
source="file:C:\file.drl"/--> //this works
<drools:resource type="PKG"
source="file:C:\file.pkg"/>
</drools:resources>
</drools:kbase-->
Second
<drools:kagent id="agent" kbase="base" new-instance="true">
<drools:resources>
<drools:resource type="CHANGE_SET"
source="file:C:\change-set.xml"/>
</drools:resources>
</drools:kagent>
<drools:kbase id="base"></drools:kbase>
and the changeset
<change-set...>
<add>
<resource source='file:/C:/file.pkg' type='PKG'/>
</add>
</change-set>
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/OptionalDataException...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 3 months
Purpose of field "Object" in DSL pattern definition?
by Wolfgang Laun
A DSL definition may have an "Object" entry which shows up in the
second pair of brackets, e.g.
[condition][object]Blah=Blah()
What is the purpose? None of the .dsl files in the 5.1 source has it filled in.
-W
14 years, 3 months
Database problem
by nch
Hi, there.
I need advice on how to approach the following. Hope I'm being clear:
- I have a database of over 30 tables.
- The database is being updated every now and then.
- I need to perform a bunch of calculations based on what's on the DB.
- Some of the calculations depend on intermediate calculations.
- I decided to use Drools in order to perform such calculations.
- Rules would take into account a wide range of factors.
- I know Drools is aware of facts that exist in its working memory only.
- On one hand I'd move the whole DB to the working memory in order to perform the calculations, but then I'd have to keep working memory and DB in sync.
- On the other hand I'd invoke Drools to perform specific calculations by passing it only relevant facts, but I think those relevant facts are a lot.
Should I try to keep DB and WM in sync? How? Should I try invoking Drools everytime I need a calculation? Are there any other alternatives?
Kind regards.
14 years, 3 months
comparing an intersection of sets..
by mechlife
Hi,
I have a situation where i need to evaluate a condition where the
intersection of 2 sets should atleast have one element in it. I am using
drools template to create the DRL and have a set B (item1,item2, item3,
item4). Now, at runtime i have a setA (item2, item5). the intersection of
the sets will have item2 and such should evaluate to true. I am currently
using evaluate to do a custom function but just wanted to check if there was
a way to do something like this by utilizing one of the existing keywords
available.
Any insight will be very appreciated. thanks for your time.
-ms
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/comparing-an-intersec...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 3 months
Implementation problems with long running WorkItems
by jschmied
Hi!
I have a flow where I call external webservices parallel from my own
WorkItemHandler. I have a ExecutorService and in executeWorkItem I submit a
Callable what does the work, so executeWorkItem return immediately. The
Callable calls workItemManager.completeWorkItem after the work is done.
As far as I can judge it works but I see the following problems:
- Is the workItemManager threadsafe? Can i call completeWorkItem() from a
other thread?
- In the parallel threads I do a ksession.insert(). Is this safe?
- Should I wrap the StatefulKnowledgeSession in a thread safe wrapper?
- fireAllRules does not wait for the process to finish but returns
immediately so I have to use fireUntilHalt. This uses one CPU core
completely. My solution is:
ProcessInstance prc = ksession.startProcess("Main");
while (prc.getState() == ProcessInstance.STATE_ACTIVE) {
Thread.sleep(100);
ksession.fireAllRules();
}
Is this OK or is there a better solution? I dont like polling ;-(.
Thanks!
juergen
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Implementation-proble...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 3 months
Drools Flow with Persistence and long running tasks
by Chrystall, Greg
Hi,
Does anyone have a production project that is using drools persistence and has long running tasks, which have to run concurrently?
If anyone is, how do you create your KnowledgeSession(s) and handle starting multiple ProcessInstances at the same time?
Thanks,
Greg
________________________________
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
14 years, 3 months
Re: [rules-users] rules-users Digest, Vol 45, Issue 121
by Burak Aydin
KnowledgeBaseImpl also seems to be unsafe because threads get stuck while
trying to open a new StatefulKnowledgeSession
org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession()
On Thu, Aug 26, 2010 at 3:49 PM, <rules-users-request(a)lists.jboss.org>wrote:
> Send rules-users mailing list submissions to
> rules-users(a)lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help' to
> rules-users-request(a)lists.jboss.org
>
> You can reach the person managing the list at
> rules-users-owner(a)lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
> 1. CommandFactory.newSetGlobal and scope (Ricardo J. M?ndez)
> 2. Re: Stuck Threads (Esteban Aliverti)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 26 Aug 2010 15:30:47 +0300
> From: Ricardo J. M?ndez <mendezster(a)gmail.com>
> Subject: [rules-users] CommandFactory.newSetGlobal and scope
> To: rules-users(a)lists.jboss.org
> Message-ID:
> <AANLkTimLN6duK+SMeRuv6ZVUtEhk4B+sdYYBxkfXozLu(a)mail.gmail.com<AANLkTimLN6duK%2BSMeRuv6ZVUtEhk4B%2BsdYYBxkfXozLu(a)mail.gmail.com>
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi everyone,
>
> I'm reading through Michael Bali's Drools JBoss Rules book as well as the
> reference guide, and I've got a question of scope about
> StatefulKnowledgeSessions.
>
> I understand that if I call setGlobal on a stateful session, this global
> value will be shared for all simultaneous calls to executeRules across all
> threads. I'm looking into CommandFactory, which has a newSetGlobal
> method. From what I gather, a global set via CommandFactory.newSetGlobal
> and then executed with a call to
> execute(CommandFactory.newBatchExecution(cmds)) would be scoped solely to
> that execution, regardless of it is a StatefulKnowledgeSession and there
> are
> other parallel command executions against the same session.
>
> Can anyone confirm if that is accurate?
>
> Thanks in advance,
>
> --
> Ricardo J. M?ndez
> http://www.arquetipos.co.cr/
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/rules-users/attachments/20100826/d694c41...
>
> ------------------------------
>
> Message: 2
> Date: Thu, 26 Aug 2010 09:48:19 -0300
> From: Esteban Aliverti <esteban.aliverti(a)gmail.com>
> Subject: Re: [rules-users] Stuck Threads
> To: Rules Users List <rules-users(a)lists.jboss.org>
> Message-ID:
> <AANLkTi=-nMM4pkKFbxTa_WWRqpPsFi9QbGN8iY_fSsxC(a)mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> StatefulSessions are not thread safe.
>
> El ago 26, 2010 9:23 a.m., "Burak Aydin" <burak.aydin(a)obss.com.tr>
> escribi?:
>
> Hello,
>
> While trying to open stateful session in a 32 core machine and 35 threads,
> all of the threads hangs. Below is the stack trace. ChainedProperties class
> seems to be thread-unsafe??
>
> gridgain-#13%null%" - Thread t@64
>
> java.lang.Thread.State: RUNNABLE
>
> at
> sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:806)
>
> at
> sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:765)
>
> at
> sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:735)
>
> at sun.misc.URLClassPath$1.next(URLClassPath.java:196)
>
> at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:206)
>
> at java.net.URLClassLoader$3$1.run(URLClassLoader.java:416)
>
> at java.security.AccessController.doPrivileged(Native Method)
>
> at java.net.URLClassLoader$3.next(URLClassLoader.java:413)
>
> at
> java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:438)
>
> at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
>
> at
> sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
>
> at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
>
> at
> sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
>
> at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
>
> at
> sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
>
> at
>
> org.drools.util.ChainedProperties.loadProperties(ChainedProperties.java:232)
>
> at org.drools.util.ChainedProperties.(ChainedProperties.java:112)
>
> at org.drools.util.ChainedProperties.(ChainedProperties.java:41)
>
> at org.drools.util.ChainedProperties.(ChainedProperties.java:35)
>
> at
> org.drools.SessionConfiguration.init(SessionConfiguration.java:131)
>
> at org.drools.SessionConfiguration.(SessionConfiguration.java:112)
>
> at
>
> org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:134)
>
> at texan.qset.service.QsetService.executeQset(QsetService.java:72)
>
> at texan.qset.service.QsetService.executeQset(QsetService.java:34)
>
> at
>
> texan.crop.service.ProductPostingService.processQSet(ProductPostingService.java:600)
>
> at
>
> texan.crop.service.ProductPostingService.processQSets(ProductPostingService.java:582)
>
> at
>
> texan.crop.service.ProductPostingService.createOrUpdateProduct(ProductPostingService.java:562)
>
> at
>
> texan.crop.service.ProductPostingService.postingProcess(ProductPostingService.java:181)
>
> at
>
> texan.crop.service.ProductPostingService.productPostingProcess_aroundBody0(ProductPostingService.java:85)
>
> at
>
> texan.crop.service.ProductPostingService$AjcClosure1.run(ProductPostingService.java:1)
>
> at org.aspectj.runtime.reflect.JoinPointImpl.proceed(Unknown Source)
>
> at
>
> falez.runtime.aop.FalezTransactionalAspect$4.proceed(FalezTransactionalAspect.java:176)
>
> at
>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>
> at
>
> falez.runtime.aop.FalezTransactionalAspect.advice(FalezTransactionalAspect.java:215)
>
> at
>
> falez.runtime.aop.TexanTransactionalAspect.ajc$inlineAccessMethod$falez_runtime_aop_TexanTransactionalAspect$falez_runtime_aop_FalezTransactionalAspect$advice(TexanTransactionalAspect.java:1)
>
> at
>
> falez.runtime.aop.TexanTransactionalAspect.around(TexanTransactionalAspect.java:26)
>
> at
>
> texan.crop.service.ProductPostingService.productPostingProcess(ProductPostingService.java:80)
>
> at
>
> texan.crop.batch.grid.ProductPostingBatch.doCifProcess(ProductPostingBatch.java:45)
>
> - locked texan.crop.batch.grid.ProductPostingBatch@@10880
>
> at
>
> texan.crop.batch.grid.ProductPostingBatch.doProcess(ProductPostingBatch.java:37)
>
> at
>
> falez.runtime.batch.AbstractBatchOperation.doProcess(AbstractBatchOperation.java:209)
>
> at
>
> texan.crop.batch.grid.ProductPostingBatch.doProcess_aroundBody0(ProductPostingBatch.java:29)
>
> at
>
> texan.crop.batch.grid.ProductPostingBatch$AjcClosure1.run(ProductPostingBatch.java:1)
>
> at org.aspectj.runtime.reflect.JoinPointImpl.proceed(Unknown Source)
>
> at
>
> falez.runtime.aop.FalezTransactionalAspect$4.proceed(FalezTransactionalAspect.java:176)
>
> at
>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>
> at
>
> falez.runtime.aop.FalezTransactionalAspect.advice(FalezTransactionalAspect.java:215)
>
> at
>
> falez.runtime.aop.TexanTransactionalAspect.ajc$inlineAccessMethod$falez_runtime_aop_TexanTransactionalAspect$falez_runtime_aop_FalezTransactionalAspect$advice(TexanTransactionalAspect.java:1)
>
> at
>
> falez.runtime.aop.TexanTransactionalAspect.around(TexanTransactionalAspect.java:26)
>
> at
>
> texan.crop.batch.grid.ProductPostingBatch.doProcess(ProductPostingBatch.java:28)
>
> at
>
> falez.runtime.batch.AbstractBatchOperation.process(AbstractBatchOperation.java:76)
>
> at
>
> falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.doExecute(BatchProcessingTask.java:89)
>
> at
>
> falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.execute(BatchProcessingTask.java:76)
>
> at
>
> falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.execute(BatchProcessingTask.java:1)
>
> at
>
> org.gridgain.grid.kernal.processors.job.GridJobWorker.body(GridJobWorker.java:406)
>
> at
> org.gridgain.grid.util.runnable.GridRunnable$1.run(GridRunnable.java:142)
>
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>
> at
> org.gridgain.grid.util.runnable.GridRunnable.run(GridRunnable.java:194)
>
> at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
> at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>
> at java.lang.Thread.run(Thread.java:619)
>
> --
> Burak AYDIN
> Senior Software Engineer
> OBSS
> -------------------------------------
> 9433 @YKB
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/rules-users/attachments/20100826/da59450...
>
> ------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> End of rules-users Digest, Vol 45, Issue 121
> ********************************************
>
--
Burak AYDIN
Senior Software Engineer
OBSS
-------------------------------------
9433 @YKB
14 years, 3 months
Stuck Threads
by Burak Aydin
Hello,
While trying to open stateful session in a 32 core machine and 35 threads,
all of the threads hangs. Below is the stack trace. ChainedProperties class
seems to be thread-unsafe??
gridgain-#13%null%" - Thread t@64
java.lang.Thread.State: RUNNABLE
at
sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:806)
at
sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:765)
at
sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:735)
at sun.misc.URLClassPath$1.next(URLClassPath.java:196)
at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:206)
at java.net.URLClassLoader$3$1.run(URLClassLoader.java:416)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader$3.next(URLClassLoader.java:413)
at
java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:438)
at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
at
sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
at
sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
at
sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
at
org.drools.util.ChainedProperties.loadProperties(ChainedProperties.java:232)
at org.drools.util.ChainedProperties.(ChainedProperties.java:112)
at org.drools.util.ChainedProperties.(ChainedProperties.java:41)
at org.drools.util.ChainedProperties.(ChainedProperties.java:35)
at
org.drools.SessionConfiguration.init(SessionConfiguration.java:131)
at org.drools.SessionConfiguration.(SessionConfiguration.java:112)
at
org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:134)
at texan.qset.service.QsetService.executeQset(QsetService.java:72)
at texan.qset.service.QsetService.executeQset(QsetService.java:34)
at
texan.crop.service.ProductPostingService.processQSet(ProductPostingService.java:600)
at
texan.crop.service.ProductPostingService.processQSets(ProductPostingService.java:582)
at
texan.crop.service.ProductPostingService.createOrUpdateProduct(ProductPostingService.java:562)
at
texan.crop.service.ProductPostingService.postingProcess(ProductPostingService.java:181)
at
texan.crop.service.ProductPostingService.productPostingProcess_aroundBody0(ProductPostingService.java:85)
at
texan.crop.service.ProductPostingService$AjcClosure1.run(ProductPostingService.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(Unknown Source)
at
falez.runtime.aop.FalezTransactionalAspect$4.proceed(FalezTransactionalAspect.java:176)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
falez.runtime.aop.FalezTransactionalAspect.advice(FalezTransactionalAspect.java:215)
at
falez.runtime.aop.TexanTransactionalAspect.ajc$inlineAccessMethod$falez_runtime_aop_TexanTransactionalAspect$falez_runtime_aop_FalezTransactionalAspect$advice(TexanTransactionalAspect.java:1)
at
falez.runtime.aop.TexanTransactionalAspect.around(TexanTransactionalAspect.java:26)
at
texan.crop.service.ProductPostingService.productPostingProcess(ProductPostingService.java:80)
at
texan.crop.batch.grid.ProductPostingBatch.doCifProcess(ProductPostingBatch.java:45)
- locked texan.crop.batch.grid.ProductPostingBatch@@10880
at
texan.crop.batch.grid.ProductPostingBatch.doProcess(ProductPostingBatch.java:37)
at
falez.runtime.batch.AbstractBatchOperation.doProcess(AbstractBatchOperation.java:209)
at
texan.crop.batch.grid.ProductPostingBatch.doProcess_aroundBody0(ProductPostingBatch.java:29)
at
texan.crop.batch.grid.ProductPostingBatch$AjcClosure1.run(ProductPostingBatch.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(Unknown Source)
at
falez.runtime.aop.FalezTransactionalAspect$4.proceed(FalezTransactionalAspect.java:176)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
falez.runtime.aop.FalezTransactionalAspect.advice(FalezTransactionalAspect.java:215)
at
falez.runtime.aop.TexanTransactionalAspect.ajc$inlineAccessMethod$falez_runtime_aop_TexanTransactionalAspect$falez_runtime_aop_FalezTransactionalAspect$advice(TexanTransactionalAspect.java:1)
at
falez.runtime.aop.TexanTransactionalAspect.around(TexanTransactionalAspect.java:26)
at
texan.crop.batch.grid.ProductPostingBatch.doProcess(ProductPostingBatch.java:28)
at
falez.runtime.batch.AbstractBatchOperation.process(AbstractBatchOperation.java:76)
at
falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.doExecute(BatchProcessingTask.java:89)
at
falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.execute(BatchProcessingTask.java:76)
at
falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.execute(BatchProcessingTask.java:1)
at
org.gridgain.grid.kernal.processors.job.GridJobWorker.body(GridJobWorker.java:406)
at
org.gridgain.grid.util.runnable.GridRunnable$1.run(GridRunnable.java:142)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
org.gridgain.grid.util.runnable.GridRunnable.run(GridRunnable.java:194)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
--
Burak AYDIN
Senior Software Engineer
OBSS
-------------------------------------
9433 @YKB
14 years, 3 months