Loading

How to specify application Startup or Shutdown order in an Hybrid Mule Sever.

Fecha de publicación: Mar 2, 2024
Tarea

GOAL

You have multiple applications deployed in a Hybrid Mule server and you need to define the order of precedence in which they are started up. The default deployment order is to deploy the application in alphanumeric order, which can be used to define a set order, but you will need to rename the applications to achieve this. 
Pasos
For Startup - You have two alternatives.

1) Use the -app command line switch when starting the Mule server:
mule -app app1:app2:app3
This solution applies to all versions of Mule 3 and 4. "app1" should be replaced by the name of the application as defined in for the application's folder under the MULE_HOME/apps folder.

2) Use the following system property:
-Dmule.deploy.applications=app1:app2:app3
This solution applies to Mule 4 only.  You can add this system property to the command line when starting up the Mule server:
mule -M-Dmule.deploy.applications=app1:app2:app3

or add the property to the server's  wrapper.conf file:
wrapper.java.additional.<n>=-Dmule.deploy.applications=app1:app2:app3
where <n> needs to be the first contiguous integer after the ones that are already used in the file (this is quite important or the property will not be seen). Please refer to How can I set Mule and Java system properties at startup? for further information on setting system properties. The ability to define the order as a system property has the obvious advantages of being available
in the JVM and of being definable once and for all in the wrapper.conf server configuration file.

The caveat to this property is that it is restrictive. Only applications defined in the property will be deployed, with any unspecified applications being ignored at deployment time. For example, if you have app1, app2, app3 and app4 under MULE_HOME/apps folder and you set mule.deploy.applications=app4:app2 then only app 4 and app2 will be deployed and it that order.

For Shutdown - There is currently no equivalent property that can be specified to achieve a specific deployment shutdown order. It is possible to use API calls to shut down the applications following How to Start/Stop/Restart an Existing Hybrid Application Using Rest API, but this requires manual scripting.

There is an open Idea with in IdeasExchange to add a similar property to stop a Mule application before the rest of the applications. Please consider upvoting this Idea, if you'd like to have this option. 



 
Número del artículo de conocimiento

001114570

 
Cargando
Salesforce Help | Article