Facts are kept in the working memory instead of triggering rules
by todoanv
Hi!
I have a problem using Drools with a distributed application. Every node of
my application runs its own drools instance and the instances communicate
using pipelines. If I put a new fact into Drools it triggers the correct
rules locally and propagates the facts to all other nodes in order to
trigger the same rules there. In most cases the rules are triggered
correctly on the remote nodes. In some cases the facts are put into the
working memory but they don't fire the corresponding rules and are kept in
the working memory.
Can anyone tell me why this problem occurs and what I can do to solve it?
Thanks in advance
P.S: I'm sorry if this issue was already discussed but I didn't find an
existing thread.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Facts-are-kept-in-the...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 5 months
Re: [rules-users] deleting records using rules
by Fnu Mahalakshmi
Hi,
Thanks. Sorry for not being clear.
I have the following:
A = new A(); A1 = new A()
B b1 = new B(A)
B b2 = new B(A)
B b3 = new B(A1)
Each of the B above have a parameter "name"
I am setting the name in one of my rules which works properly.
I want to create an output list which:
Checks that all B objects pointing to a single A object (eg. A1 or A in this case) have same name. If they don't I don't want to have them on my output list.
I tried using forAll for the rule but that checks forALL B's in genral having same A object which is not what I want.
Could you give me a starter / hint to create the rule.
I even thought that I could maybe populate a list for each A object:
When $a : A()
b : B(a : $a , name == "x")
Then
Modify($a){
setAList(b) // adding all b's to a list contained in a
};
But that does not help me achieve the second part as I cant traverse through a list inside rules.
Any idea??
Please help.
Thanks
M
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of rules-users-request(a)lists.jboss.org
Sent: Wednesday, June 16, 2010 2:22 AM
To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 43, Issue 84
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. Re: Flow persistence (Rob Collins)
2. Re: deleting records using rules (Wolfgang Laun)
----------------------------------------------------------------------
Message: 1
Date: Tue, 15 Jun 2010 18:55:03 -0700
From: Rob Collins <RCollins(a)patientsafesolutions.com>
Subject: Re: [rules-users] Flow persistence
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID:
<0019F265-AA56-4104-B657-083C37AAE636(a)patientsafesolutions.com>
Content-Type: text/plain; charset="us-ascii"
You were right the first time - I am sharing the environment between multiple sessions. That is easy for me to fix.
Can I share the EntityManagerFactory, or should I create one for each session?
Thanks,
Rob
On Jun 15, 2010, at 9:47 PM, Mauricio Salatino wrote:
oh.. sorry.. you are creating a new env per each session.. but the problem is related with that..
I will review that and let you know.
On Tue, Jun 15, 2010 at 9:45 PM, Mauricio Salatino <salaboy(a)gmail.com<mailto:salaboy@gmail.com>> wrote:
yes the problem is the environment.. I saw that problem in the past..
you need to create a separate environment object per each session.
On Tue, Jun 15, 2010 at 9:41 PM, Rob Collins <RCollins(a)patientsafesolutions.com<mailto:RCollins@patientsafesolutions.com>> wrote:
The idea of the tests is to ensure that our implementation is thread-safe. Each thread in the test creates its own Drools session and executes its own workflow (which contains actions and work items that involve user interaction that is simulated by the unit test).
This scenario tests the real-world case of our server handling sessions from multiple users. There should NOT be cross-talk between these sessions. Without persistence, everything works as expected. With persistence enabled, two sessions running in parallel are enough to fail 100% of the time.
Each thread creates a session like this:
session = JPAKnowledgeService.newStatefulKnowledgeSession(getKnowledgeBase(), null, getEnvironment());
The calls to getEnvironment() return the same value each time it is called called. Is this right?
The environment is created like this:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
environment = KnowledgeBaseFactory.newEnvironment();
environment.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
Any idea where I messed up?
Thanks,
Rob
On Jun 15, 2010, at 5:58 PM, Mauricio Salatino wrote:
What kind of thread safe tests are you doing?
if multiple threads modify the status of the process, only one of them will commit the new status, and the other ones will rollback the transaction because of a bad state.
Is that what you are looking for?
On Tue, Jun 15, 2010 at 3:33 PM, Rob Collins <RCollins(a)patientsafesolutions.com<mailto:RCollins@patientsafesolutions.com><mailto:RCollins@patientsafesolutions.com<mailto:RCollins@patientsafesolutions.com>>> wrote:
We are using version 5.1.0.M1. We have long-running processes (flows). They are long-running because we have work item nodes that involve the user of our application to do something. We are in the development cycle of our product and everything is going well. I am trying to configure persistence and running into some issues.
I am to the point where our basic unit tests appear to be running fine with persistence enabled both in the container (tomcat6) and in our unit testing environment (ServletUnit).
We have unit tests that run the same test in multiple threads in parallel (the idea is to try to expose thread safety issues), and these tests always fail. At the end of this message, I have pasted a few of the different stack traces I have seen.
I expect that I have done something silly in the configuration, and I could use some help in finding it. I am not sure if the problem is my configuration of JPA, Hibernate, the DataSource, or if it is an interaction between what Drools is expecting and the details of my configuration.
Thanks,
Rob Collins
>From my spring configuration:
<!-- Spring JtaTransactionManager -->
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"
depends-on="bitronixTransactionManager">
<property name="transactionManager" ref="bitronixTransactionManager" />
<property name="userTransaction" ref="bitronixTransactionManager" />
</bean>
<!-- Bitronix Transaction Manager embedded configuration -->
<bean id="btmConfig" class="bitronix.tm.TransactionManagerServices" factory-method="getConfiguration">
<property name="serverId" value="spring-btm" />
</bean>
<!-- create Bitronix Transaction Manager transaction manager -->
<bean id="bitronixTransactionManager" class="bitronix.tm.TransactionManagerServices"
factory-method="getTransactionManager" depends-on="btmConfig"
destroy-method="shutdown" />
<bean id="sessionDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">
<property name="className" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" />
<property name="uniqueName" value="jdbc/processInstanceDS" />
<property name="maxPoolSize" value="8" />
<property name="allowLocalTransactions" value="true" />
<property name="driverProperties">
<props>
<prop key="URL">${db.session.connection.url}</prop>
<prop key="user">${db.session.username}</prop>
<prop key="password">${db.session.password}</prop>
</props>
</property>
</bean>
My persistence.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.drools.persistence.jpa">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/processInstanceDS</jta-data-source>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
<properties>
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup" />
<property name="hibernate.jndi.class" value="bitronix.tm.jndi.BitronixInitialContextFactory" />
</properties>
</persistence-unit>
</persistence>
java.lang.NullPointerException
at org.drools.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:33)
at org.drools.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:37)
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1706)
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1682)
at org.drools.workflow.instance.node.SubProcessNodeInstance.internalTrigger(SubProcessNodeInstance.java:115)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
at org.drools.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152)
at org.drools.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:52)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at org.drools.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:74)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
at org.drools.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)
at org.drools.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:16)
at org.drools.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:185)
at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:230)
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1689)
at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:289)
at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:52)
at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:14)
at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:163)
at com.patientsafesolutions.application.controllers.DroolsWorkflowController.startWorkflowProcess(DroolsWorkflowController.java:310)
at com.patientsafesolutions.application.controllers.DroolsWorkflowController.drools(DroolsWorkflowController.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.meterware.servletunit.InvocationContextImpl.service(InvocationContextImpl.java:76)
at com.meterware.servletunit.ServletUnitClient.newResponse(ServletUnitClient.java:126)
at com.meterware.httpunit.WebClient.createResponse(WebClient.java:667)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:220)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:181)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:122)
at com.patientsafesolutions.test.http.Request.submit(Request.java:115)
at com.patientsafesolutions.test.http.Request.post(Request.java:20)
at com.patientsafesolutions.api.httptest.LogicalViewHttpTest.navigateToHome(LogicalViewHttpTest.java:57)
at com.patientsafesolutions.api.httptest.LogicalViewHttpTest.navigateToPatient(LogicalViewHttpTest.java:100)
at com.patientsafesolutions.api.httptest.HomeTests.homeLogicalView(HomeTests.java:14)
at com.patientsafesolutions.api.httptest.HomeTests$1.run(HomeTests.java:23)
at com.patientsafesolutions.test.http.HttpTest$ThreadWithThrowable$1.run(HttpTest.java:241)
at java.lang.Thread.run(Thread.java:637)
org.hibernate.exception.GenericJDBCException: Cannot release connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:455)
at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:406)
at org.hibernate.jdbc.ConnectionManager.afterTransaction(ConnectionManager.java:298)
at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:225)
at org.hibernate.transaction.CacheSynchronization.afterCompletion(CacheSynchronization.java:85)
at bitronix.tm.BitronixTransaction.fireAfterCompletionEvent(BitronixTransaction.java:416)
at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:195)
at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:95)
at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:258)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:163)
at com.patientsafesolutions.application.controllers.DroolsWorkflowController.startWorkflowProcess(DroolsWorkflowController.java:310)
at com.patientsafesolutions.application.controllers.DroolsWorkflowController.drools(DroolsWorkflowController.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.meterware.servletunit.InvocationContextImpl.service(InvocationContextImpl.java:76)
at com.meterware.servletunit.ServletUnitClient.newResponse(ServletUnitClient.java:126)
at com.meterware.httpunit.WebClient.createResponse(WebClient.java:667)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:220)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:181)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:122)
at com.patientsafesolutions.test.http.Request.submit(Request.java:115)
at com.patientsafesolutions.test.http.Request.post(Request.java:20)
at com.patientsafesolutions.api.httptest.LogicalViewHttpTest.navigateToHome(LogicalViewHttpTest.java:57)
at com.patientsafesolutions.api.httptest.LogicalViewHttpTest.navigateToPatient(LogicalViewHttpTest.java:100)
at com.patientsafesolutions.api.httptest.HomeTests.homeLogicalView(HomeTests.java:14)
at com.patientsafesolutions.api.httptest.HomeTests$1.run(HomeTests.java:23)
at com.patientsafesolutions.test.http.HttpTest$ThreadWithThrowable$1.run(HttpTest.java:241)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.sql.SQLException: error requeueing a JdbcPooledConnection from datasource jdbc/processInstanceDS in state ACCESSIBLE wrapping com.mysql.jdbc.jdbc2.optional.MysqlXAConnection@4128dca6
at bitronix.tm.resource.jdbc.JdbcPooledConnection.release(JdbcPooledConnection.java:148)
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.close(JdbcConnectionHandle.java:77)
at org.hibernate.connection.DatasourceConnectionProvider.closeConnection(DatasourceConnectionProvider.java:74)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:451)
... 40 more
Caused by: bitronix.tm.internal.BitronixSystemException: cannot close a resource when its XAResource is taking part in an unfinished global transaction
at bitronix.tm.resource.common.TransactionContextHelper.requeue(TransactionContextHelper.java:117)
at bitronix.tm.resource.jdbc.JdbcPooledConnection.release(JdbcPooledConnection.java:146)
... 43 more
java.lang.IllegalArgumentException: Unknown node instance type: org.drools.workflow.instance.node.ActionNodeInstance@2b7194a4
at org.drools.marshalling.impl.AbstractProcessInstanceMarshaller.writeNodeInstanceContent(AbstractProcessInstanceMarshaller.java:243)
at org.drools.marshalling.impl.AbstractProcessInstanceMarshaller.writeNodeInstance(AbstractProcessInstanceMarshaller.java:117)
at org.drools.marshalling.impl.AbstractProcessInstanceMarshaller.writeProcessInstance(AbstractProcessInstanceMarshaller.java:106)
at org.drools.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:237)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.ejb.event.BeanCallback.invoke(BeanCallback.java:23)
at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:80)
at org.hibernate.ejb.event.EntityCallbackHandler.preUpdate(EntityCallbackHandler.java:65)
at org.hibernate.ejb.event.EJB3FlushEntityEventListener.invokeInterceptor(EJB3FlushEntityEventListener.java:41)
at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:308)
at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:248)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:128)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67)
at org.drools.persistence.processinstance.JPASignalManager.getProcessInstancesForEvent(JPASignalManager.java:53)
at org.drools.persistence.processinstance.JPASignalManager.signalEvent(JPASignalManager.java:29)
at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:191)
at org.drools.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:56)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at org.drools.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:74)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
at org.drools.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:62)
at org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:58)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at org.drools.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:74)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
at org.drools.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:37)
at org.drools.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:101)
at org.drools.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:82)
at org.drools.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:192)
at org.drools.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:246)
at org.drools.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:222)
at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:258)
at org.drools.persistence.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:96)
at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:46)
at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:12)
at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:118)
at com.patientsafesolutions.application.controllers.DroolsWorkflowController.drools(DroolsWorkflowController.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.meterware.servletunit.InvocationContextImpl.service(InvocationContextImpl.java:76)
at com.meterware.servletunit.ServletUnitClient.newResponse(ServletUnitClient.java:126)
at com.meterware.httpunit.WebClient.createResponse(WebClient.java:667)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:220)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:181)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:122)
at com.patientsafesolutions.test.http.Request.submit(Request.java:115)
at com.patientsafesolutions.test.http.Request.post(Request.java:25)
at com.patientsafesolutions.api.httptest.LogicalViewHttpTest.loginUser(LogicalViewHttpTest.java:80)
at com.patientsafesolutions.api.httptest.LogicalViewHttpTest.navigateToPatient(LogicalViewHttpTest.java:102)
at com.patientsafesolutions.api.httptest.HomeTests.homeLogicalView(HomeTests.java:14)
at com.patientsafesolutions.api.httptest.HomeTests$1.run(HomeTests.java:23)
at com.patientsafesolutions.test.http.HttpTest$ThreadWithThrowable$1.run(HttpTest.java:241)
at java.lang.Thread.run(Thread.java:637)
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org<mailto:rules-users@lists.jboss.org><mailto:rules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>>
https://lists.jboss.org/mailman/listinfo/rules-users
--
- CTO @ http://www.plugtree.com<http://www.plugtree.com/><http://www.plugtree.com/>
- MyJourney @ http://salaboy.wordpress.com<http://salaboy.wordpress.com/><http://salaboy.wordpress.com/>
- Co-Founder @ http://www.jbug.com.ar<http://www.jbug.com.ar/><http://www.jbug.com.ar/>
- Salatino "Salaboy" Mauricio -
<ATT00001..txt>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org<mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users
--
- CTO @ http://www.plugtree.com<http://www.plugtree.com/>
- MyJourney @ http://salaboy.wordpress.com<http://salaboy.wordpress.com/>
- Co-Founder @ http://www.jbug.com.ar<http://www.jbug.com.ar/>
- Salatino "Salaboy" Mauricio -
--
- CTO @ http://www.plugtree.com<http://www.plugtree.com/>
- MyJourney @ http://salaboy.wordpress.com<http://salaboy.wordpress.com/>
- Co-Founder @ http://www.jbug.com.ar<http://www.jbug.com.ar/>
- Salatino "Salaboy" Mauricio -
<ATT00001..txt>
------------------------------
Message: 2
Date: Wed, 16 Jun 2010 08:22:10 +0200
From: Wolfgang Laun <wolfgang.laun(a)gmail.com>
Subject: Re: [rules-users] deleting records using rules
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID:
<AANLkTimVxCgrbKHDCck1x1cVi_JTgIcTzhWV4BmApEfb(a)mail.gmail.com>
Content-Type: text/plain; charset=windows-1252
If you can do it in Java, you can do it in a rule.
Asking questions in this very general way will only (if at all) give
you very general answers.
-W
2010/6/15 Fnu Mahalakshmi <FMahalakshmi(a)nyx.com>:
> Hi,
>
> How can I delete records using rules??
>
> I want to fire my rules on a dataset ? modify the dataset and delete data
> not concerned to me after the modification.
>
> can I do this with my rules directly?
>
>
>
> Thanks
>
> M
>
> ________________________________
>
> Please consider the environment before printing this email.
>
> Visit our website at http://www.nyse.com
> *****************************************************************************
> Note: The information contained in this message and any attachment to it is
> privileged, confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient, you are
> hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify the sender immediately by replying to
> the message, and please delete it from your system. Thank you. NYSE
> Euronext.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
End of rules-users Digest, Vol 43, Issue 84
*******************************************
Please consider the environment before printing this email.
Visit our website at http://www.nyse.com
****************************************************
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
14 years, 5 months
rule error
by Fnu Mahalakshmi
Hi,
I want to just depict '&&' and 'or' in my rules and did as follows:
rule "Update value"
no-loop true
when
$y :Y(name != "")
$x: X(status != "")
$z : Z( y == $y, x == $X,(status == "yes" or status == "no"))
then
modify($z){};
end
The above does not work. Is it not valid to write as above??
How else can I depict "or" ? relation?
rule "Update value"
no-loop true
when
$y :Y(name != "")
$x: X(status != "")
$z : Z( y == $y, x == $X,(status == "yes" , status == "no"))
then
modify($z){
setOutput($z)};
end
even this does not work.
I also want to add all the values specific to this condition and just print them out in my output file.
So I tried adding it to a list (which is done by setOutput().
But here I keep getting multiple entries for the same value.
For eg. {a,b,c } //are instances of type z
They keep getting added again and again. Should it not process input only once????
Please help.
Thank you
m
</pre>
<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>
*****************************************************************************
<br>
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
</STRONG></P><pre>
14 years, 5 months
Re: [rules-users] Dynamic Rule Loading
by Fnu Mahalakshmi
Hi,
I was trying to use knowledge builder package for dynamic loading of the rule files. Getting major errors.
My knowledge builder basically adds the rule resources from the change-set.xml file which I have in my project directory.
I am using the knowledge agent and knowledge base to add all the packages loaded from my change-set xml file.
Am I wrong somewhere???
My code is as follows:
private KnowledgeBase loadRules(String[] rules) throws Exception{
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newClassPathResource( "/change-set.xml", getClass() ),
ResourceType.CHANGE_SET );
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
kagent.applyChangeSet( ResourceFactory.newClassPathResource("/change-set.xml", getClass()));
KnowledgeBase kbase = kagent.getKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
my change-set.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='drools-change-set-5.0.xsd' >
<add>
<resource source='src/main/rules/' type='DRL' />
</add>
</change-set>
I am getting the following error stack when I run:
Exception in thread "main" org.drools.ProviderInitializationException: Provider org.drools.builder.impl.KnowledgeBuilderProviderImpl could not be set.
at org.drools.builder.KnowledgeBuilderFactory.loadProvider(KnowledgeBuilderFactory.java:111)
at org.drools.builder.KnowledgeBuilderFactory.getKnowledgeBuilderProvider(KnowledgeBuilderFactory.java:101)
at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:29)
at com.org.RuleRunner.loadRules(RuleRunner.java:58)
at com.org.RuleRunner.runStatelessRules(RuleRunner.java:127)
at com.org.RulesTest.main(RulesTest.java:40)
Caused by: java.lang.ClassNotFoundException: org.drools.builder.impl.KnowledgeBuilderProviderImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.drools.builder.KnowledgeBuilderFactory.loadProvider(KnowledgeBuilderFactory.java:108)
... 5 more
The error comes exactly at the start where I call knowledge builder.
Please help!!
Thanks
M
Please consider the environment before printing this email.
Visit our website at http://www.nyse.com
****************************************************
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
14 years, 5 months
Weird error with rule files
by Fnu Mahalakshmi
Hi,
When I run my project - I have brl and drl rule files.
When I run it for the first time: I am converting brl to drl files.
I get this error
Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.<init>(Unknown Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at com.org.RuleRunner.loadRuleFile(RuleRunner.java:87)
at com.org.RuleRunner.loadRules(RuleRunner.java:44)
at com.org.RuleRunner.runStatelessRules(RuleRunner.java:108)
at com.org.RulesTest.main(RulesTest.java:40)
But after I run it for the first time and the rule.drl (converted file from brl to drl) exists in my directory - I run it again and then the program runs fine.
So number of .brl files that many number of exceptions(same as above) and then program runs.
Why is this happening?? Should it not create the file and load it into the rulebase?
My code for converting from brl to drl is :
try{
BRXMLPersistence read = (BRXMLPersistence) BRXMLPersistence.getInstance();
BRDRLPersistence write = (BRDRLPersistence) BRDRLPersistence.getInstance();
brl = FileUtils.readFileToString(file);
System.out.println("File content: " + brl);
outputDRL = write.marshal(read.unmarshal(brl));
String drlFilePath = "src/main/rules"+rulesFiles +".drl";
System.out.println("drlFilePath "+drlFilePath +"rulesFiles "+rulesFiles);
String path = rulesFiles+".drl";
System.out.println("path "+path);
System.out.println("drlfile "+drlFilePath);
drlFile = new File(drlFilePath);
FileUtils.writeStringToFile(drlFile, outputDRL);
Reader source = new InputStreamReader( RuleRunner.class.getResourceAsStream(path) ); // error is here
addRulesToThisPackage.addPackageFromDrl(source);
}catch (IOException e) {
e.printStackTrace();
}
}
Any idea why this problem?? Is there some error in my code above????
Please help.
Thank you
M
</pre>
<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>
*****************************************************************************
<br>
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
</STRONG></P><pre>
14 years, 5 months
Re: [rules-users] Dynamic rule file uploading
by Fnu Mahalakshmi
Hi Payet,
Thanks for the solution.
I just had one more question:
Whats the main benefit of doing it in this manner??
Because I would be basically creating my change-set.xml file by pulling in data from my directory containing my rule files which would then be added to my knowledgebuilder.
The other option was to list all the existing files and add them to the packagebuilder.
Both seem to in the end do the same thing as per my understanding.
What is the plus point of the first approach?? Is it not just longer??
Thanks
M
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of rules-users-request(a)lists.jboss.org
Sent: Tuesday, June 15, 2010 12:33 PM
To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 43, Issue 76
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. Re: Dynamic rule file uploading (PAYET, Manuel)
2. Re: Uploading rules dynamically (Fnu Mahalakshmi)
----------------------------------------------------------------------
Message: 1
Date: Tue, 15 Jun 2010 18:02:06 +0200
From: "PAYET, Manuel" <manuel.payet(a)capgemini.com>
Subject: Re: [rules-users] Dynamic rule file uploading
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID:
<5104F06B63E3164FAEB2F42B920311654CCCA447(a)CORPMAIL05.corp.capgemini.com>
Content-Type: text/plain; charset="iso-8859-1"
So, why wouldn't you dinamically construct you change-set.xml file?
You have lots of solutions to generate xml files in Java
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] De la part de Fnu Mahalakshmi
Envoy? : mardi 15 juin 2010 17:59
? : 'rules-users(a)lists.jboss.org'
Objet : Re: [rules-users] Dynamic rule file uploading
Hi,
Thanks for the quick reply.
But even by using knowledge agent I have to keep specifying each of the files one by one right? Which ever is contained in my folder with all the rule files? As I would keep doing:
kbuilder.add( ResourceFactory.newUrlResource( "file://myrules.drl" ),
ResourceType.DRL);
So again I would have to list all my files and pass it to the knowledge agent which would add the new rule to the existing package( created using package builder).
Am I going wrong here??
Please help.
Thank you.
M
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of rules-users-request(a)lists.jboss.org
Sent: Tuesday, June 15, 2010 11:13 AM
To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 43, Issue 74
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. Uploading rules dynamically (Fnu Mahalakshmi)
2. Dynamic rule file uploading (Fnu Mahalakshmi)
3. Re: Dynamic rule file uploading (PAYET, Manuel)
----------------------------------------------------------------------
Message: 1
Date: Tue, 15 Jun 2010 10:56:42 -0400
From: Fnu Mahalakshmi <FMahalakshmi(a)nyx.com>
Subject: [rules-users] Uploading rules dynamically
To: "'rules-users(a)lists.jboss.org'" <rules-users(a)lists.jboss.org>
Message-ID:
<994758E35590274E955FA75763C5AA5002D0111F(a)MTEXMBXP01.ad.NYX.com>
Content-Type: text/plain; charset="us-ascii"
Hi Guys,
How can I dynamically upload my rules? Can someone point me towards some documentation for the same??
Thank you.
M
</pre>
<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P> <P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>
*****************************************************************************
<br>
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
</STRONG></P><pre>
14 years, 5 months
deleting records using rules
by Fnu Mahalakshmi
Hi,
How can I delete records using rules??
I want to fire my rules on a dataset - modify the dataset and delete data not concerned to me after the modification.
can I do this with my rules directly?
Thanks
M
</pre>
<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>
*****************************************************************************
<br>
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
</STRONG></P><pre>
14 years, 5 months
creating specific dataset with help of rules
by Fnu Mahalakshmi
Hi,
Is it possible to trigger out only a specific dataset with help of my rules?
I want only a list of data as my output which has A=10 for example.
Is it possible? How can I do that??
Thank you
M
</pre>
<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>
*****************************************************************************
<br>
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
</STRONG></P><pre>
14 years, 5 months
Re: [rules-users] Uploading rules dynamically
by Fnu Mahalakshmi
Hi,
I was just going through how to work with knowledge builder and have some doubts:
Code sample is as follows:
final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
// this will parse and compile in one step
kbuilder.add(ResourceFactory.newClassPathResource("HelloWorld.drl",
HelloWorldExample.class), ResourceType.DRL);
// Check the builder for errors
if (kbuilder.hasErrors()) {
System.out.println(kbuilder.getErrors().toString());
throw new RuntimeException("Unable to compile \"HelloWorld.drl\".");
}
// get the compiled packages (which are serializable)
final Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages();
// add the packages to a knowledgebase (deploy the knowledge packages).
final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(pkgs);
final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
In the above code: I am manually having to add the .drl file and the classpath to my kbuilder. So don't I just have to end up listing all the files and adding it to my knowledge builder?
Is it that each of the files keeps getting added as and when you update the rule files?
How does the program detect this update?? As I am ending up having to add everything.
Please guide.
Thank you
M
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of rules-users-request(a)lists.jboss.org
Sent: Tuesday, June 15, 2010 12:00 PM
To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 43, Issue 75
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. Re: Uploading rules dynamically (Esteban Aliverti)
2. Re: Dynamic rule file uploading (Fnu Mahalakshmi)
----------------------------------------------------------------------
Message: 1
Date: Tue, 15 Jun 2010 12:12:45 -0300
From: Esteban Aliverti <esteban.aliverti(a)gmail.com>
Subject: Re: [rules-users] Uploading rules dynamically
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID:
<AANLkTilRCzG0E9-W6OsVWXHy_kyQNpDdblxitfmg91YZ(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
You can read about Knowledge Agent:
http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/tr...
Maybe it suits your needs.
2010/6/15 Fnu Mahalakshmi <FMahalakshmi(a)nyx.com>
> Hi Guys,
>
>
>
> How can I dynamically upload my rules? Can someone point me towards some
> documentation for the same??
>
>
>
> Thank you.
>
>
>
> M
>
> ------------------------------
>
> *Please consider the environment before printing this email.*
>
> *Visit our website at http://www.nyse.com
> *****************************************************************************
>
> Note: The information contained in this message and any attachment to it is
> privileged, confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient, you are
> hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify the sender immediately by replying to
> the message, and please delete it from your system. Thank you. NYSE
> Euronext. *
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
14 years, 5 months