Nav

Try Scope XML Reference

A Try scope follows the structure described below.

  • A single root element <try>

  • Components that are executed under the error-handling rules defined by the Try scope are defined as child elements of the try element. You can place one or many here.

  • A single <error-handler> element holds all error handling strategies for the scope.

  • In the error handler, one or several on-error-continue and on-error-propagate define the various strategies. At least one of these must be present.

  • Components that are executed when a matching error occurs are defined as child elements of the on-error element. You can place one or many here.


         
      
1
2
3
4
5
6
7
8
9
10
11
<try>
  <!-- COMPONENTS TO TRY TO USE -->
  <error-handler>
    <on-error-continue>
      <!-- COMPONENTS TO USE IN CASE OF ERROR -->
    </on-error-continue>
    <on-error-propagate>
      <!-- COMPONENTS TO USE IN CASE OF ERROR -->
    </on-error-propagate>
  </error-handler>
</try>

Each error handling strategy in a Try scope (on-error-*) follows a condition. This condition is typically an error type (or a list of several) which must match the current error. You can also define this condition as a freely written expression, such as error.cause.message.contains("fatal").

Note that conditions are evaluated in order and only the first strategy to match is executed.

Below is an example that includes two error handling strategies, each executing a logger component:


         
      
1
2
3
4
5
6
7
8
9
10
11
<try>
  <http:request config-ref="HTTP-config" method="GET" path="/" />
  <error-handler>
    <on-error-continue enableNotifications="true" logException="true" type="CONNECTIVITY">
      <logger level="INFO" doc:name="Logger" message="Connectivity Error"/>
    </on-error-continue>
    <on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" type="EXPRESSION">
      <logger level="INFO" doc:name="Logger" message="Expression error" />
    </on-error-propagate>
  </error-handler>
</try>

Properties of Try

Property Default Description

transactionalAction

INDIFFERENT

Defines if what’s in the scope is treated as a transaction. Possible values:

  • INDIFFERENT : What’s in the scope isn’t treated as a transaction.

  • ALWAYS_BEGIN: A new transaction is sarted every time the scope is executed.

  • BEGIN_OR_JOIN: If the current processing of the flow has already begun a transaction, join it. Otherwise, begin a new one. (Only relevant when execution order may vary).

transactionalType

LOCAL

Defines the type of transaction to use. Possible values:

  • "LOCAL"

  • "MULTI"

  • "XA"