[midPoint] errorHandling controlFlow for tasks

Ivan Noris ivan.noris at evolveum.com
Thu Jan 12 12:23:02 CET 2023


Could you try with iterative scripting instead?

Activity (without error handling) with iterativeScripting example:


     <activity>
         <work>
             <iterativeScripting>
                 <objects>
                     <type>UserType</type>
                     <query>
                         <filter 
xmlns="http://prism.evolveum.com/xml/ns/public/query-3" 
xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3">
                             <ref>
<path>archetypeRef</path>
                                 <value 
oid="7135e68c-ee53-11e8-8025-170b77da3fd6"/>
                                 <!-- Employee Archetype -->
                             </ref>
                         </filter>
                     </query>
                 </objects>
                 <scriptExecutionRequest>
                     <s:action 
xmlns:s="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3" 
xmlns:scext="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3">
<s:type>execute-script</s:type>
                         <s:parameter>
                             <s:name>script</s:name>
                             <c:value 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:type="c:ScriptExpressionEvaluatorType">
                                 <c:code>
                         log.info('PRINTING OBJECT PROPERTIES: Name: {}, 
Given name: {}, Family name: {}',
                         input.getName(), input?.getGivenName(), 
input?.getFamilyName())
                 </c:code>
                             </c:value>
                         </s:parameter>
                     </s:action>
                 </scriptExecutionRequest>
             </iterativeScripting>
         </work>
     </activity>

Best regards,

Ivan

On 12. 1. 2023 12:19, Yakov Revyakin wrote:
> <task 
> xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" 
> xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" 
> xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" 
> xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3" 
> xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" 
> xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" 
> xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> oid="207e057f-d5fc-4523-ad76-ccf2401291ba" version="91"> <name>Test CSV Downloader</name> <assignment> <targetRef 
> oid="00000000-0000-0000-0000-000000000508" relation="org:default" 
> type="c:ArchetypeType"/> </assignment> <executionState>runnable</executionState> <schedulingState>ready</schedulingState> <category>BulkActions</category> <binding>loose</binding> <schedule> <recurrence>recurring</recurrence> <interval>30</interval> <misfireAction>reschedule</misfireAction> </schedule> <activity> <work> <nonIterativeScripting> 
> <scriptExecutionRequest 
> xmlns:s="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3"> 
> <s:execute> <s:script> <code> throw new java.lang.Exception("Configuration error")
>                              </code> </s:script> <s:forWholeInput>true</s:forWholeInput> </s:execute> </scriptExecutionRequest> 
> </nonIterativeScripting> </work> <controlFlow> <errorHandling> <entry> 
> <situation> <errorCategory>configuration</errorCategory> <status>fatal_error</status> </situation> <reaction> <retryLater> <initialInterval>PT1M</initialInterval> <nextInterval>PT1M</nextInterval> <retryLimit>3</retryLimit> </retryLater> </reaction> </entry> </errorHandling> 
> </controlFlow> </activity> </task>
>
> On Thu, 12 Jan 2023 at 13:00, Yakov Revyakin <yrevyakin at gmail.com> wrote:
>
>     At least for 4.4.3 it doesn't work this way. My task includes
>
>     <controlFlow> <errorHandling> <entry> <situation> <errorCategory>configuration</errorCategory> <status>fatal_error</status> </situation> <reaction> <retryLater> <initialInterval>PT1M</initialInterval> <nextInterval>PT1M</nextInterval> <retryLimit>3</retryLimit> </retryLater> </reaction> </entry> </errorHandling>
>     </controlFlow>
>
>     But the task becomes suspended right after the first error. Status
>     of the task becomes "Fatal Error"
>     I have set enableExperimentalCode to true.
>
>
>     On Thu, 12 Jan 2023 at 10:24, Ivan Noris via midPoint
>     <midpoint at lists.evolveum.com> wrote:
>
>         Hi Yakov,
>
>         have you tried
>         https://docs.evolveum.com/midpoint/reference/tasks/task-error-handling/#triggers-2
>
>         example? Perhaps you are missing the errorCategory.
>
>         Please see also the whole documentation page.
>
>         As the feature is marked Experimental, you may have also hit
>         some of its
>         limits. I remember it worked according to the samples for Live
>         sync task
>         for sure.
>
>         Best regards,
>
>         Ivan
>
>         On 11. 1. 2023 18:06, Yakov Revyakin via midPoint wrote:
>         > Hi all,
>         > It is not clear how to configure retry for a task.
>         > I have a task which got fatal_error because of an incorrect
>         accessKey
>         > for an external resource. The task is suspended after the error.
>         > I'd like to have another behavior - task must retry attempt
>         to execute
>         > after a minute.
>         > I configured errorHandling in the activity section but still
>         have the
>         > same result - the task is suspended after an error and there
>         is any
>         > retry. What's wrong?
>         >
>         >     <activity>
>         >     .......
>         >         <controlFlow>
>         >             <errorHandling>
>         >                 <entry>
>         >                     <reaction>
>         >                         <retryLater>
>         > <initialInterval>PT1M</initialInterval>
>         > <nextInterval>PT3M</nextInterval>
>         > <retryLimit>3</retryLimit>
>         >                         </retryLater>
>         >                     </reaction>
>         >                 </entry>
>         >            </errorHandling>
>         >         </controlFlow>
>         >     </activity>
>         >
>         > _______________________________________________
>         > midPoint mailing list
>         > midPoint at lists.evolveum.com
>         > https://lists.evolveum.com/mailman/listinfo/midpoint
>
>         -- 
>         Ivan Noris
>         Expert Identity Engineer
>         evolveum.com <http://evolveum.com>
>
>         _______________________________________________
>         midPoint mailing list
>         midPoint at lists.evolveum.com
>         https://lists.evolveum.com/mailman/listinfo/midpoint
>
-- 
Ivan Noris
Expert Identity Engineer
evolveum.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20230112/c9027fdc/attachment-0001.htm>


More information about the midPoint mailing list