[jboss-user] [jBPM] - Drools Simple rule evaluation
ous2k
do-not-reply at jboss.com
Tue Mar 27 15:11:56 EDT 2012
ous2k [https://community.jboss.org/people/ous2k] created the discussion
"Drools Simple rule evaluation"
To view the discussion, visit: https://community.jboss.org/message/726708#726708
--------------------------------------------------------------
Hi,
i'am trying to run this simple example using my own rules it seems that things all right but i get not thing in the console view, why he is not evaluating correctly the rule
*JAVA CODE*
|
|
|
| KnowledgeBase eventKbase = readEventKnowledgeBase(); //read.dlr |
|
|
|
| StatefulKnowledgeSession eventKsession = eventKbase.newStatefulKnowledgeSession(); |
|
|
|
|
|
|
|
|
| KnowledgeBase kbase = readKnowledgeBase();//read BPMN |
|
|
|
| StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); |
|
|
|
|
|
|
|
|
| Properties properties = new Properties(); |
|
|
|
| properties.put("drools.processInstanceManagerFactory",DefaultProcessInstanceManagerFactory.class.getName()); |
|
|
|
| properties.put("drools.processSignalManagerFactory" ,DefaultSignalManagerFactory.class.getName()); |
|
|
|
| KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties); |
|
|
|
|
|
|
|
|
| ksession = kbase.newStatefulKnowledgeSession(config, null); |
|
|
|
| ksession.addEventListener(new CustomProcessEventListener(eventKsession)); |
|
|
|
| KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test"); |
|
|
|
|
|
|
|
|
| //insering Ticket |
|
|
|
| Ticket ticket = new Ticket(); |
|
|
|
| *ticket.setStatus("open");* |
|
|
|
| ticket.setContent("testing content"); |
|
|
|
| ticket.setOpeningDate(new Date()); |
|
|
|
| ticket.setIdTicket(1); |
|
|
|
|
|
|
|
|
| *ksession.insert(ticket);* |
|
|
|
| *ksession.fireAllRules();* |
*DROOLS CODE*
import java.util.Date
import java.util.List
#declare any global variables here
#declare Ticket
# @role(event)
#end
declare Server
idTicket : int
status : int
openingDate : Date // percentage
content: Date
end
dialect "mvel"
rule "Check 5mn condition"
when
$ticket:Ticket(status=="open");
then
System.out.println("New Ticket is opened");
end
Best Regards
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/726708#726708]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120327/ab8823ab/attachment.html
More information about the jboss-user
mailing list