Looking for simple drools-camel (non-spring) example
by bjh6392
Since the drools pipeline is deprecated, I'm interested in putting together a
simple example using drools-camel that acts as a pipeline between a JMS
queue and Drools Fusion. The starting point would be no
transformation, just pull pojos out of a queue entrypoint and into a drools
endpoint using camel.
NOTE: We are not using Spring, so am looking for a java code version of how
to do this.
However, in the 5.1 or 5.2 M2 and CR distributions, or anywhere else I've
searched for that matter, I can find very little documentation or code
examples on drools-camel. The one snippet I did find:
http://lucazamador.wordpress.com/2010/07/22/drools-camel-integration/
uses some objects from the org.drools.grid.local library that don't seem to
exist in the 5.2 M2 or CR releases:
LocalConnection connection = new LocalConnection(); <=doesn't exist
ExecutionNode node = connection.getExecutionNode(); <=doesn't exist
node.setId("node");
Context jndiContext = new JndiContext();
jndiContext.bind("node", node);
CamelContext camelContext = new DefaultCamelContext(jndiContext);
Can anyone point me to some code snippets, examples, anywhere would be fine,
test cases, etc.
Literally hitting a brick wall on the web. I see the objects in the
drools-camel library that I know I need to use; DroolsPolicy,
DroolsEndpoint...
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Looking-for-simple-drools-camel-non-spr...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Parent ClassLoader may not be null
by abhay_bc
Hi
I am writing a drools based app. I am getting this error when I create an
instance of KnowledgeBuilder
at line,
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
Here is the error. Can anyone tell what does this error mean ?
java.lang.NullPointerException: Parent ClassLoader may not be null
at java.lang.ClassLoader.<init>(ClassLoader.java:239)
at java.lang.ClassLoader.<init>(ClassLoader.java:226)
at
org.drools.util.CompositeClassLoader.<init>(CompositeClassLoader.java:38)
at
org.drools.util.ClassLoaderUtil.getClassLoader(ClassLoaderUtil.java:27)
at
org.drools.compiler.PackageBuilderConfiguration.setClassLoader(PackageBuilderConfiguration.java:333)
at
org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:165)
at
org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:159)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:210)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:143)
at
Org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryS
at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:47)
at com.ts.DBconnector.readKnowledgeBase(DBconnector.java:125)
--
View this message in context: http://drools.46999.n3.nabble.com/Parent-ClassLoader-may-not-be-null-tp30...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
CEP : events not being expired when they should
by radai.rosenblatt
Hi.
this forum post relates to (at least) 2 drools issues: JBRULES-2881 and
JBRULES-2862.
while trying to verify the fixes (both issues are marked fixed in
5.2.0.CR1), i've created 2 drl files:
the 1st file tests event retention for length windows:
package contrived.example
import contrived.example.Event
import contrived.example.Fact
declare Event
@role(event)
end
rule "match event with fact"
when
Fact($id : id)
Event (factId==$id) over window:length(1) from entry-point "Event
Stream"
then
//do nothing
end
the test code for this looks something like:
session.insert(new Fact(...));
eventStream.insert(new Event(...));
session.fireAllRules();
clock.advance (1 year);
eventStream.insert(new Event(...));
clock.advance(1 year);
session.fireAllRules();
//1st event is still in memory at this point <--- bug?
the 2nd file tests the 2-events-from-window scenario in #2862:
package contrived.example
import contrived.example.Event
import contrived.example.Fact
declare Event
@role(event)
end
rule "match 2 events"
when
$e1 : Event () over window:time(15m) from entry-point "Event Stream"
$e2 : Event (this before $e1) over window:time(15m) from entry-point
"Event Stream"
then
//do nothing
end
the test code is something along the lines of:
session.insert(new Event(...));
clock.advance(1 minute);
session.insert(new Event(...));
session.fireAllRules();
clock.advance(1 day);
session.fireAllRules();
//both events still in memory at this point <-- bug?
i ran these tests using drools 5.2.0.CR1, and they both failed. am i doing
something wrong ? were the issued fixed later than JIRA indicates ?
i'm attaching the maven project i built for these tests (it has a few other
tests as well, not related to this port. the test cases that do relate to
this post are TestLengthWindowRetention and TestTwoInWindow, they both fail)
so other people can run them as well.
http://drools.46999.n3.nabble.com/file/n3028890/drools-cep-retention.zip
drools-cep-retention.zip
--
View this message in context: http://drools.46999.n3.nabble.com/CEP-events-not-being-expired-when-they-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
CEP : explicit @expires() vs window
by radai.rosenblatt
if i have the followng drl code:
package contrived.example
import contrived.example.Event
import contrived.example.Fact
declare Event
@role(event)
@expires(10s)
end
rule "match event with fact"
when
Fact($id : id)
Event (factId==$id) over window:time(15m) from entry-point "Event
Stream"
then
//do nothing
end
how long should an Event live in memory? 10 seconds or 15 minutes?
--
View this message in context: http://drools.46999.n3.nabble.com/CEP-explicit-expires-vs-window-tp302887...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
list operations in "then" part
by Simon Chen
Hi all,
I am always confused about what we can do in the "then" part of the rule.
In particular, I have problem duplicate a list. For example:
when:
$b: Book( "james" memberOf authors )
then:
Test fact = new Test();
fact.getList().addAll( $b.authors );
insert(fact);
end
The error message reads like this:
BuildError: Unable to build expression for 'consequence': [Error:
Failed to compile: 2 compilation error(s):
- (1,7) unqualified type in strict mode for: $b
- (1,12) unqualified type in strict mode for: authors]
What is the right way to do this?
Thanks.
-Simon
13 years, 5 months
Backward chaining
by Nirmal Fernando
Hi,
Is there any documentation available regarding Drools backward chaining?
Thanks.
--
Best Regards,
Nirmal
C.S.Nirmal J. Fernando
Department of Computer Science & Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.
Blog: http://nirmalfdo.blogspot.com/
13 years, 5 months
Declared fact metadata
by pagrus
Hi,
I'm exploring declared fact metadata capabilities, hoping that it will
enable declaring validation constraints.
One thing I cant find in both docs and API is the way to introspect the
metadata of certain declared fact type.
E.g, given the example from Drools Expert docs
declare Person
@author( Bob )
@dateOfCreation( 01-Feb-2009 )
name : String @key @maxLength( 30 )
dateOfBirth : Date
address : Address
end
... is it possible to determine programmatically what metadata is associated
with Person's attributes? Or more specifically - determine that "name" field
has "maxLength(30)" metadata associated?
Thanks,
Pavel
--
View this message in context: http://drools.46999.n3.nabble.com/Declared-fact-metadata-tp3014454p301445...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 6 months
Decision table imported into guvnor fails validation
by Lisa Horton
I have a decision table (xls) that I am able to successfully load into a knowledge base and test in my java code. However, when I import it into guvnor using the Create a File upload for xls type, validation fails with these errors:
[document list decision table] Rule Compilation error The type com.domain.job.AbstractJob is not visible The type org.apache.commons.lang.reflect.MemberUtils is not visible Syntax error on token "enum", Identifier expected The type org.apache.commons.lang.Entities is not visible The type com.abclegal.domain.activity.AbstractActivity is not visible Syntax error on token "enum", Identifier expected Syntax error on token "enum", Identifier expected The type org.apache.commons.lang.IntHashMap is not visible The type org.apache.commons.lang.builder.IDKey is not visible The import org.apache.commons.lang.NumberRange collides with another import statement The import org.apache.commons.lang.math.NumberUtils collides with another import statement
The spreadsheet does include import statement in the rules template section, including an import of com.domain.job.AbstractJob seen above. AbstractJob is in the POJO model.
I am at version 5.1.1
I'd appreciate any suggestions for troubleshooting. Also, is this the recommended way to integrate decision tables with Guvnor rules (i.e. to import into guvnor), or is there a better practice for managing decision tables along with other rule sources?
13 years, 6 months