<?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 Event.markRollBack in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/event-markrollback/m-p/314030#M1031</link>
    <description>&lt;P&gt;I have a question regarding the &lt;CODE&gt;markRollBack&lt;/CODE&gt; method of the &lt;CODE&gt;Event&lt;/CODE&gt; class. Tracing through &lt;CODE&gt;AbstractSession.createDocument&lt;/CODE&gt; to &lt;CODE&gt;EventServiceImpl.fireEvent&lt;/CODE&gt; into a subclass of &lt;CODE&gt;EventListener&lt;/CODE&gt; - I cannot see how calling &lt;CODE&gt;markRollBack&lt;/CODE&gt; on the &lt;CODE&gt;Event&lt;/CODE&gt; inside the listener subclass actually triggers a roll back of the transaction. Should this be mechanism be used for document-based event listeners to initiate rollbacks in exception conditions? I am unable to cause a rollback to happen in the unit test environment (have not yet tried in the local server environment.) I see the &lt;CODE&gt;markRollBack&lt;/CODE&gt; method used in the &lt;CODE&gt;org.nuxeo.ecm.user.invite&lt;/CODE&gt; package, and I also see it used in the &lt;EM&gt;nuxeo-quota&lt;/EM&gt; addon. I just don't see the code that actually performs the rollback on the basis of the flag being set in the &lt;CODE&gt;Event&lt;/CODE&gt; class. Clarification is appreciated on whether this is an appropriate way to manage transactions inside listeners and - if so - how it actually works. Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2017 18:06:39 GMT</pubDate>
    <dc:creator>Eric_Ace</dc:creator>
    <dc:date>2017-07-25T18:06:39Z</dc:date>
    <item>
      <title>Event.markRollBack</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/event-markrollback/m-p/314030#M1031</link>
      <description>&lt;P&gt;I have a question regarding the &lt;CODE&gt;markRollBack&lt;/CODE&gt; method of the &lt;CODE&gt;Event&lt;/CODE&gt; class. Tracing through &lt;CODE&gt;AbstractSession.createDocument&lt;/CODE&gt; to &lt;CODE&gt;EventServiceImpl.fireEvent&lt;/CODE&gt; into a subclass of &lt;CODE&gt;EventListener&lt;/CODE&gt; - I cannot see how calling &lt;CODE&gt;markRollBack&lt;/CODE&gt; on the &lt;CODE&gt;Event&lt;/CODE&gt; inside the listener subclass actually triggers a roll back of the transaction. Should this be mechanism be used for document-based event listeners to initiate rollbacks in exception conditions? I am unable to cause a rollback to happen in the unit test environment (have not yet tried in the local server environment.) I see the &lt;CODE&gt;markRollBack&lt;/CODE&gt; method used in the &lt;CODE&gt;org.nuxeo.ecm.user.invite&lt;/CODE&gt; package, and I also see it used in the &lt;EM&gt;nuxeo-quota&lt;/EM&gt; addon. I just don't see the code that actually performs the rollback on the basis of the flag being set in the &lt;CODE&gt;Event&lt;/CODE&gt; class. Clarification is appreciated on whether this is an appropriate way to manage transactions inside listeners and - if so - how it actually works. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 18:06:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/event-markrollback/m-p/314030#M1031</guid>
      <dc:creator>Eric_Ace</dc:creator>
      <dc:date>2017-07-25T18:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Event.markRollBack</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/event-markrollback/m-p/314031#M1032</link>
      <description>&lt;P&gt;The pattern is to do &lt;CODE&gt;event.markRollBack()&lt;/CODE&gt; then raise an exception. The framework will then re-raise an generic exception, and then the normal exception handling mechanism of Nuxeo will rollback the transaction.&lt;/P&gt;
&lt;P&gt;An alternative is to call &lt;CODE&gt;event.markBubbleException()&lt;/CODE&gt; then raise a specific exception like &lt;CODE&gt;RecoverableClientException&lt;/CODE&gt; which will be kept as-is by the framework and can be caught by whoever initiated the event.&lt;/P&gt;
&lt;P&gt;Failing to do either of those, an exception in a synchronous (inline) listener will be caught and logged, but the other ones will still be run and the transaction will continue.&lt;/P&gt;
&lt;P&gt;Code for all this is in &lt;CODE&gt;EventServiceImpl.fireEvent(Event)&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 17:05:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/event-markrollback/m-p/314031#M1032</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2017-07-26T17:05:41Z</dc:date>
    </item>
  </channel>
</rss>

