title: How can I read facts outside of the KieSession that were inserted inside of the KieSession­ (e.g. rules results)?
body: <p>During my rules execution, I will be "inserting" new fact object in memory that I will need to read when the rules are done firing. How can I read those facts when outside the Rules Session?</p>
  
  <p>I have tried to insert the fact with an outIdentifier, from outside the session (i.e. before the "fireAllRules()" method). However, because I may not know how many AccountingPeriod fact may get inserted during the rule session, or even if it will get inserted, this method does not seem suitable.</p>
  
  <p>Accounting Period Fact:</p>
  
  <pre class="lang-java prettyprint-override"><code>package sample.package;
  
  public class AccountingPeriod {
  
      private LocalDate accountingDate;
      private int personKey;
  
      public AccountingPeriod(LocalDate accountingDate, int personKey) {
          this.accountingDate = accountingDate;
          this.personKey = personKey;
      }
  
      public LocalDate getAccountingDate() { return accountingDate; }
      public LocalDate getPersonKey() { return personKey; }
  }
  </code></pre>
  
  <p>Execution Code :</p>
  
  <pre class="lang-java prettyprint-override"><code>sample.package;
  public static void main(String args[]) {
      StatelessKieSession ksession = [initialized KieSession]
  
      ksession.execute(Arrays.asList(Facts[]));
      [Code here to get the AccountingPeriod fact inserted in the rule session]
  }
  
  </code></pre>
  
  <p>myRules.drl</p>
  
  <pre><code>rule
      when [some condition]
      then
          insert (new AccountingPeriod(LocalDate.of(year, month, day), 100));
  end
  </code></pre>