[id='kie-sessions-con_{context}']

= KIE sessions

In {PRODUCT}, a KIE session stores and executes runtime data. The KIE session is created from a KIE base or directly from a KIE container if you have defined the KIE session in the KIE module descriptor file (`kmodule.xml`) for your project.

.Example KIE session configuration in a `kmodule.xml` file
[source,xml]
----
<kmodule>
  ...
  <kbase>
    ...
    <ksession name="KSession2_1" type="stateless" default="true" clockType="realtime">
    ...
  </kbase>
  ...
</kmodule>
----

A KIE base is a repository that you define in the KIE module descriptor file (`kmodule.xml`) for your project and contains all
ifdef::DM[]
rules and other business assets
endif::DM[]
ifdef::PAM[]
rules, processes, and other business assets
endif::PAM[]
in {PRODUCT}, but does not contain any runtime data.

.Example KIE base configuration in a `kmodule.xml` file
[source,xml]
----
<kmodule>
  ...
  <kbase name="KBase2" default="false" eventProcessingMode="stream" equalsBehavior="equality" declarativeAgenda="enabled" packages="org.domain.pkg2, org.domain.pkg3" includes="KBase1">
    ...
  </kbase>
  ...
</kmodule>
----

A KIE session can be stateless or stateful. In a stateless KIE session, data from a previous invocation of the KIE session (the previous session state) is discarded between session invocations. In a stateful KIE session, that data is retained. The type of KIE session you use depends on your project requirements and how you want data from different asset invocations to be persisted.
