Description of problem: When extending an event (either in Java or as declarative), if the extended event has a @expires value smaller than its parent, then it is ignored and the parents @expires values is taken. Example: declare SimpleEvent @role( event ) @timestamp( eventDate.getTime() ) @expires( 2d ) end declare AvalancheEvent extends SimpleEvent @role( event ) @timestamp( eventDate.getTime() ) @expires( 5m ) end The reason is in the following class: org.drools.core.reteoo.builder.PatternBuilder. private static long getExpiratioOffsetForType(BuildContext context, ObjectType objectType) { long expirationOffset = -1; for ( TypeDeclaration type : context.getRuleBase().getTypeDeclarations() ) { if ( type.getObjectType().isAssignableFrom( objectType ) ) { expirationOffset = Math.max( type.getExpirationOffset(), expirationOffset ); } } // if none of the type declarations have an @expires annotation // we return -1 (no-expiration) value, otherwise we return the // set expiration value+1 to enable the fact to match events with // the same timestamp return expirationOffset == -1 ? -1 : expirationOffset+1; } It seems like we can only extends an event if the @expires value is greater than its parent. Version-Release number of selected component (if applicable): Drools 6.0.0.CR5 How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Richard, this works as designed. The reason is that if you have a rule that uses the parent type, it still has to match the derived type. E.g.: rule X when ... SimpleEvent(...) ... then ... end Because of such situations, the expiration offset of an event is always the max between the individual expiration offsets in each rule. Please note that the global expiration offset for a given type discards the event from the session, but any constraints that would reduce the matching temporal interval are still applied to each rule.