<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Delay in writing changes to DB in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/delay-in-writing-changes-to-db/m-p/328369#M15370</link>
    <description>&lt;P&gt;You should fire this code from an event listener that implements the &lt;CODE&gt;PostCommitEventListener&lt;/CODE&gt; interface. This will only be called once the database has successfully committed the transaction hence rendered the changes visible to new transactions that starts after the commit.&lt;/P&gt;
&lt;P&gt;For instance in Nuxeo the &lt;CODE&gt;JmsEventForwarder&lt;/CODE&gt; class implements that interface to avoid the problems you mention.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Oct 2011 17:31:40 GMT</pubDate>
    <dc:creator>Olivier_Grisel</dc:creator>
    <dc:date>2011-10-04T17:31:40Z</dc:date>
    <item>
      <title>Delay in writing changes to DB</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/delay-in-writing-changes-to-db/m-p/328368#M15369</link>
      <description>&lt;P&gt;We have non-nuxeo code that reads documents directly from the database. We fire this code (that updates a lucene index) based on nuxeo events (eg "document created"). In other places, we manually fire the non-nuxeo code with a 1 second delay.&lt;/P&gt;
&lt;P&gt;In both cases, we are finding that often there is a significant lag between when we expect nuxeo to have written to the db, and the the changes actually being written.&lt;/P&gt;
&lt;P&gt;Is there a way we can guarantee that our "other" code executes AFTER nuxeo has committed changes to the database? Any solution would do - eg a callback, changing a setting, anything.&lt;/P&gt;
&lt;P&gt;We are using Nuxeo 5.3 and postgres 8.3.
Upgrading nuxeo is not a viable option at the moment.&lt;/P&gt;
&lt;H3&gt;EDITED:&lt;/H3&gt;
&lt;P&gt;It seems I can not answer my own question, so I'll edit it here instead with how I solved this problem:&lt;/P&gt;
&lt;H3&gt;ACCEPTED ANSWER:&lt;/H3&gt;
&lt;P&gt;I solved this not by implementing &lt;CODE&gt;PostCommitEventListener&lt;/CODE&gt; (and adding code that did not add any more value), but rather by setting &lt;CODE&gt;postCommit="true"&lt;/CODE&gt; on my existing event listeners in listener-contrib.xml . That fixed everything.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2011 08:45:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/delay-in-writing-changes-to-db/m-p/328368#M15369</guid>
      <dc:creator>Bohemian_</dc:creator>
      <dc:date>2011-10-04T08:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Delay in writing changes to DB</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/delay-in-writing-changes-to-db/m-p/328369#M15370</link>
      <description>&lt;P&gt;You should fire this code from an event listener that implements the &lt;CODE&gt;PostCommitEventListener&lt;/CODE&gt; interface. This will only be called once the database has successfully committed the transaction hence rendered the changes visible to new transactions that starts after the commit.&lt;/P&gt;
&lt;P&gt;For instance in Nuxeo the &lt;CODE&gt;JmsEventForwarder&lt;/CODE&gt; class implements that interface to avoid the problems you mention.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2011 17:31:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/delay-in-writing-changes-to-db/m-p/328369#M15370</guid>
      <dc:creator>Olivier_Grisel</dc:creator>
      <dc:date>2011-10-04T17:31:40Z</dc:date>
    </item>
  </channel>
</rss>

