Unable to reference a sub-flow present in another file mule 4 - mule

I am trying to reference a flow/sub-flow from one file to another in mule 4 but keep getting the error "flow-ref at test.xml:76 is pointing to genericFlow which does not exist"...during deployment.... even though the anypoint studio is able to find it...
Edit:
I have been able to solve this problem.
I found that the flow I was referring had a problem due to which it was not getting initiated or something....The problem was that I was using && instead of "and" as relative operator....after fixing that it worked fine....

The flow ref name shouldn't include the name of the file, once the file is included into the mule-artifact.json in the "configs" array property. You should reference the sub-flow by doing <flow-ref name="{nameofthesubflowontheotherfile}">
Take in mind that you cannot have flows or subflows with the same name

Related

CommandBox Lucee shows error: Method Code too Large

I'm getting an issue in Lucee when my file size is greater than 64KB, it shows an error "Method code too large!".
I also attached a screenshot below, please check and help me to resolve this issue.
Lucee obviously has a limit regarding the size of methods. The error message already provides all the information you need.
You should split up your code into several files. This can be done by moving out parts into different templates, i.e. CFM files, and then include them in your main CFM via <cfinclude>. Or alternatively, you can move the code into components, i.e. CFC files and instanciate them via createObject() in your main CFM.

How can I run some code in the event that a watched folder does not exist?

I have a Mule 4 flow that uses the [File] On New or Updated File event source. This element is configured to wait for file changes within a specific folder.
When I deploy my flow, and the deployed application does not have access to the specified folder, a log message is generated and the flow terminates. However, I'd like to add some additional processing in this case. (I'd like to log a message to an alternative event log).
I tried adding an On Error Propagate element to the flow, but this is not triggered when the error occurs - I think this is because the error is a system error rather than a messaging error.
If I could add a step before the On New or Updated File element, then I could check for the existence of the folder, and execute that extra code there - but I see no way to do that either.
Well, I was able to do something that "works". I created another flow that runs on a (long) timer, which runs immediately and checks for the existence of the folder by attempting to list its contents. If that fails, then the On Error ... block of that flow is reached, because in this case the error is treated as a messaging error rather than a system error.
Not an ideal solution, but a solution nonetheless.
May I suggest that you monitor folder which should contain none existing folder?
For exmple you want to monitor /one/two/three/abc.txt. three does not exist. Watch two for new and updated files.

How to remove all the properties (INVOCATION/INBOUND/OUTBOUND/SESSION) in a specific scope in mule

I am having a problem where my rabbit mq message put is erroring and it does not tell me what the root cause for the put failure is. Looking at stackoverflow, I see that my problem is identical to what was reported here-to store a message in rabbitmq from mule-as far as exception goes.
Now I am trying to find out if there is a way to remove all the properties present in the message or if the removal can be performed per scope (i.e. INVOCATION/INBOUND/OUTBOUND/SESSION). Reason being, I dont know which property, if at all, is causing this.
I did look at <remove-property> & <message-properties-transformer> but they work on a specific property only (& not all).
are you sure that <remove-property> works on specific properties only? i recall using this transformer with a wildcard to achieve something similar to what you are trying to do:
<remove-property propertyName="*" doc:name="Property"/>
You could do it with this inside a Groovy Transformer:
import org.mule.api.transport.PropertyScope
message.getPropertyNames(PropertyScope.OUTBOUND).each {p -> message.removeProperty(p, PropertyScope.OUTBOUND)}
I would be looking at scopes OUTBOUND and SESSION, as the other scopes shouldn't be propagated over a transport boundary.

how to create an output file based on xml data in mule

Im very new to mule so hopefully someone out there can help me out. Im trying to create an output based on a content in my xml
Ex
<Header>
<UniqueID>AAA_12345</UniqueID>
</Header>
Id like the filename to be the the UniqueID ie AAA_1245.xml
I found a few syntax on the net but it doesnt work for me. My syntax is
<file:outbound-endpoint path="${cwMessagesPath}/out" outputPattern="#[xpath:/Header/UniqueID].xml" connector-ref="cwksbDefaultFileConnector" />
for some reason, mule creates #[xpath: as a directory, Header as another directory and then the filename as UniqueID].xml
Im using mule 2.2.1
Thanks for your help.
This should work.
Is cwksbDefaultFileConnector configured in any specific manner?
Also, I think in Mule 2 it was possible to configure other placeholders than #[ ] for expressions. Are expressions working with this syntax elsewhere in your application? If yes, then the problem is different.
Do you run standalone or embedded? If embedded, make sure you have the mule-module-xml dependency in your project's POM.
Finally, what is the payload type of the message that hits the file:outbound-endpoint? Maybe some manual transformation is needed in Mule 2 before using XPath.

Apache-ODE ProcessManagement

I can access this API/WS through
http://localhost:8080/ode/processes/ProcessManagement?wsdl.
I would like to get the Process Info of a Process through this service and active it.
The serivce has the matching operations getProcessInfo and activate.
With listAllProcesses I get all Processes of a delpoyed package.
For getProcessInfo/activate I need the Process pid.
I get a <ns:pid>, using this gets me a load of Exceptions.
Using the name of the process and other stuff I receive earlier doesn't work either.
The pid is of type QName, perhaps thats the root of the problem.
However I don't now how to typecast here.
(Tried all with the eclipse Web Services Explorer and soapUI)
question: How does a proper request for both Operations look like?
When I try to consume the webservice with axi2 via eclipse, there is a undeclared variable local in the AnySimpleType class. I'm not keen on using the service this way.
But since I'm already writing a Client for the DeploymentService I thought about this approach.
question: How do I properly access the ProcessManagement?
EDIT: I have a simular problem with the DeploymentService and the undeploy Operation.
EDIT2: I figured the Problem with the DeploymentService undeploy out.
I had to get the Packagename as String. Then a made a javax.xml.namespace.QName out of it. Then I used the setPackageName of said undeploy operation.
Answer to question number 1:
soapUI with listAllProcesses returns
<ns:pid>{ode/bpel/unit-test}HelloWorld2-1</ns:pid>
getProcessInfo wants
<pmap:getProcessInfo>
<pid>?</pid>
</pmap:getProcessInfo>
Now I replaced <pid>?</pid> with
<pid xmlns:odetest="http://ode/bpel/unit-test">odetest:HelloWorld2-1</pid>
and it worked like a charm.
I remember that there was an issue with parameter ordering when using the Axis2 generated WSDL. Could you try if building a request against the original WSDL located at http://localhost:8080/ode/deployment/services/ProcessManagement works?
EDIT: Now that I got the question correctly, the problem is that ODE expects the QName to be serialized differently, i.e. in the XML way instead of the Java way. Thus, instead of <ns:pid>{ode/bpel/unit-test}HelloWorld2-1</ns:pid> the correct notation is <ns:pid xmlns:odetest="ode/bpel/unit-test">odetest:HelloWorld2-1</ns:pid>.