What Can You Mule?

Since starting my job at MuleSoft I’ve had the chance to play with Mule ESB, a tool designed for enterprise level integrations and Anypoint Studio – their visual IDE. While middleware has long played a dominant role in the enterprise field, I don’t think it’s something that many developers play with on a regular basis. But… it should be.

developers are…

I love writing code as much as the next guy, but I would much rather spend my time building something new instead of trying to connect multiple REST APIs and make them play nicely with each other. Larry Wall once said developers are lazy, impatient, and hubris… and that definitely describes me. I want to build amazing things, but I want to show them off as soon as possible (so I can jump into my next project), doing the least amount of work possible (because I’m lazy), while keeping the quality extremely high (I want to take pride in what I build).

my first project

My first project with Anypoint Studio was to build a simple REST API that utilized GitHub’s API to get information on 5 different repositories, including branches, forks, and commits. What I couldn’t believe was that 10 minutes later I was done. Yes, you heard that right, 5 repos, 3 end points per repo, and it took me 10 minutes. Oh and that also included endpoints for followers and following!!! In 30 minutes I had it published with a developer portal using Mule Studio’s Anypoint API tools and RAML.

But I am digressing. I wanted to do something even more. I wanted to incorporate GitHub into my social networks. What if every time I pulled in a merge I could notify people via text message using Twilio, post a status to Twitter, let my friends on Facebook know about it, and while we’re at it why not throw something on LinkedIn and send an email blast to my subscribers on Marketo. Yeah, I know what you’re thinking… this is a really bad idea – or a really good way to lose friends!

Now think about that for a few minutes, how much effort is building an application to do all of that going to take? Sure we can use a webhook from GitHub, that’s pretty easy, but we will need to connect to five different APIs and pass data along to each of them while checking their response. I don’t know about you, but I don’t know how all five API’s work, so I’m going to need to do a little bit of reading and digging, and a little bit of testing and the way I wrote code – a lot of debugging!

To make it even more complicated, let’s say we need to get more information from GitHub, so now we’re adding a new API to the mix. That’s right, six APIs in a single call, handling and modifying the data for each.

So what’s your estimate? A couple hours? A day? Several days? 5 minutes?

let’s build it

Using MuleSoft’s Anypoint Studio I had the schema built in less than 2 minutes, and all I needed to do was plug in my API key/ Access token for each of the different providers and add the message I wanted to send.

What makes Anypoint Studio so easy to use is that all of these services are available as Connectors, meaning that rather than having to dig through their documentation you can select the endpoint or action from a dropdown list, see exactly what fields are needed for that endpoint, and fill in their values all through the GUI interface. For example, for the Twilio connector I just put in my api key/ access token in the “Config Reference” section and then add the account SID, the message, who it’s from, and who it’s to. Done- I just connected to Twilio – and it didn’t even take me 5 minutes (sorry Keith!).

the caveat

So is MuleSoft the easiest tool to use in the whole wide world or what? Ok, it’s actually or what. Anypoint Studio is designed for MuleSoft’s enterprise edition, so you’ll need to install the community runtime, and you’ll also need to install the community runtime on the server you want to deploy your application to. And there’s still a limited number of connectors (although now’s a good time to play with it, because I have it on good authority that number is going to explode soon).

But as more and more API’s come into existence, we may just find that tools like Mule ESB and Anypoint Studio bring middleware into everyday applications – simplifying integrations, helping to reduce development time, bugs, and headaches, and letting all of us focus on writing the code that we want to.

Wow, thank you so much for this post. This is DAY#1 with Mulesoft and this post bridged the GAP from not knowing how to start to; knowing I need to install the Anypoint studio and point it to the community edition.