Justin
Justin

Reputation: 987

WSO2 Iterate mediator does not maintain order even though sequential="true"

I have scenario like ,

  1. Reading unreaded gmail which contains attachment(ie Images)
  2. for iterating over attachment, i have used Iterate Mediator in WSO2 EI
  3. Inserting those each image attachment to Salesforce File Object.

Process works fine. my question here is iterate mediator doesn't maintain the order in which attachment presented in email body even though setting sequential="true" .

<iterate continueParent="true" description="MailIterator" expression="//parts" id="listUnread" sequential="true">
    <target>
        <sequence>
            <property expression="//filename/text()" name="AttachedFileName" scope="default" type="STRING"/>
            <property expression="substring-after(get-property('AttachedFileName'),'.')" name="Attachmentextension" scope="default" type="STRING"/>
            <filter description="check emailSubject" regex="jpg|jpeg|png|gif|webp|tiff|tif|psd|raw|bmp|dib|heif|heic|indd|ind|jp2" source="get-property('Attachmentextension')">
                <then>
                    <property description="emailAttachmentId" expression="//attachmentId/text()" name="uri.var.attachmentId" scope="default" type="STRING"/>
                    <log level="custom">
                        <property expression="get-property('AttachedFileName')" name="=====ValidAttachmentFileName===="/>
                        <property expression="get-property('uri.var.attachmentId')" name="====emailAttachmentId====="/>
                    </log>
                     <!-- Salesforce file object insert process done here  -->
                </then>
                <else>
                    <log level="custom">
                        <property expression="fn:concat('Image format. FileName is:',get-property('AttachedFileName'))" name="===Invalid"/>
                    </log>
                </else>
            </filter>
        </sequence>
    </target>
</iterate>

It process all attachment in some other order which is different from email body attachment order. Kindly anyone clarify this. Thanks in advance.

Upvotes: 1

Views: 504

Answers (1)

Jean-Michel
Jean-Michel

Reputation: 5946

Use call mediator with option blocking="true" to perform synchronous calls

Upvotes: 1

Related Questions