Guvnor: Accessing Bound Variable in "Then" Statement
by Vann_the_Red
Hello. I started with a search and didn't find an answer. I apologize if my
search-fu was lacking today.
I'm a non-developer tasked with rules creation and testing using guvnor. I
have found some scenarios where I can bind a variable to either the whole
input model or a fact in the input model and then later access those in the
output model by selecting "Bound Variable" from the popup box in the Then
statement. In other scenarios, "Bound Variable" is not an option (only
Literal or Formula). What must I do to be able to access the bound
variables from the When statement(s) in the Then statement(s)?
TIA,
Vann
This is a repost because I wasn't on the mailing list yet and I gather most
didn't see it. Apologies again.
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Accessing-Bound-Variable-in-Then...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 5 months
How to write Hibernate query lang(HQL) in .DRL file
by zeeshan
Hi !
According to my requirement I need to fetch and Insert data from database
using Hibernate Query from .DRL file.
I have idea how to execute HQL in Plain Java class but according to my
requirement,I need to fire query to database from .DRL file which I tried
but unable to get output instead I was getting errors.
Can anyone suggest me process to execute Hibernate Query from DRL file
or please provide me some sample code or any link.
Thanks !!
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-i...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 6 months
[Drools Planner] Multi depot CVRP / CVRPTW
by Mats Norén
Hi,
I've been looking at the VRP example in Drools and I'm thinking about using
it for multi depot cvrp and / or capacitated vrp with time windows.
Has anyone else tried planner for these use cases and can maybe shed some
light on their implementation?
Regards,
Mats
11 years, 7 months
"Rule-Id" for a Drools Rule
by harishtejwani
All:
We are using Drools to detect specific events/conditions in our system.
In the 'then' condition of Drools rule, we would like to persist the "Rule
Id" of the rule that created the specific event/condition
This is because all our reporting is based on "rules" as filters, where
users can look at exceptions by specific rules.
Is there a suggestion or sample as how can the "Rule Id" be persisted or
indicated in the then condition that is immutable or can be long-lived. The
current approach of using Rule Name itself as the ID is brittle as this can
be changed and suddenly all reports would break.
If we assign ID's to rules, where do we keep the mapping of RULE ID to
Rules. If we store rules in GUVRNOR is there a way we can get Rule Id's for
Rules?
Best regards
Harish Tejwani
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-Id-for-a-Drools-Rule-tp2914385p291...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Question about drools-spring in a multi-treaded container (like tomcat).
by Gurvinder Narula1
Hello all,
I've been reading up about drool-spring integration and have put together a simple project that wires together a KnowledgeBase and KnowledgeSession as follows :
<drools:resource id="GroupUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/GroupUnit.drl" />
<drools:resource id="GradeUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/GradeUnit.drl"" />
<drools:resource id="EvaluateUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/EvaluateUnit.drl"" />
<drools:grid-node id="node1" />
<drools:kbase id="kbase1" node="node1">
<drools:resources>
<drools:resource ref="GroupUnit" />
<drools:resource ref="GradeUnit" />
<drools:resource ref="EvaluateUnit" />
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession" type="stateful" kbase="kbase1"
node="node1" />
Then in my Controller call, I 'AutoWire' in the StatefulKnowledgeSession as follows :
@Controller
@RequestMapping( value = "foo" )
final class FooController{
@Autowired
StatefulKnowledgeSession ksession;
@RequestMapping( method = RequestMethod.GET )
@ResponseBody
public String evaluateUnit() {
Unit unit = new Unit("030", "502", "C", "9484", "45", new String[] {},
null);
if (ksession != null) {
ksession.fireAllRules();
ksession.insert(unit);
ksession.fireAllRules();
return "<UnitCategory>" + unit.getUnitCategory() + "</UnitCategory>";
}
else
return "<message> stateful session is null</message>";
}
The main question that I have is that – is this solution thread-safe ? From what I understand of spring is that beans configured without any additional qualifiers are inherently singletons. And when deployed in a multi-theaded container like tomcat, Spring assumes that the beans being severed up a thread-safe. So from I have read is that KnowledeSessions are inherently not thread safe. So putting the 2 together, I leaning towards the assessment that this above solution is NOT thread safe and that if I do want it to be thread safe I should set the StatefulKnowledgeSession to 'prototype' and not leave it as a singleton.
Please let me know if I'm missing anything in my assessment here !
Thanks in advance,
Gurvinder
This message is intended only for the individual or entity to which it is addressed. It may contain privileged, confidential information which is exempt from disclosure under applicable laws. If you are not the intended recipient, please note that you are strictly prohibited from disseminating or distributing this information (other than to the intended recipient) or copying this information. If you have received this communication in error, please notify us immediately by e-mail or by telephone at the above number. Thank you.
11 years, 8 months
Compiled rules differ KnowledgeAgent vs ResourceChangeScanner
by lhorton
Version 5.2.0.Final. I have a DRL file that is loaded into my server using a
change set and Spring configuration. The file loads without error, and I am
able to read the compiled package and print the rule names to confirm they
did load; however, only one of the rules fires. Then I copy (hot-deploy)
the same DRL file to its server-side directory, and the Resource change
Scanner picks it up and reloads it. After reload, all the expected rules
execute.
My guess is that the Spring/KnowledgeAgent compilation is different than the
one done via the resource change scanner. Has anyone else seen this
behavior? Any suggestions for further trouble shooting?
I can attach the change set, spring config and drl file if needed.
--
View this message in context: http://drools.46999.n3.nabble.com/Compiled-rules-differ-KnowledgeAgent-vs...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
continuous integration of rule assets via jenkins to guvnor?
by Cedric Hurst
I'd like to get a quick sanity check on best practices...
I'm working on a project where, by policy, all assets (including drl's, bpmn
files, etc) must be built, tested and packaged by a Jenkins server. Rule
assets are structured within a project that also includes non-rule assets.
As is quite common, the primary system of record for these assets is an SCM
like svn or git, and that's what our Jenkins box talks to.
However, for the rule stuff specifically, we're also using Guvnor's
drools-repository to package the assets into a knowledge base, which is
referenced jBPM's process engine in the runtime. The plan is to have
several Guvnor environments running with parity to development, QA, UAT and
production setups. However, we're having a very hard time figuring out how
best to sync our rule assets to these various repositories as part of an
automated release.
To the best of my understanding, rule assets are deployed to a Guvnor
instance file-by-file via WebDAV. One can also upload JARs for POJOs, but
DRLs, BPMN, DSL files need to be synced individually. Is this the case?
And, if so, how do other groups handle continuous integration and deployment
of assets coming from external SCMs?
Btw, I came across aware of a Maven plugin which seems to do this sort of
piece-by-piece deployment:
https://github.com/awaterma/drools-guvnor-plugin
So we could certainly port this sort of functionality to our own build
toolchain, but it seems like a lot of work so I'm hoping for a better way.
--
View this message in context: http://drools.46999.n3.nabble.com/continuous-integration-of-rule-assets-v...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months