2

We currently have our mule projects organized where we have our mule flows in several flow files. We find that this helps in allowing us to reuse flows. However, it has an added side-effect. By having dependencies amongst other flow files, we are finding that our munit tests now have to load an extensive number of flow files that slows up our munit tests because we have to load many more files. We also don't want to stick our flows into one huge file either.

We want to know if there is a happy medium or a strategy with how we should be splitting our flow files so that it minimizes the impact of performance when it comes to tests and application loading?

Thanks,

Juan

jcb
  • 195
  • 1
  • 4
  • 20

2 Answers2

1

I suggest that you use a general global configuration xml, where you place all your configurations and endpoint connectors. That way, you will only load the global.xml and not every other flow you are referencing.

Global.xml contains:

<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> 
<http:request-config name="REST_Request_Configuration" host="localhost" port="80" basePath="example" doc:name="HTTP Request Configuration"/>
<http:request-config name="REST_Request_Configuration2" host="google.com" port="80"  doc:name="HTTP Request Configuration" basePath="/translate/v2">

On your test suite you only need to load one classpath/xml:

<spring:beans>
        <spring:import resource="classpath:global.xml"/>
        <spring:import resource="classpath:workflow_you_are_testing.xml"/>
</spring:beans>

Hope this helps.

1

I'd define the default mule-config.xml, with the connector configurations and flow file for each task in the project. Doesn't necessarily mean each flow file will contain single flow but flows related to same task conainining sub-flows or private flows as needed. However, the flow functionality which is reuseable like alert emails, database operations, put that in separate commons-config.xml flow file.

For unit-testing, I'd create another mule-test-config.xml under src/test/resources to contain mock connectors like database or any other. The connectors to use as it is like http or some other, copy them as it is to mule-test-config.

Now to test particular flow, you'd need flow file + mule-test-config + commons-config (if any shared flow)

Charu Khurana
  • 4,511
  • 8
  • 47
  • 81