All versions: 3.12 | Development versions: 3.13

Listener Invocation Order

Available in ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

jOOQ offers a variety of SPIs in the Configuration object. Some of those SPIs are event listeners, that can listen to "start" and "end" events, such as for example the ExecuteListener that listens to the query execution lifecycle.

When registering multiple listeners of a type, the invocation order may be relevant as custom listeners might communicate with each other. In such a case, the following settings allow for overriding the invocation order of "start" and "end" events for each type of listener:

Programmatic configuration

Settings settings = new Settings()
    .withTransactionListenerStartInvocationOrder(DEFAULT); // Defaults to DEFAULT
    .withTransactionListenerEndInvocationOrder(REVERSE);   // Defaults to DEFAULT
    .withVisitListenerStartInvocationOrder(DEFAULT);       // Defaults to DEFAULT
    .withVisitListenerEndInvocationOrder(REVERSE);         // Defaults to DEFAULT
    .withRecordListenerStartInvocationOrder(DEFAULT);      // Defaults to DEFAULT
    .withRecordListenerEndInvocationOrder(REVERSE);        // Defaults to DEFAULT
    .withExecuteListenerStartInvocationOrder(DEFAULT);     // Defaults to DEFAULT
    .withExecuteListenerEndInvocationOrder(REVERSE);       // Defaults to DEFAULT

XML configuration

<settings xmlns="http://www.jooq.org/xsd/jooq-runtime-3.12.0.xsd">
  <transactionListenerStartInvocationOrder>DEFAULT</transactionListenerStartInvocationOrder>
  <transactionListenerEndInvocationOrder>REVERSE</transactionListenerEndInvocationOrder>
  <visitListenerStartInvocationOrder>DEFAULT</visitListenerStartInvocationOrder>
  <visitListenerEndInvocationOrder>REVERSE</visitListenerEndInvocationOrder>
  <recordListenerStartInvocationOrder>DEFAULT</recordListenerStartInvocationOrder>
  <recordListenerEndInvocationOrder>REVERSE</recordListenerEndInvocationOrder>
  <executeListenerStartInvocationOrder>DEFAULT</executeListenerStartInvocationOrder>
  <executeListenerEndInvocationOrder>REVERSE</executeListenerEndInvocationOrder>
</settings>
The jOOQ Logo