Interface StatelessSession
- All Superinterfaces:
Environment,EvaluationListeners,EvaluatorsContext,FluentEnvironment<StatelessSession>,FluentImports<StatelessSession>,RuleSession<StatelessSession>,RuleSet<RuntimeRule>,RuleSetContext<StatelessSession,,RuntimeRule> RuntimeContext<StatelessSession>
Unlike stateful sessions, stateless sessions are designed to be short-living instances
that can be fired only once, returning the resulting working memory snapshot.
Generally, every StatelessSession can be considered as a StatefulSession
that automatically calls StatefulSession.close() after StatefulSession.fire().
-
Field Summary
Fields inherited from interface org.evrete.api.RuntimeContext
SALIENCE_COMPARATOR -
Method Summary
Modifier and TypeMethodDescriptionfire()Fires the session and performs no memory scan.<T> voidA convenience method to retrieve the resulting instances of a specific Java class.default <T> voidA convenience method to retrieve facts of a specific Java type and matching given predicate<T> voidA convenience method to retrieve facts of a specific type name.default <T> voidA convenience method to retrieve facts of a specific type name and matching given predicatevoidfire(BiConsumer<FactHandle, Object> consumer) Fires the session and calls the consumer for each memory object and its fact handle.voidFires the session and calls the consumer for each memory object.default voidFires the session and calls the consumer for each memory object that satisfies given filterdefault voidinsertAndFire(Iterable<Object> objects) default voidinsertAndFire(Object... objects) Methods inherited from interface org.evrete.api.Environment
get, get, getPropertyNamesMethods inherited from interface org.evrete.api.EvaluationListeners
addListener, removeListenerMethods inherited from interface org.evrete.api.EvaluatorsContext
addEvaluator, addEvaluator, getEvaluator, replaceEvaluator, replaceEvaluatorMethods inherited from interface org.evrete.api.FluentEnvironment
setMethods inherited from interface org.evrete.api.FluentImports
addImport, addImport, getImports, getJavaImportsMethods inherited from interface org.evrete.api.RuleSession
addEventListener, asCollector, getActivationManager, getParentContext, insert, insert, insert, insert0, insert0, insertAs, insertAs, insertAs, removeEventListener, setActivationManager, setExecutionPredicateMethods inherited from interface org.evrete.api.RuleSet
addRule, compileRule, getRule, getRule, getRules, resolveFieldReferences, ruleExists, setRuleBuilderExceptionHandlerMethods inherited from interface org.evrete.api.RuntimeContext
compile, compile, getActivationManagerFactory, getClassLoader, getConfiguration, getExpressionResolver, getRuleComparator, getService, getSourceCompiler, getTypeResolver, newRule, newRule, setActivationManagerFactory, setActivationManagerFactory, setActivationMode, setClassLoader, setRuleComparator, wrapTypeResolver
-
Method Details
-
fire
Fires the session and calls the consumer for each memory object and its fact handle.
- Parameters:
consumer- consumer for session memory
-
fire
Void fire()Fires the session and performs no memory scan. This method might be useful if developer is holding references to fact variables and only interested in changes of those facts:
Customer c = new Customer(); session.insert(c); session.fire(); Log.info(c.getSomeUpdatedProperty());While this method is the easiest among the other
fire(..)methods, it is only applicable if the providedFactStorageSPI implementation stores facts by reference (e.g. does not serialize/deserialize objects). The default implementation does not serialize or otherwise transform fact instances- Specified by:
firein interfaceRuleSession<StatelessSession>
-
fire
Fires the session and calls the consumer for each memory object that satisfies given filter
- Parameters:
filter- filtering predicateconsumer- consumer for session memory
-
fire
Fires the session and calls the consumer for each memory object.
- Parameters:
consumer- consumer for session memory
-
fire
A convenience method to retrieve facts of a specific type name.
- Parameters:
consumer- consumer for session memory
-
fire
A convenience method to retrieve facts of a specific type name and matching given predicate
- Parameters:
filter- filtering predicateconsumer- consumer for session memory
-
fire
A convenience method to retrieve the resulting instances of a specific Java class.
- Parameters:
consumer- consumer for session memory
-
fire
A convenience method to retrieve facts of a specific Java type and matching given predicate
- Parameters:
filter- filtering predicateconsumer- consumer for session memory
-
insertAndFire
-
insertAndFire
-