Nuxeo Server

Automation Chain Exception

Updated: March 18, 2024

Content Automation provides means to debug and handle exception during the Automation operations and chains calls.

Automation exception chain can be added to be executed when an error occurs during an Automation execution.

After contributing your custom chains, you can declare your exception chains:

<extension point="chainException"
             target="org.nuxeo.ecm.core.operation.OperationServiceComponent">

    <catchChain id="catchChainA" onChainId="contributedchain">
      <run chainId="chainExceptionA" priority="0" rollBack="true" filterId="filterA"/>
      <run chainId="chainExceptionA" priority="0" rollBack="false" filterId="filterA"/>
      <run chainId="chainExceptionB" priority="10" rollBack="true" filterId="filterB"/>
    </catchChain>

    <catchChain id="catchChainB" onChainId="anothercontributedchain">
      <run chainId="chainExceptionA" rollBack="false"/>
    </catchChain>

</extension>
  • This contribution declares a set of execution chains to be executed after 'contributedchain' failure.
  • Here 'chainExceptionA' and 'chainExceptionB' are different candidates.
  • Filters can be added (see next chapter).
  • Rollback is set to defined if we should rollback transaction after 'contributedchain' failure.
  • Priority can be defined to know which chain is going to take the hand on a candidates range. Higher priority wins.

Here is the contribution to deploy filters that can be added to decide which chain is going to be executed:

<extension point="automationFilter"
             target="org.nuxeo.ecm.core.operation.OperationServiceComponent">

    <filter id="filterA">expr:@{Document['dc:title']=='Source'}</filter>

    <filter id="filterB">expr:@{Document['dc:title']=='Document'}</filter>

</extension>

These filters are strictly written in MVEL template or expression starting by expr:.

Exception is cached into the operation context and can be used into filters:

<extension point="automationFilter"
             target="org.nuxeo.ecm.core.operation.OperationServiceComponent">

    <filter id="filterA">expr:@{Context['Exception']=='NullPointerException'}</filter>

</extension>

If two candidate chains have the same priority and both have their filter evaluated to true, the last one contributed is executed.