It seems to me that rule metadata would be the answer to your problem.
This keeps the ID right in the rule.

Alternatively, you could make the ID an immutable part of the rule name,
e.g. "change me here but [don't change me here]".


On 8 May 2011 06:17, harishtejwani <> wrote:

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

Best regards

Harish Tejwani

View this message in context:
Sent from the Drools: User forum mailing list archive at
rules-users mailing list