Saturday, February 16, 2013

CRaSH for Mule, an introduction

This blog is the formal introduction to the CRaSH console for Mule on which I've been working for the past month or so. I've decided to interview myself about it because, hey, if I don't do it, who will?

What is CRaSH for Mule?

It is a shell that is running embedded in Mule and that gives command-line access to a variety of Mule internal moving parts. It's built thanks to the excellent CRaSH project, a toolkit built by Julien Viet and sponsored by eXo Platform, which allows the easy creation of embedded shells.

What can we do with it?

Well, it's easy to find it out. Let's connect to CRaSH for Mule and ask for help:



As you can see the range of actions include gathering information, like statistics and names, but also performing actions, like restarting a connector or even stopping the broker.

Why is it better than JMX?

Behind the scene CRaSH for Mule relies on JMX so anything you can do with it could be done with direct JMX interactions (like with JConsole or jmxterm). This said CRaSH for Mule has many advantages over raw JMX, including:

  • Adds Mule semantics to JMX. You do not need to fiddle with lengthy object names do achieve what you want: CRaSH for Mule builds the right object names based on your actions.
  • Provides auto-completion, this for application names and commands.
  • Supports connectivity over telnet and ssh. No need for baroque JMX RMI connection strings.
  • All the other CRaSH commands are available. The default set of commands is very rich: to name a few, it comes complete with commands for dealing with the system, the JVM, JDBC and JNDI.

How does it compare to MMC?

Well, it doesn't! The Mule Management Console is way more capable and feature-laden, and comes bundled with the Enterprise Edition of Mule.

CRaSH for Mule focuses on admin-oriented command-line friendly interactions with Mule. And it is fully open sourced.

How do I install it?

Navigate to CRaSH's homepage and locate the Mule distribution download link. You'll get an archive that contains different files, including crash-mule-app.zip that you need to drop in your Mule broker apps directory. This application contains a readme file that explains how to configure it, should the default configuration not satisfy you. You can also read it online.

CRaSH for Mule 1.2.0-cr6-SNAPSHOT has been tested on Mule CE 3.3.1 and EE 3.3.1.

Got into trouble?

Report issues or open feature requests directly to CRaSH's JIRA.

5 comments:

Anonymous said...

I'm intrigued by this,

so in short does this mean that you cannot:
Deploy an application,
Start an application,
Stop an application
Redeploy an application
Start a flow
Stop a flow
?

However can it be expanded to do so?

Regards.

Sam Lloyd said...

Hi,

Excellent little tool.

Out of interest, can it stop and start individual flows?

David Dossot said...

You can start, stop and dispose an application. See: https://github.com/crashub/crash/blob/master/packaging/src/main/mule/classes/crash/commands/base/mule.groovy#L147

There's no support for un/re/deploying an application, nor starting nor stopping a flow. Pull requests are welcome :)

Sam Lloyd said...

David,

Thank you, I'm definitely going to take this work further. Have you looked at creating a shell script that allows someone to run a sequence of commands?

For example, I am currently looking at creating a Start up script that, Stops an application, prints out the information, starts it up again and then produces info and statistics.

I'm wondering if anything similar currently exists?

Thanks,
Sam :)

David Dossot said...

Sam, for this, I suggest you use Expect: http://www.nist.gov/el/msid/expect.cfm

With Expect, you can script interactions with other CLI apps, so you can use it with CRaSH.