- All Superinterfaces:
Environment,EventBus,FluentEnvironment<StatelessSession>,FluentImports<StatelessSession>,MemoryStreaming,Named,RuleSession<StatelessSession>,RuleSet<RuntimeRule>,RuleSetContext<StatelessSession,,RuntimeRule> RuntimeContext<StatelessSession>,SessionOps
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().
-
Method Summary
Modifier and TypeMethodDescriptionfire()Fires the session and performs no memory scan.default <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 predicatedefault <T> voidA convenience method to retrieve facts of a specific logical type name.default <T> voidA convenience method to retrieve facts of a specific type name and matching given predicatedefault voidfire(BiConsumer<FactHandle, Object> consumer) Fires the session and calls the consumer for each memory object and its fact handle.default 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.events.EventBus
getPublisher, subscribe, subscribe, subscribeAsyncMethods 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.MemoryStreaming
streamFactEntries, streamFactEntries, streamFactEntries, streamFacts, streamFacts, streamFactsMethods inherited from interface org.evrete.api.RuleSession
addEventListener, asCollector, getActivationManager, getFact, getParentContext, insert, insert, insertAs, insertAs, removeEventListener, setActivationManagerMethods inherited from interface org.evrete.api.RuleSet
getRule, getRule, getRules, ruleExistsMethods inherited from interface org.evrete.api.RuntimeContext
builder, builder, configureTypes, getActivationManagerFactory, getClassLoader, getConfiguration, getEvaluatorsContext, getRuleComparator, getService, getTypeResolver, importRules, importRules, setActivationManagerFactory, setActivationManagerFactory, setActivationMode, setRuleComparator
-
Method Details
-
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());This method is only applicable if the provided
FactStorageSPI implementation stores facts by reference (e.g. does not serialize/deserialize objects). The default implementation does.- Specified by:
firein interfaceRuleSession<StatelessSession>- Returns:
- an object representing the result of the rule session execution.
-
fire
Fires the session and calls the consumer for each memory object and its fact handle.
- Parameters:
consumer- consumer for session memory
-
fire
Fires the session and calls the consumer for each memory object that satisfies given filter
- Parameters:
consumer- consumer for session memoryfilter- filtering predicate
-
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 logical type name.
- Type Parameters:
T- the generic type of the objects consumed when the session is fired- Parameters:
type- the logical type of the objectsconsumer- consumer for session memory
-
fire
A convenience method to retrieve facts of a specific type name and matching given predicate
- Type Parameters:
T- the generic type of the objects consumed when the session is fired- Parameters:
consumer- consumer for session memoryfilter- filtering predicatetype- string type of the objects to consume
-
fire
A convenience method to retrieve the resulting instances of a specific Java class.
- Type Parameters:
T- the generic type of the objects consumed when the session is fired- Parameters:
consumer- consumer for session memorytype- the class of the objects consumed when the session is fired
-
fire
A convenience method to retrieve facts of a specific Java type and matching given predicate
- Type Parameters:
T- the generic type of the objects consumed when the session is fired- Parameters:
type- class of objects to retrieve upon fireconsumer- consumer for session memoryfilter- filtering predicate
-
insertAndFire
-
insertAndFire
-