Can we works on fact of "dynamic Map" instead of POJO?
by 王在祥
I have a requirement of run rules on dynamic map instead of POJO, for
example:
*when
Map(* TransCode == "LOGIN" , userName == "wangzx", password == "123456"
)
*then
doSth1()
when
Map( *TransCode = "SaveOrder" userName == "wangzx" category == "Book")
*then
doSth2()
*
the Fact is not a Java Bean, but a dynamic map<String, Object>, so the
TransCode == "Login" is what we means map("TransCode") == "Login".
By using map insteam of POJO, we can build a rules run on the message
dispatch, since there is a lot of Message Types, and each message type has
different schema, so using dynamic types is more flexible than POJO.
Can someone tell me how can it be supported in drools? Very thanks.
14 years, 9 months
marshal ActionNodeInstance
by heldeen
Hello List,
I am marshalling using the DefaultMarshaller in drools and get the following
error:
java.lang.IllegalArgumentException: Unknown node instance type:
org.drools.workflow.instance.node.ActionNodeInstance@d20c43
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.marshalling.impl.AbstractProcessInstanceMarshaller.writeProcessInstance(AbstractProcessInstanceMarshaller.java:52)
at
org.drools.marshalling.impl.OutputMarshaller.writeProcessInstances(OutputMarshaller.java:750)
at
org.drools.marshalling.impl.OutputMarshaller.writeSession(OutputMarshaller.java:97)
at
org.drools.marshalling.impl.DefaultMarshaller.marshall(DefaultMarshaller.java:117)
The action node has some very basic java code that I have verified works
outside of the node. Is there a trick to get around this error or do I need
to report a bug?
-Heath
--
View this message in context: http://n3.nabble.com/marshal-ActionNodeInstance-tp467573p467573.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 9 months
WorkItemHandler in Guvnor and GWT Console
by nanic23
I've deployed a ruleflow that uses a WorkItemHandler.
How can I make guvnor and gwt console aware of my WorkItemHandler? How can I
map my handler to a particular flow and work item?
I read that you can specify something like:
drools.workItemHandlers = MyWorkItemHandlers.conf
in the drools.session.conf file.
I don’t seem to find this file… the closest I find is
drools.defaul.rulebase.conf but specifying it in this file doesn’t seem to
work.
1. Do you know where can I declare drools.workItemHandlers =
MyWorkItemHandlers.conf?
2. How do I map the handler name to the handler class in
MyWorkItemHandlers.conf?
Is it “work item handler name” = “work item handler class” (e.g.
approvalWorkItemHandler = com.mydrools.ApprovalWorkItemHandler)?
I have deployed a .jar file containing my WorkItemHandler to guvnor and gwt
console lib folder and specified the above configuration in
drools.default.rulebase.conf but gwt console keeps saying that it didn’t
find a work item handler for the process.
Any help is appreciated! Anyone that has successfully deployed a process
using a WorkItemHandler to guvnor and run it on gwt console could you please
let me know how you've done it?
--
View this message in context: http://n3.nabble.com/WorkItemHandler-in-Guvnor-and-GWT-Console-tp465985p4...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 9 months
DRL logic failing
by Matthew Runo
Hello folks -
I'm having the strangest issue. First off, here's my DRL logic..
rule 'Sample Rule One'
auto-focus true
dialect 'mvel'
salience 900
agenda-group 'Test Rules'
when
order : WrappedOrder();
eval(hasPromotionX(order.getPromotions()));
address : Address() from order.getShippingAddress();
eval(matchAddress(address.getAddress1())) OR
eval(matchAddress(address.getAddress2()));
then
# If we're here, it's got the promotion and address match...
do.something....
drools.halt();
end
The problem is that drools is looking for getAddress1() and getAddress2() on "order" - not "address". And, of course, that fails - a WrappedOrder does not have those methods - an Address() does!
Any ideas?
Thanks for your time!
Matthew Runo
Software Engineer, Zappos.com
mruno(a)zappos.com - 702-943-7833
14 years, 9 months
Pointer to working memory from within rule?
by Scott Burrows
I'm converting from 4.0.7 to 5.0.1 and am getting errors on the previously
working function below, (note this function is in the drl file):
The error is:
"Type mismacth: cannot convert from org.drools.QueryResults to
org.drools.runtime.rule.QueryResults"
I'm told we need to use the following class for queries in 5.0 and going
forward:
import org.drools.runtime.rule.QueryResults;
import org.drools.runtime.rule.QueryResultsRow;
The problem is getting a pointer to working memory from within a rule or
function used to be done via the KnowledgerHelper object but that is not
compatible with the new QueryResults class.
What am I doing wrong?
-------------------------------------------------------------------------------------------------------------------------------
function CardTransaction getCompletedTransaction (String cardnum,
KnowledgeHelper khObj) {
CardTransaction tranObj = null;
String[] queryParams = {cardnum};
QueryResult result = null;
final QueryResults results =
khObj.getWorkingMemory().getQueryResults("GetCompletedTransaction",
queryParams);
for (Iterator<QueryResult> it = results.iterator(); it.hasNext(); ) {
result = it.next();
tranObj = (CardTransaction)result.get("cardtransactionobj");
}
if (tranObj != null)
return tranObj;
else
return null;
}
Scott
14 years, 9 months
Drools server, memory footprint
by Bertrand Grottier
Hello,
I just posted another message related to Drools server.
As I said before, I am in the learning process of Drools.
However, in the future, I will have to deploy a client - Drools server
application.
To fix ideas, there would be around 30 instances of Drools on a physical server. The rules differ between each logical server. Is this realistic ?
The memory footprint is of great concern. Are there different possible architectures influencing it ? How can we tune the JVM & Drools to minimize the memory footprint ?
I would be very interested in experiments from others (number of rules and facts, memory footprint).
Thank you in advance.
Benoît
_________________________________________________________________
Consultez vos emails Orange, Gmail, Yahoo!, Free ... directement depuis HOTMAIL !
http://www.windowslive.fr/hotmail/agregation/
14 years, 9 months
Server deployment
by Bertrand Grottier
Hello,
At the present time, I am in the learning process of Drools.
However, in the future, I will have to deploy a client - Drools server application. After a very quick (I confess) search, I did not found the documentation related to Drools server. Can someone provide me with this documentation and/or examples ?
At the present time, the future possible architecture is very fuzzy for me. Are there general rules ? Can someone give me some feedback on its own experiments ?
Thank you in advance.
Benoît
_________________________________________________________________
Consultez gratuitement vos emails Orange, Gmail, Free, ... directement dans HOTMAIL !
http://www.windowslive.fr/hotmail/agregation/
14 years, 9 months
[Flow 5.0] named query not found: ProcessInstancesWaitingForEvent
by Nol de Wit
[Drools Flow 5.0, mySql, running a flow from within Eclipse]
Hi All,
Trying to set up Persistence I moved back from 5.1.M1 to 5.0, hoping
for an easier ride. I've got a bit further, but still have errors
while running my flow.
Without Persistence my model executes fine. I've added persistence
much like the way it is explained in chapter 5 of the introduction.
My flow still executes, and in the sessioninfo table get's a record
after the execution. However, at the end of the execution there is an
exception, saying a named query is not found
(ProcessInstancesWaitingForEvent), see below. Since these mostly
reside in mapped classes, I realised that one table in de DB doesn't
have a mapping class in the persisence.xml definition. That table is
'processinstanceinfo_eventtypes'. Could that be the cause of this? If
not, what could be?
Below the stack, and part of my persistence.xml.
26-mrt-2010 9:40:54 bitronix.tm.journal.DiskJournal open
WARNING: active log file is unclean, previous server crash ?
26-mrt-2010 9:40:54 bitronix.tm.recovery.Recoverer run
INFO: recovery committed 0 dangling transaction(s) and rolled back 0
aborted transaction(s) on 1 resource(s) [jdbc/processInstanceDS]
Hibernate: insert into SessionInfo (dirty, lastModificationDate,
rulesByteArray, startDate) values (?, ?, ?, ?)
Fri Mar 26 09:40:59 CET 2010 DEBUG: Executing XA statement: XA START
0x3137322e31362e3230342e32320000012799a1a43700000000,0x3137322e31362e3230342e32320000012799a1a47600000002,0x42746e78
Fri Mar 26 09:40:59 CET 2010 DEBUG: Executing XA statement: XA END
0x3137322e31362e3230342e32320000012799a1a43700000000,0x3137322e31362e3230342e32320000012799a1a47600000002,0x42746e78
Fri Mar 26 09:40:59 CET 2010 DEBUG: Executing XA statement: XA COMMIT
0x3137322e31362e3230342e32320000012799a1a43700000000,0x3137322e31362e3230342e32320000012799a1a47600000002,0x42746e78
ONE PHASE
Hibernate: insert into ProcessInstanceInfo (lastModificationDate,
lastReadDate, processId, processInstanceByteArray, startDate, state,
OPTLOCK) values (?, ?, ?, ?, ?, ?, ?)
Fri Mar 26 09:40:59 CET 2010 DEBUG: Executing XA statement: XA START
0x3137322e31362e3230342e32320000012799a1a4e300000007,0x3137322e31362e3230342e32320000012799a1a51200000009,0x42746e78
bepaal scenario voor regel:
Hibernate: insert into ProcessInstanceInfo (lastModificationDate,
lastReadDate, processId, processInstanceByteArray, startDate, state,
OPTLOCK) values (?, ?, ?, ?, ?, ?, ?)
stuurdata ophalen voor rapportage BWB
bepaal scenario voor regel:
execute scenario 99 voor regel: BBI1
bepaal scenario voor regel:
execute scenario 99 voor regel: BBI2
bepaal scenario voor regel:
execute scenario 99 voor regel: BBI3
bepaal scenario voor regel:
execute scenario 99 voor regel: BBI4
java.lang.IllegalArgumentException: Named query not found:
ProcessInstancesWaitingForEvent
at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108)
at org.drools.persistence.processinstance.JPASignalManager.getProcessInstancesForEvent(JPASignalManager.java:50)
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:111)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:128)
<?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="nl.dnb.avb.drools.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>
<properties>
<!-- property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect"/ -->
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
14 years, 9 months