best design pattern for fusion stream
by slyfox
I have a trading application that currently handles a fair amount of messages
per second, generally in the thousands. Soon it will handle 10s and perhaps
hundreds of thousands of messages.
I have not done any load testing yet but while I am here I figured I should
ask if there are any known limitations that I may run in to?
Presently my trading app handles price quotes by consuming an amqp queue
bound to a topic:
try {
q = quotes.poll(100, TimeUnit.MILLISECONDS);
if (q != null)
handleIncomingQuote(q);
} catch ...
I would like to use fusion so that I can get the code infrastructure done
and then hopefully never have to deal with code again for writing my
strategies, ideally all of that will be in the form of rules.
So I am at a point where I need to learn the camel integration piece so that
fusion will consume the amqp feed.
However, and this is my question, general practice is not to immediately do
any work on incoming message, currently I add to a LinkedBlockingQueue and
then pick up from another thread (shown above). So should I even worry
about the AMQP/Camel integration? It would seem to me that if fusion is
acting on each event this could become an eventual bottleneck. I wonder if
I would be better off manually inserting my incoming quotes into the entry
point in the manner that I have above, essentially by replacing
handleIncomingQuote(q) with EntryPoint.insert(q)?
Or does the working memory handle the buffering for me? Looking at the
Stream and Entry point doc I would say there is a chance but I am not
certain.
Thanks
Bobby
--
View this message in context: http://drools.46999.n3.nabble.com/best-design-pattern-for-fusion-stream-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
rule limit
by Bobby Richards
Is it possible to limit the number of rules in a drl file?
Thanks,
Bobby
13 years, 2 months
The database returned no natively generated identity value
by vanrobstone
Hi,
I am trying to get a webapp ported from oracle to db2. I managed to get all
the sql loaded in but it is now failing with the above error. After a day's
searching (I am not a web-developer by trade so please bear with me) I
managed to do a DB2 Driver trace and possibly narrow down my problem to a
table drools appears to create
SessionInfo
One of the columns is an id field that hibernate appears to be populating
with the following sql
Shortly after I am receiving the following stack trace (apppended to the
foot of this query).
I feel like there ought to be a trigger or something that would actually
populate the id field but hibernate seems to have problems. For all the
tables we have created we have created sequence numbers where appropriate
and are used by annotations in the code
I am not sure how to do the same for this generated table
Cheers for looking.
As promised the stack
--
View this message in context: http://drools.46999.n3.nabble.com/The-database-returned-no-natively-gener...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Get previous fact from working memory.
by tungl
Hello everyone,
I think my problem is quite simple, but still, I can't come up with a
solution.
What I want to do is compare the last fact with the current one and I'm
wondering how
to do that.
That's how I check if the EventType of the current Event is EVENT1. What I
want to do now is check if the EventType of the current Event is EVENT1 and
EventType of the previous Event is EVENT2. How can I do that?
Thanks very much in advance,
Martin
--
View this message in context: http://drools.46999.n3.nabble.com/Get-previous-fact-from-working-memory-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
IllegalStateException happens when ResourceChangeScanner working on Version 5.3.0.CR1
by Oliver Liu
Hi Guys,
I want to upgrade drools from 5.1.1 to 5.3.0 CR1, but i found
ResourceChangeScanner could't work.
In version 5.1.1, i wrote this code to get a KnowledgeAgent
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("ReleaseAgent");
kagent.addEventListener(new ReloadingRuleEventListener(this));
kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeset-url.xml"));
changeset-url.xml content is like:
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...'
>
<add>
<resource
source='http://hostname:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Packa...'
type='PKG' basicAuthentication="enabled" username="user1"
password="123456" />
<resource
source='http://hostname:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Packa...'
type='PKG' basicAuthentication="enabled" username="user1"
password="123456" />
<resource
source='http://hostname:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Packa...'
type='PKG' basicAuthentication="enabled" username="user1"
password="123456" />
</add>
</change-set>
then wrote this code to scan if there is a new version snapshot on guvnor
ResourceChangeScannerConfiguration sconf = ResourceFactory
.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval","60");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
It works very well, each time when ResourceChangeScanner finding there is
new snapshot, it can reload the rules from guvnor properly.
But when i updated to 5.3.0 CR1, ran this code, error happens:
Exception in thread "Thread-2" java.lang.IllegalStateException: reader does
have
a modified date
at
org.drools.io.impl.ReaderResource.getLastModified(ReaderResource.java
:64)
at
org.drools.io.impl.ResourceChangeScannerImpl.scan(ResourceChangeScann
erImpl.java:169)
at
org.drools.io.impl.ResourceChangeScannerImpl$ProcessChangeSet.run(Res
ourceChangeScannerImpl.java:326)
at java.lang.Thread.run(Thread.java:619)
It seems in new version, UrlResource was parsed to ReaderResource(i rememer
in 5.1.1, each resource in changeset-url.xml was parsed to UrlResource).
Can you give a help?
Thanks a lot
--
View this message in context: http://drools.46999.n3.nabble.com/IllegalStateException-happens-when-Reso...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
5.3.0 CR1 has broken existing rules/flows
by Jamie
I recently upgraded from 5.2.0 Final to 5.3.0 CR1 because I was experiencing
memory leaks in 5.2.0 Final due to a known bug that was fixed in 5.3.0 CR1.
I have a suite of FitNesse tests that exercise the majority of my rules and
flows, and I can demonstrate that the memory leak is indeed fixed, but one
of my tests is now failing. If I revert back to 5.2.0 Final, all is well.
I've been trying to determine the root cause for the past 3 days, but I'm
not getting anywhere. I suspect that it's related to an interaction between
2 rules, e.g. one rule modifies something that causes the second rule to
fire, but the second rule chokes in the consequence when it tries to execute
a modify() statement. If I comment out the modify portion, the rule fires
fine.
I wish I could provide an example, but my implementation is too complex for
that and I haven't been able to reproduce it in a stand-alone example.
I know a stack trace probably won't tell you much, but I've included it
below just in case. If anyone has any ideas, I'd love to hear them. If
there's any additional information you think might help diagnose the
problem, I'd be happy to provide it.
Thanks,
Jamie
org.drools.runtime.rule.ConsequenceException: rule: Rule 022 - Load Buyer
Activity
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:708)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:672)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at
com.llbean.fraud.rule.engine.DroolsRulesEngine.invokeRules(DroolsRulesEngine.java:119)
at
com.llbean.fraud.rule.engine.DroolsRulesEngine.invokeRules(DroolsRulesEngine.java:81)
at
com.llbean.fraud.fitnesse.fixtures.tests.TestFraudRules.execute(TestFraudRules.java:116)
at fit.ColumnFixture.executeIfNeeded(ColumnFixture.java:57)
at fit.ColumnFixture.check(ColumnFixture.java:46)
at fit.Binding$QueryBinding.doCell(Binding.java:188)
at fit.ColumnFixture.doCell(ColumnFixture.java:37)
at fit.Fixture.doCells(Fixture.java:171)
at fit.Fixture.doRow(Fixture.java:165)
at fit.ColumnFixture.doRow(ColumnFixture.java:25)
at fit.Fixture.doRows(Fixture.java:159)
at fit.ColumnFixture.doRows(ColumnFixture.java:18)
at fit.Fixture.doTable(Fixture.java:153)
at fit.Fixture.interpretFollowingTables(Fixture.java:119)
at fit.Fixture.interpretTables(Fixture.java:105)
at fit.Fixture.doTables(Fixture.java:79)
at
com.llbean.test.fitnesse.servletrunner.server.LLBFitServer.process(LLBFitServer.java:120)
at
com.llbean.test.fitnesse.servletrunner.server.LLBFitServer.runTests(LLBFitServer.java:40)
at
com.llbean.test.fitnesse.servletrunner.servlet.FitServlet.service(FitServlet.java:32)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1530)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:829)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:458)
at
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:862)
at
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:178)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
Caused by: java.lang.NullPointerException
at
org.drools.reteoo.RuleTerminalNode.createActivations(RuleTerminalNode.java:276)
at
org.drools.reteoo.RuleTerminalNode.modifyLeftTuple(RuleTerminalNode.java:326)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:273)
at
org.drools.reteoo.EvalConditionNode.modifyLeftTuple(EvalConditionNode.java:234)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateModifyChildLeftTuple(CompositeLeftTupleSinkAdapter.java:295)
at org.drools.reteoo.JoinNode.modifyLeftTuple(JoinNode.java:380)
at org.drools.reteoo.BetaNode.modifyLeftTuple(BetaNode.java:450)
at org.drools.reteoo.JoinNode.modifyLeftTuple(JoinNode.java:446)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateModifyObject(CompositeLeftTupleSinkAdapter.java:260)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateModifyObject(CompositeLeftTupleSinkAdapter.java:275)
at
org.drools.reteoo.LeftInputAdapterNode.modifyObject(LeftInputAdapterNode.java:174)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:461)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:429)
at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:277)
at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:271)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:459)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:363)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:298)
at
com.llbean.droolstest.Rule_Rule_022___Load_Buyer_Activity.defaultConsequence(Rule_Rule_022___Load_Buyer_Activity.java:15)
at
com.llbean.droolstest.Rule_Rule_022___Load_Buyer_ActivityDefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at
com.llbean.droolstest.Rule_Rule_022___Load_Buyer_ActivityDefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
... 45 more
--
View this message in context: http://drools.46999.n3.nabble.com/5-3-0-CR1-has-broken-existing-rules-flo...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Problem with Java enums in Guvnor "multiple field constraints"?
by enkidu
I've been playing with Drools and Guvnor and think I've encountered a problem
with Java enums in Guvnor. I've searched for previous enum bugs and seen
that a lot have been fixed, but I've tried Guvnor 5.2.0 and 5.3.0.CR1 and it
happens in both.
The problem seems to happen when you use enums in a "multiple field
constraint" on a fact, eg:
There is a Person with:
any of the following:
role equal to Role.TEACHER
role equal to Role.PARENT
Then using "view source" to see the generated DRL, the enum values are
enclosed in double quotes, ie:
rule "test"
dialect "mvel"
when
Person( role == "Role.TEACHER" || role == "Role.PARENT" )
then
end
If I just do a single field constraint then it comes out fine, eg. Person(
role == Role.TEACHER )
Is this a bug or am I doing something stupid? I've seen posts recommending
the use of string constants rather than enums - is this the workaround?
Below is my simple Java model for completeness:
public enum Role {
TEACHER,
STUDENT,
PARENT
}
public class Person {
private String name;
private Role role;
public Person( String name, Role role ) {
this.name = name;
this.role = role;
}
public String getName() { return name; }
public Role getRole() { return role; }
}
--
View this message in context: http://drools.46999.n3.nabble.com/Problem-with-Java-enums-in-Guvnor-multi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months