- All Superinterfaces:
Environment,EventBus,FluentEnvironment<S>,FluentImports<S>,MemoryStreaming,Named,RuleSet<RuntimeRule>,RuleSetContext<S,,RuntimeRule> RuntimeContext<S>,SessionOps
- All Known Subinterfaces:
StatefulSession,StatelessSession
- All Known Implementing Classes:
AbstractSessionWrapper
public interface RuleSession<S extends RuleSession<S>>
extends RuleSetContext<S,RuntimeRule>, SessionOps, MemoryStreaming
Base interface for both stateful and stateless sessions
-
Method Summary
Modifier and TypeMethodDescriptiondefault SaddEventListener(SessionLifecycleListener listener) Deprecated.since 4.0.0.A convenience method that returns an instance ofCollectorfor inserting streams of facts.fire()Fires the rule session and returns the associated object that depends on the implementation of the current session.Retrieves the activation manager associated with this session.<T> TgetFact(FactHandle handle) Returns fact by its handle.Retrieves the parent context of this session instance.default SInserts a collection of facts.default SInserts an array of facts.default SInserts a collection of facts, marking them as being of a specific type.default SInserts a collection of facts, marking them as being of a specific type.default SremoveEventListener(SessionLifecycleListener listener) Deprecated.since 4.0.0.setActivationManager(ActivationManager activationManager) Sets the activation manager for the session.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.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
-
getFact
Returns fact by its handle.- Type Parameters:
T- type of the fact (useObjector wildcard if type is unknown)- Parameters:
handle- fact handle- Returns:
- fact or
nullif fact is not found
-
asCollector
A convenience method that returns an instance ofCollectorfor inserting streams of facts.- Type Parameters:
T- the type of input elements to the reduction operation- Returns:
- collector
-
insertAs
Inserts a collection of facts, marking them as being of a specific type.
- Parameters:
type- type nameobjects- objects to insert- Returns:
- this instance
- See Also:
-
insertAs
Inserts a collection of facts, marking them as being of a specific type.
- Parameters:
type- type nameobjects- objects to insert- Returns:
- this instance
- See Also:
-
insert
Inserts a collection of facts.
- Parameters:
objects- objects to insert- Returns:
- this instance
- See Also:
-
insert
Inserts an array of facts.
- Parameters:
objects- objects to insert- Returns:
- this instance
- See Also:
-
getActivationManager
ActivationManager getActivationManager()Retrieves the activation manager associated with this session.- Returns:
- the activation manager for this session
-
setActivationManager
Sets the activation manager for the session.- Parameters:
activationManager- the activation manager to set- Returns:
- the current session instance
-
addEventListener
Deprecated.since 4.0.0. The library has moved from an Observer to a PubSub pattern. See theEventBus.subscribe(Class, boolean, Consumer)method for alternatives to adding listeners.Adds a session lifecycle listener to receive session lifecycle events.- Parameters:
listener- the session lifecycle listener to add- Returns:
- the current instance of the session
-
removeEventListener
Deprecated.since 4.0.0. The library has moved from an Observer to a PubSub pattern. See theEventBus.subscribe(Class, boolean, Consumer)method for alternatives to adding listeners.Removes aSessionLifecycleListenerfrom the session.- Parameters:
listener- theSessionLifecycleListenerto be removed- Returns:
- the current instance of the session
-
getParentContext
Knowledge getParentContext()Retrieves the parent context of this session instance.- Returns:
- the parent context of this Knowledge instance
-
fire
Object fire()Fires the rule session and returns the associated object that depends on the implementation of the current session.
- Returns:
- an object representing the result of the rule session execution.
-