Making controller commands retriable

A retriable command is a controller command that can re-execute itself after encountering a system-level exception during the command execution.

Note:
  • Web services are not retriable.
  • All commands in the CommandRegistryEntry class are retriable by default.

Procedure

  1. To make an existing controller command retriable, must perform one of the following steps:
    1. Set the retriable properties in the PROPERTIES column of the CMDREG database table, where PROPERTIES is the default properties associated with this command. The properties are in the property1=value1&property2=value2 form, where propertyn is the name of the property and valuen is the value corresponding to the property.
    2. In the configuration file, set an instance property <CommandRegistryRetriableProperty defaultValue="1" />.
      Note:
      • You can also set the instance property using <CommandRegistryRetriableProperty defaultValue="true" />.
      • Setting the instance property to 0 or false results in the controller command being not retriable.
      Restriction: The retriable mechanism is encoded in the Struts framework rather than the REST or BOD command frameworks. If a controller command is configured as retriable and is invoked using the Struts framework (BaseAction class) then the retriable mechanism will work and the controller command will be invoked again if it fails due to system errors. However, if the controller command was invoked using the REST or BOD command frameworks, it will not be retried, even though the controller command is configured as retriable.
    3. Set the setRetriable() method to return true.
  2. The retriable property is initialized by the command factory based on the properties defined in one of the above command configurations. This command configuration at runtime can come from the following two locations in the following order of sequence:
    1. CommandRegistryEntry retriable setting is assigned from the retriable properties in the PROPERTIES column of the CMDREG database table, only when that entry exists in the database table.
    2. Otherwise, if an instance property called <CommandRegistryRetriableProperty defaultValue="0" /> or <CommandRegistryRetriableProperty defaultValue="false" /> is defined in the configuration file, then the command factory will use this setting as the default retriable configuration.
    3. Otherwise, the value of retriable defined in the controller command will be used.