Saturday, February 22, 2014

Run Mule ESB as a service on Windows

After downloading/extracting standalone version:

  • open a command line window (cmd.exe) as administrator
  • navigate to Mule bin directory
  • run mule install
  • check in Services that a service with Mule name exists; start the service
  • place any Mule packages (zip archive) in apps directory and wait for the deployment to occur (a subdirectory with exploded package content is created and a text file <package name>-anchor.txt is present)
  • you can control the service by running mule [start|stop|restart]
When running Mule as a service by default current path is set to the root directory of the expanded standalone package (on the same level with bin, apps, logs, etc) so if we have defined in log4j.properties
log4j.appender.MyLog.File=logs/MyLog.txt
teh MyLog.txt file will be created in logs subdirectory of the installation along with Mule standard log files (mule.log, etc)

Just supposing/not tried with Mule:  you can change the working path by adding an entry to conf/wrapper.conf, something like:
  • wrapper.working.dir="%MULE_HOME%/workingDir"

Be aware: if at start-up there are some unrecoverable errors Mule will try to undeploy the application by also deleting the exploded directory; since the original zip package was already deleted this means that your application will never be launched. To be more explicit:
  • we have a Mule application that uses as inbound endpoint an ActiveMQ JMS queue that is configured (by default) without the reconnect-forever option and with for the connector it references
  • First time when we configure Mule as a service the ActiveMQ broker is up so the application is deployed fine and works as expected
  •  For some maintenance activities we restart the server. Suppose that the Mule service comes up before ActiveMQ; the application start-up will fail and application will be deleted. The failure is due to the fact that Mule tries to activate the connector even before the flow that references it it is started.

3 comments :

  1. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..

    Mulesoft online course hyderabad

    ReplyDelete
  2. This Blog Provides Very Useful and Important Information. I just Want to share this blog with my friends and family members. Mulesoft certification training

    ReplyDelete