]
Michael Anstis updated JBRULES-2319:
------------------------------------
Fix Version/s: 6.0.0.Beta1
(was: 5.5.0.CR1)
When using from (CE) the objects loaded are not available to RHS if
the objects are events
------------------------------------------------------------------------------------------
Key: JBRULES-2319
URL:
https://issues.jboss.org/browse/JBRULES-2319
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-core
Affects Versions: 5.0.1.FINAL
Environment: Ubuntu, Eclipse
Reporter: Richard Ambridge
Assignee: Edson Tirelli
Labels: from
Fix For: 6.0.0.Beta1
Attachments: TryMe_workspace.tar.bz2
If I create the sample project from Eclipse, and modify DroolsTest to contain:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"),
ResourceType.DRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
KnowledgeBaseConfiguration conf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
conf.setOption( EventProcessingOption.STREAM );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( conf );
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession,
"test");
ArrayList<Message> a=new ArrayList<Message>();
Message a1=new Message(); a1.setId(1); a1.setMessage("mesC:7");
a1.setStatus(Message.HELLO); a.add(a1);
Message a2=new Message(); a2.setId(2);a2.setMessage("mesC:8");
a2.setStatus(Message.HELLO);a.add(a2);
ksession.setGlobal("data", a);
Message message = new Message();
message.setId(3);
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
ksession.insert(message);
Message message2 = new Message();
message2.setId(4);
message2.setMessage("mesC:7");
message2.setStatus(Message.HELLO);
ksession.insert(message2);
ksession.fireAllRules();
logger.close();
and then have a rule:
package com.sample
import com.sample.DroolsTest.Message;
global java.util.ArrayList data;
declare Message
@role( event )
end
rule "Hello World"
when
a : Message(id==4)
m : Message(id!=a.id, message==a.message) from data
then
System.out.println( "a is:"+a+" m is:"+m );
end
The result is:
a is:Message:[4] msg:mesC:7 m is:null
Notice, m is NULL
if you change this to fact based, m will contain the correct value.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: