I have a catalog of Mule 3.9 apps that I need to convert to 4.0+ compliant apps. I have worked through many minor issues but I am stuck on one thing.
Many of these apps use several configuration XMLs to modularize the design. I am having difficulty getting flow references to work when they are in a different XML. In the example here, the reference in dms-document-api.xml to a subflow in dms-document-post.xml is not recognized. (none of those 3 are recognized, but the one I am highlighting is "postDocumentFlow")
<flow name="post:document:dms-document-api-config">
<set-variable variableName="postRequest" value="#[message.payloadAs(java.lang.String)]" doc:name="set saveRequest"/>
<flow-ref name="captureAuditDataSub_Flow" doc:name="captureAuditDataSub_Flow"/>
<flow-ref name="postDocumentFlow" doc:name="postDocumentFlow" metadata:id="96800570-1794-4aa4-9855-a48e054c0cfa"/>
<flow-ref name="publishAuditDataSub_Flow" doc:name="publish Audit Data"/>
</flow>
This is my mule-artifact.json (I have tried with and without paths)
{
"minMuleVersion": "4.9.0",
"javaSpecificationVersions": ["17"],
"configs":[
"./src/main/app/global.xml",
"./src/main/app/audit-client.xml",
"./src/main/app/common-api-handler.xml",
"./src/main/app/dms-document-api.xml",
"./src/main/app/database-api.xml",
"./src/main/app/dms-document-get.xml",
"./src/main/app/dms-document-post.xml",
"./src/main/app/cmis-api.xml"
]
}
I don't know what I don't know, so if there are other files and configurations needed to diagnose my error, please ask and I will edit them back into this question.
The literal error is
Reference to unknown flow or sub flow: "getDocumentFlow"
I tried the suggestion below. After a clean and build there are no problems listed in the "Problems" tab or red Xs on the XMLs in the outline, but the problems still show in the XML editor and the project cannot be launched.
Restarting Anypoint Studio restored the report of the errors in the project view.
You need to import the XMLs in global config to make them visible to your application. Something like this
<import doc:name="Import" file="global.xml" doc:id="..." />
You can refer to this help article: How to call to a shared flow in Mule 4