[rules-users] Need to Serialize QueryResults
Hi! I would like to use the BatchExecution as an interface between EJB's. The BatchExecutionCommand is serializable. But when I try to get back the QueryResults I get a: java.io.NotSerializableException: org.drools.runtime.rule.impl.NativeQueryResults can this class changed to extend Serializable? Should I do it in a different way? Thanks! Juergen -- View this message in context: http://drools.46999.n3.nabble.com/Need-to-Serialize-QueryResults-tp4021271.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] drools 5.3.1 ?
Hi! Jbpm 5.2 contains drools 5.3.1 files. What is new there? Does 5.2 work with the drools 5.3. release too? Thanks! Juergen -- View this message in context: http://drools.46999.n3.nabble.com/drools-5-3-1-tp3585562p3585562.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Audit log created with Drools 5.1 unreadable with Drools 5.3 Eclipse plugin?
I think this is not the case. I can view a 5.3. log with the 5.2 viewer but I can't view a 5.3. log with the 5.3 viewer. Thanks. Juergen -- View this message in context: http://drools.46999.n3.nabble.com/Audit-log-created-with-Drools-5-1-unreadable-with-Drools-5-3-Eclipse-plugin-tp3490197p3554046.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools flow persistence with Oracle, Could not obtain BTM transaction manager instance
Hi! It works for me on Oracle. in persistence.xml: org.hibernate.ejb.HibernatePersistence jdbc/processInstanceDS org.drools.persistence.info.SessionInfo org.drools.persistence.info.WorkItemInfo org.jbpm.persistence.processinstance.ProcessInstanceInfo org.jbpm.process.audit.ProcessInstanceLog org.jbpm.process.audit.NodeInstanceLog org.jbpm.process.audit.VariableInstanceLog orm.xml http://java.sun.com/xml/ns/persistence/orm"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd" version="1.0"> select processInstanceInfo.processInstanceId from ProcessInstanceInfo processInstanceInfo where :type in elements(processInstanceInfo.eventTypes) Code: PoolingDataSource ds = new PoolingDataSource(); ds.setUniqueName("jdbc/processInstanceDS"); ds.setMaxPoolSize(3); ds.setAllowLocalTransactions(true); ds.setClassName("oracle.jdbc.xa.client.OracleXADataSource"); ds.getDriverProperties().put("user", "drools"); ds.getDriverProperties().put("password", "drools"); ds.getDriverProperties().put("URL", "jdbc:oracle:thin:@localhost:1521:ewi300"); ds.init(); System.out.println("create EMF"); EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa"); BitronixTransactionManager transactionManager = TransactionManagerServices.getTransactionManager(); System.out.println("create ENV"); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf); env.set(EnvironmentName.TRANSACTION_MANAGER, transactionManager); env.set(EnvironmentName.GLOBALS, new MapGlobalResolver()); UserTransaction ut = transactionManager; ... juergen -- View this message in context: http://drools.46999.n3.nabble.com/Drools-flow-persistence-with-Oracle-Could-not-obtain-BTM-transaction-manager-instance-tp2927178p2927282.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Timer Event Node and Persistence
Ok, I solved it. After reloading the session I have to reregister the workitemhandler. Sometimes I still get a exception: 2011/02/03 11:28:17.184{UTC} [SingleSessionCommandService] [pool-1-thread-1]: ERROR: : Could not commit session java.lang.NullPointerException at org.drools.persistence.jpa.JpaPersistenceContextManager.beginCommandScopedEntityManager(JpaPersistenceContextManager.java:67) at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:290) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.call(JpaJDKTimerService.java:76) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.call(JpaJDKTimerService.java:64) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207) 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) load org.drools.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction@3e8ad1 at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1000) at org.drools.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:832) at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:89) at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:164) at org.drools.time.impl.JDKTimerService$JDKCallableJob.call(JDKTimerService.java:147) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.internalCall(JpaJDKTimerService.java:81) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.access$100(JpaJDKTimerService.java:64) at org.drools.persistence.jpa.JpaJDKTimerService$JDKCallableJobCommand.execute(JpaJDKTimerService.java:97) at org.drools.persistence.jpa.JpaJDKTimerService$JDKCallableJobCommand.execute(JpaJDKTimerService.java:85) at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:295) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.call(JpaJDKTimerService.java:76) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.call(JpaJDKTimerService.java:64) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207) 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) Caused by: java.lang.NullPointerException at org.jbpm.process.audit.JPAWorkingMemoryDbLogger.getEntityManager(JPAWorkingMemoryDbLogger.java:131) at org.jbpm.process.audit.JPAWorkingMemoryDbLogger.addNodeExitLog(JPAWorkingMemoryDbLogger.java:118) at org.jbpm.process.audit.JPAWorkingMemoryDbLogger.logEventCreated(JPAWorkingMemoryDbLogger.java:80) at org.drools.audit.WorkingMemoryLogger.filterLogEvent(WorkingMemoryLogger.java:194) at org.drools.audit.WorkingMemoryLogger.beforeNodeLeft(WorkingMemoryLogger.java:504) at org.drools.event.ProcessEventSupport.fireBeforeNodeLeft(ProcessEventSupport.java:116) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:162) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150) at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47) at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162) at org.jbpm.workflow.instance.node.TimerNodeInstance.triggerCompleted(TimerNodeInstance.java:135) at org.jbpm.workflow.instance.node.TimerNodeInstance.signalEvent(TimerNodeInstance.java:125) at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:333) at org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction.execute(DefaultSigna
[rules-users] Timer Event Node and Persistence
Hi! Playing around I created a ruleflow with a timer event. When the timer is firing and I try to persist the ruleflow the timer keeps fireing and I get the following exception: org.drools.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction@82b92b at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1000) at org.drools.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:832) at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:89) at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:164) at org.drools.time.impl.JDKTimerService$JDKCallableJob.call(JDKTimerService.java:147) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.internalCall(JpaJDKTimerService.java:81) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.access$100(JpaJDKTimerService.java:64) at org.drools.persistence.jpa.JpaJDKTimerService$JDKCallableJobCommand.execute(JpaJDKTimerService.java:97) at org.drools.persistence.jpa.JpaJDKTimerService$JDKCallableJobCommand.execute(JpaJDKTimerService.java:85) at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:295) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.call(JpaJDKTimerService.java:76) at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.call(JpaJDKTimerService.java:64) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207) 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) Caused by: org.drools.WorkItemHandlerNotFoundException: Could not find work item handler for Log at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.throwWorkItemNotFoundException(JPAWorkItemManager.java:60) at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:55) at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:101) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150) at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:55) at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:51) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150) at org.jbpm.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152) at org.jbpm.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:65) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150) at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:55) at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:51) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150) at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47) at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162) at org.jbpm.workflow.instance.node.TimerNodeInstance.triggerCompleted(TimerNodeInstance.java:135) at org.jbpm.workflow.instance.node.TimerNodeInstance.signalEvent(TimerNodeIns
Re: [rules-users] How do I prevent the package registry from being null in my package builder?
Just tested: java.lang.NullPointerException at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:430) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:466) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) at drools.test.PersistenceTest.testPersistence(PersistenceTest.java:49) happends when jbpm-flow-builder-5.0-SNAPSHOT.jar is missing from classpath. Ok, its 2 stackframes higher ;-) juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-do-I-prevent-the-package-registry-from-being-null-in-my-package-builder-tp972121p2409086.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How do I prevent the package registry from being null in my package builder?
Hi! Check if drools-flow-compiler-5.2.0.SNAPSHOT.jar or jbpm-flow-builder-5.0-SNAPSHOT.jar is in your classpath. (or the jar with the same function of a older release) juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-do-I-prevent-the-package-registry-from-being-null-in-my-package-builder-tp972121p2401214.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Class Cast Exception with
Hi! Currently I'm testing with drool's build 111 and jbpm build 72 and when using a workitem together with persistence I get: java.lang.ClassCastException: org.hibernate.ejb.EntityManagerFactoryImpl cannot be cast to org.drools.persistence.PersistenceContextManager at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalAbortWorkItem(JPAWorkItemManager.java:67) at org.jbpm.workflow.instance.node.WorkItemNodeInstance.cancel(WorkItemNodeInstance.java:216) at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:256) at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:105) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150) Processes without workitems are getting persisted orderly. Any ideas? Thanks juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Class-Cast-Exception-with-tp2399135p2399135.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] eclipse: No RuleTable cells in spreadsheet.
Hi! If I have any *.xls file inside a eclipse project, the eclipse plugin thinks it's a decision table and says: ERROR: "No RuleTable cells in spreadsheet." can I prevent the plugin from taking *.xls files from all folders as spreadsheet? (I'm using *.xls and rule-templates to generate drl's) Thanks juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/eclipse-No-RuleTable-cells-in-spreadsheet-tp2366744p2366744.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Missing Jars again
Hi! I just downloaded drools-5.2.0-SNAPSHOT-bin.zip from https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/target/ (Build 106). Its missing the drools-flow-core-5.2.0.SNAPSHOT.jar and others. Where can I get it? Thanks juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Where-to-get-the-latest-Stable-build-of-Drools-5-2-tp2162175p2366692.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Hi...
Could you describe, what the code at zyeeda-framework.googlecode.com is made for ??? juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Hi-tp1984951p1991356.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Weird Problem: WorkItemManager seems to loose WorkItems
Hi! >on the RuleFlowProcess object and on the ProcessInctance object I think this is the problem. Try to synchronize _everything_ (KSession, Workitems and Flow) on the _same_ Object. (Keep in mind too: a static and a instance are different objects). I had similar problems and got it fixed like this. Bye juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Weird-Problem-WorkItemManager-seems-to-loose-WorkItems-tp1986222p1991326.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] StatefulKnowledgeSession.startProcess not thread-safe ?
There are more unsafe methods: I got locks when calling completeWorkItem, fireAllRules and insert concurrently. juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/StatefulKnowledgeSession-startProcess-not-thread-safe-tp1973203p1986129.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] [flow][bpmn2] Variable not available in workitem?
Hi! You have to define a mapping between the workflow variables and the workitem parameters. The same for out parameter. You can do this in the eclipse editor. juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/flow-bpmn2-Variable-not-available-in-workitem-tp1876528p1876770.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Starting engine using fireUntilHalt and inserting no facts results in 50% CPU usage
You can call fireAllRules after every event changing the state of the facts or of the ruleflow. When you do event stream processing and use the time inside your rules, the time is a change event too. So you have to use fireUntilHalt if you can't afford to have the small pauses using fireAllRules/Sleep in a loop. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Starting-engine-using-fireUntilHalt-and-inserting-no-facts-results-in-50-CPU-usage-tp1760370p1766875.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Starting engine using fireUntilHalt and inserting no facts results in 50% CPU usage
Hi! fireUntilHalt uses one processor with 100%. You have a dualcore, so it's 50%. It's by design like this. You can: - Call fireAllRules after every insert if you have no ruleflow. - Use fireAllRules in a loop with a small sleep and check for the end of the ruleflow in the loop: while (prc.getState() == ProcessInstance.STATE_ACTIVE) { Threads.sleep(20); ksession.fireAllRules(); } with both methods you get a low cpu load. bye juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Starting-engine-using-fireUntilHalt-and-inserting-no-facts-results-in-50-CPU-usage-tp1760370p1761821.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is drools ksession thread-safe?
>What should be the ProcessInstance prc variable in your code? >Also, did you have to create synchronized insert (and modify, update) method in your wrapper class? This is beacuse the whole API has to be synchronized within one Object. This means for me the KSession, the Process and WokItemManager. My object has a filed what holds the KSession and has delegates for all the functions I use. To synchronize the process and workitemmanager I do within the _same_ class: public synchronized int getPrcState(ProcessInstance prc) { return prc.getState(); } so everthing is synchronized with the same class. The class is: public class DroolsWrapper { private KnowledgeBase kbase; public DroolsWrapper() throws FctyException { kbase = . } public StatefulKnowledgeSessionWrapper newStatefulKnowledgeSession() { return new StatefulKnowledgeSessionWrapper(); } public class StatefulKnowledgeSessionWrapper { private StatefulKnowledgeSession kSession; public StatefulKnowledgeSessionWrapper(KnowledgeBase kbase, String bcn, FctyFrame fctyFrame) { kSession = kbase.newStatefulKnowledgeSession(); } public synchronized void dispose() { kSession.dispose(); } public synchronized WorkItemManager getWorkItemManager() { return kSession.getWorkItemManager(); } public synchronized void setGlobal(String string, Object obj) { kSession.setGlobal(string, obj); } public synchronized ProcessInstance startProcess(String string) { return kSession.startProcess(string); } public synchronized FactHandle insert(Object obj) { logger.debug(obj.toString()); return kSession.insert(obj); } public synchronized int fireAllRules() { return kSession.fireAllRules(); } public synchronized QueryResults getQueryResults(String string) { return kSession.getQueryResults(string); } public synchronized Object getGlobal(String string) { return kSession.getGlobal(string); } public synchronized void completeWorkItem(WorkItem workItem, Map results) { kSession.getWorkItemManager().completeWorkItem(workItem.getId(), results); } public synchronized void abortWorkItem(WorkItem workItem) { kSession.getWorkItemManager().abortWorkItem(workItem.getId()); } public synchronized int getPrcState(ProcessInstance prc) { return prc.getState(); } public synchronized void completeWorkItem(WorkItem workItem, Exception e) { // complete with a Exception Map results = new HashMap(); results.put("Exception", e); kSession.getWorkItemManager().completeWorkItem(workItem.getId(), results); } } } juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Is-drools-ksession-thread-safe-tp1736738p1744436.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is drools ksession thread-safe?
I think no. I use a session in a multithread environment I had to put a wrapper with synchronized methods around it to prevent random locks. FireUntilHalt consumes 100% CPU. I have a ruleflow and found: while (ksession.getPrcState(prc) == ProcessInstance.STATE_ACTIVE) { Threads.sleep(10); ksession.fireAllRules(); } performs much better. The functions are: public synchronized int fireAllRules() { return kSession.fireAllRules(); } public synchronized int getPrcState(ProcessInstance prc) { return prc.getState(); } of my threadsafe warpper class. juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Is-drools-ksession-thread-safe-tp1736738p1737521.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Exists a stylesheet to render the FileLogger output?
Hi! Has anybody ever written a stylesheet to render the FileLogger output to a html page? Thanks! juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Exists-a-stylesheet-to-render-the-FileLogger-output-tp1560452p1560452.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Subflow and Fault
Hi! If I have a subflow without a exception hanlder and there is thrown a fault inside, the exception handler of main process doesn't get the exception. The main process goes on like the subprocess has finished orderly. This is a bit surprising because the documentation says: "Nesting of exception handlers is allowed; a node will always search for an appropriate exception handler in its parent container." - Is it right that the main process continous even a subprocess is broken? (Could I use the Exit-Action to throw a fault when the subprocess is not finished orderly?) - Is it right that the exception doesn't go from the subprocess into the mainprocess? Thanks Juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Subflow-and-Fault-tp1458195p1458195.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] WorkItem - meaning of abortWorkItem
Hi! I couldn't find it out in teh meantime. What is the difference, if I finish a WorkItem by calling completeWorkItem or abortWorkItem ?? The Process goes on in both cases. Thanks for an answer. Juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/WorkItem-meaning-of-abortWorkItem-tp1439653p1445654.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] WorkItem - meaning of abortWorkItem
Hi! I implemented a workitem an I call completeWorkItem/abortWorkItem depending on the success of the work. The workflow goes on, nevertheless what I call. How can I handle abortWorkItem in my process? This function is not documented. Thanks juergen (cu at JUDCon in Berlin) -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/WorkItem-meaning-of-abortWorkItem-tp1439653p1439653.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Implementation problems with long running WorkItems
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-problems-with-long-running-WorkItems-tp1354731p1354731.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] How does teh engine handle WorkItemManager.abortWorkItem ?
Hi! When I call WorkItemManager.abortWorkItem(id) inside a thread started in WorkItemHandler.executeWorkItem() the execution of my process continous unaffected. How can I handle this and abort the process? Thanks Juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-does-teh-engine-handle-WorkItemManager-abortWorkItem-tp1330555p1330555.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Ruleflow / Domain-specific processes / thread model
Thanks, I don it like this now: public void executeWorkItem(WorkItem wi, WorkItemManager wim) { MyThread th = new MyThread(); th.start(); } private final class MyThread extends Thread { public WorkItem wi; public WorkItemManager wim; @Override public void run() { try { // do something wim.completeWorkItem(wi.getId(), null); } catch (Exception e) { wim.abortWorkItem(wi.getId()); } } } Should be OK !? juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rileflow-Domain-specific-processes-thread-model-tp1329422p1330496.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Rileflow / Domain-specific processes / thread model
Hi! When I define a ruleflow with parallel branches and have my own WorkItems in both branches do they get executed in parallel threads? Thanks juergen -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rileflow-Domain-specific-processes-thread-model-tp1329422p1329422.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] JMS/Pipeline how to get the result out of it?
Hi! Sorry for posting again. I havn't found a good solution in the meantime. Any ideas? Thanks! juergen -- View this message in context: http://n3.nabble.com/JMS-Pipeline-how-to-get-the-result-out-of-it-tp202493p211269.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] JMS/Pipeline how to get the result out of it?
Hi! I'm implementing a architecture where Drools is behind a Oracle Message Queue. I have already done a OracleJmsMessenger because I use it without a Appserver (JNDI/Context) and I'd like to use the Oracle XMLType as message payload. (Dosn't work with vanilla JMS) My pipeline consists of: PipelineFactory.newStatefulKnowledgeSessionPipeline(ksession); Action unwrapObjectStage = new OracleJmsUnwrapAdtObject(); PipelineFactory.newJaxbFromXmlTransformer(unmarshaller); PipelineFactory.newStatefulKnowledgeSessionInsert(); Action resultHandlerStage = PipelineFactory.newExecuteResultHandler(); Service messenger = new OracleJmsMessenger(pipeline, ds, factory); messenger.start(); new Thread(new Runnable() { public void run() { ksession.fireUntilHalt(); messenger.stop(); System.out.println(" READY"); }}).start(); I can send messages throu the queue and the they go into the KB and they are processed. But: how can I get the result out of the KB? The ExecuteResultHandler gets executed immediately after the message in the KB and it gets a Map with the current Objects from my Workspace. The KB is still fireing rules... How can I retrive the result of the processing and where from do I know which result is from which input message? Everything runs within one seeesion... Thanks Jürgen -- View this message in context: http://n3.nabble.com/JMS-Pipeline-how-to-get-the-result-out-of-it-tp202493p202493.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ConsequenceException when retract from entry point
solved: rule "test 3" when $t : My_Type() from entry-point "NM" then retract($t) // <-- now without referencing the entry-point end -- View this message in context: http://n3.nabble.com/ConsequenceException-when-retract-from-entry-point-tp136290p139191.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Rule Templates with empty cells
Hi! If I write rules in a decision table I can leave cells empty if I don't need to use all of the conditions in a row. How can I do this with the ExternalSpreadsheetCompiler? I would need something like: rule "ru...@{row.rownumber}" when $s : MyType1() @ifDefined{field1} $e : MyType2(val1 == "@{field1}") from $s.SUB; @ifDefined{field2} $e : MyType2(val2 == "@{field2}") from $s.SUB; then retract($s); end Thanks Juergen -- View this message in context: http://n3.nabble.com/Rule-Templates-with-empty-cells-tp138571p138571.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ConsequenceException when retract from entry point
PS: drools-5.1.0.SNAPSHOT -- View this message in context: http://n3.nabble.com/ConsequenceException-when-retract-from-entry-point-tp136290p136292.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] ConsequenceException when retract from entry point
Hi! I have rule "test 3" when $t : My_Type() from entry-point "NM" then entryPoints["NM"].retract($t) end I get a: org.drools.runtime.rule.ConsequenceException: rule: test 3 at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:981) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:918) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1130) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:739) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:705) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:200) at com.sample.ProcessTest.main(ProcessTest.java:97) Caused by: [Error: unable to resolve method: org.drools.common.NamedEntryPoint.retract(my.package.My_Type) [arglength=1]] [Near : {... Unknown }] ^ [Line: 1, Column: 0] at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:905) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:315) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:138) at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:133) at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104) at org.mvel2.MVEL.executeExpression(MVEL.java:995) at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:87) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:972) ... 6 more what can I do? Thanks Juergen -- View this message in context: http://n3.nabble.com/ConsequenceException-when-retract-from-entry-point-tp136290p136290.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users