Continuous deployment of rules/vetoing changesets
by Gustaf Cele
Hi,
I have a Guvnor server (5.4.0.Final) which provides rules to a client (which itself is an EJB server app) using KnowledgeAgents to get hold of rule updates. The knowledge agents are started with changeset XMLs on the classpath which point at my Guvnor instance.
The KnowledgeAgents are set up thus:
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
KnowledgeAgent knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent(agentName);
knowledgeAgent.monitorResourceChangeEvents(true);
Resource resource = ResourceFactory.newClassPathResource(changeSetResourcePath, getClass());
knowledgeAgent.applyChangeSet(resource);
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
And the changesets look like this (xsd stuff removed for brevity):
<change-set>
<add>
<resource username="ruleclient" password="hunter2" basicAuthentication="enabled"
source="http://guvnorhost/drools-guvnor/org.drools.guvnor.Guvnor/package/my.packa..."
type="PKG" />
</add>
</change-set>
As you can see, we use LATEST because we want continuous deployment of our rules. Change a rule, build the package, and have the connected KnowledgeAgents updated with the new rule. This works very well - a bit too well, unfortunately. We have a comprehensive test suite, and every now and then, you'll check in a rule that breaks a test. We want to prevent any changes to our rules from being propagated to the clients until all the tests succeed, and this is where we're stuck.
We've tried using a KnowledgeAgentEventListener which throws an exception when it detects test failures:
public class VetoListener extends DefaultKnowledgeAgentEventListener {
@Override
public void beforeChangeSetApplied(BeforeChangeSetAppliedEvent event) {
if (!allTestsPass()) {
throw new RuntimeException("tests failed, not applying change set");
}
}
boolean allTestsPass(){
// Get test results from ${guvnor_url}/org.drools.guvnor.Guvnor/package/my.package/LATEST/SCENARIOS
// and check if there were any failures
}
}
// Usage:
knowledgeAgent.addEventListener(new VetoListener());
This does prevent the new changeset from being applied, but it also seems to kill the thread polling for new changes entirely. Restarting the ResourceChange{Scanner,Notifier}Services doesn't help.
I've also tried modifying the event's changeset (I know you shouldn't), but it doesn't stop the changes from being applied:
public void beforeChangeSetApplied(BeforeChangeSetAppliedEvent event) {
if (!allTestsPass()) {
event.getChangeSet().getResourcesModified().clear();
// ... and clear all the other collections you can get from event.getChangeSet()
}
}
So, what I wonder is if there is any way of preventing a changeset from being applied to a KnowledgeAgent's knowledge base when there are failing test scenarios, but which applies updates as soon as all tests succeed? More generally, I'm looking for something with fewer manual steps than run tests-make snapshot-publish, and in particular I want to ensure you never publish a package when there are tests failing, and it should preferably not require any changes outside of Guvnor to get out new rules to the client app. Any ideas?
Thanks in advance,
/g
12 years, 3 months
drools-camel-server > RetractAll() Command?
by Nicholas Hemley
Hello,
I am currently working with the drools-camel-server and would like to retract all objects in the KB (via Commands that connect using JAXRS).
Some of the objects are created by rules and so I do not have all the FactHandles.
How do I achieve this, please?
Interestingly, the newGetObjects command will return all the objects but not their associated facthandles since if it did, I could simply have looped over this list and issued a RetractCommand for each.
Any ideas (apart from re-creating the knowledge base), please?
Cheerio,
Nic
Nicholas Hemley
12 years, 3 months
RuleFlow not Found
by abhinay_agarwal
hey i want to make a ruleflow using eclipse..
when i go to FILE -> NEW -> OTHERS -> DROOLS -> here i sud get a RULEFLOW
FILE option which creates a .rf file..
instead of this m getting a FLOW FILE option which is creating a .bpmn
file..
can any1 tellme what is wrong with my eclipse/drools ?
--
View this message in context: http://drools.46999.n3.nabble.com/RuleFlow-not-Found-tp4018251.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
The rule language. More about the agenda-group and ruleflow-group attributes
by Maxim Kolchin
Hi,
I've only been working with drools about couple of months. I've read the
documentation and some articles about drools.
But, I've not found the detail information about the agenda-group and
ruleflow-group attributes, or examples showing how to work with them.
Have I missed something? Will be grateful for any useful information.
Regards,
Maxim Kolchin,
Laboratory of Intellectual Systems,
National Research University ITMO,
Saint-Petersburg.
http://ailab.ifmo.ru/
Email: kolchinmax(a)gmail.com
12 years, 3 months
how to avaide overwrinting results in drools planner
by Ricardo
I have 2 boxes, lets say each size of 5x5 and I have 3 items two size 4x4 and
one item size is 3x3. planner initially planner assigning as follows...
I - When I use 3 items 2 boxes....(this produce wrong planning)
item1 (4x4) --> box1 (5x5)
item2 (4x4) --> box2 (5x5)
item3 (4x4) --> box1 (5x5)
II - When I use 2 item, result as follows...(this is correct planning)
item1 (4x4) --> box1 (5x5)
item2 (4x4) --> box2 (5x5)
III - When I increase one more box....(this is correct too)
item1 (4x4) --> box1
item2 (4x4) --> box2
item3 (4x4) --> box3
you can see the test I - it is over writing the first assignment and assign
the new item there in the box 1, I unable to figure it out how to solve this
problem, I suspect this can be done in the score calculation rules, the
problem is I do not know how to implement to avoid the overwriting
assignments.
thanks,
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/how-to-avaide-overwrinting-results-in-d...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Write Assumptions for NESTED List<Object>
by aliosha79
Hi i have these simple three POJO class. The first is an OrderType that
cointains a List or OrderLineType and each orderline cointains a list
of measures.
________________________________________________________
/public class OrderType {
protected List<OrderLineType> OrderLine;
protected String priority;
public void set ....
public List<OrderlineType> get ....
public getPriority()...
public setPriority()...
}
public class OrderLineType {
protected String Quantity;
protected List<OrderLineMeasure> OrderLineMeasure;
public void set ....
public List<OrderLineMeasure> get ....
public getQuantity()...
public setQuantity()...
}
public class OrderLineMeasure {
protected int measure;
protected List<OrderLineMeasure> OrderLineMeasure;
public getMeasure()...
public setMeasure()...
} /
________________________________________________________
I want to write an assumption stating that:
*If an ORDER contains at least 3 orderLine... the order must have the High
Priority.* In can do that writing this rule:
_______________________________________________________________
/when
$Order : OrderType ($orderLineList :orderLine)
OrderLineType(Quantity.Value >= 3 ) from $orderLineList
then
$Order.getUBLRuleEnginePriority().setValue("high");
end/
________________________________________________________________
Now how can i write the assumption? if i want a rule stating:
*If an ORDER contains at least 3 orderLine and Each OrderLine contains more
than 12 measures... the order must have the High Priority.*
Really thanks for your help.
Regards.
Alessio
--
View this message in context: http://drools.46999.n3.nabble.com/Write-Assumptions-for-NESTED-List-Objec...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Issues without response
by Cyril Sochor
Hi,
I created two issues in bugtracker, second one with pull request.
JBRULES-3528 Deadlock when using pseudo session clock
JBRULES-3529 JMS messenger for JBOSS AS 7.1
Issues are 20 days without any response. What's wrong?
Thank you,
Cyril Sochor
12 years, 3 months