Skip to main content


Mule API Gateway vs Mule Runtime

Pretty confusing to me at first, as i would have thought mule Runtime host mule API Gateway. While that's definitely not the case, API Gateway connects with API Manager to enforce and apply policies / settings like throttling, security, CORS to all your back end services.

Mule Runtime is where all your application gets hosted and run. It takes incoming request, runs the specific flows and returns results.

Recent posts

Tutorial : Mule Creating a simplest flow using Http and Groovy component

In this example, we're going to create the simplest Mule app flow. Our flow basically consist of a Http and a Groovy component which looks like this :-

Using Groovy is optional and entirely up to developers to choose. If you're using it for simple and not so complicated task, then it is fine. Otherwise, Java gives you ability to debug through the code.
Groovy does give you direct access to message which you otherwise need to call getMessage() - [if you are to use java component ].

And here is our script looks like :-

User submits are request like this, http://localhost:3004/?username='jeremy'.

If it is jeremy, great, if not it returns invalid user.

For beginners, it's pretty hard to know what message property and types that are available.
Perhaps picture below would give a better way for newbies to work with mule in the future.

Tutorial : Mule Creating a simplest flow using Http and Java component

In this example, we're going to create the simplest Mule app flow. Our flow basically consist of a Http and a Java component which looks like this :-

User basically connects to something like this :- http://localhost:3003/?username=jeremy.

Query parameter called ussername get pass into java's class and returns "jeremy" or "unknow user" depending on the string passed.

Here is what our java class looks like :-

From the code above, our java class implements mule class callable and we attempted to extract username parameter from 'http.query.params' which is a Map object type. With this, we proceed to get our value by calling get Map's method 

Well, that's it. Done! :)

using mule cxf component

This is by far the coolest way to create a web service, using mule CXF. CXF is a component that allows you to easily create and expose a web service using Mule runtime.

Just create normal java interface and implements it. Cook up some Mule connector and you're good to publish your web service.

Lets create your interface.

Lets create your class. Notice we're not annotating it with @webservice.

Finish it up with the following Mule script :-

After this, we just have to consume this service and gets a return results.

using panda to find value matching certain criteria.

Say you have the following dataframe read into panda.

Id | F1    | F2      | Class
0  | True | True   | 0
0  | True | True   | 1
0  | True | True   | 0
0  | True | True   | 1

To select all the class with value 0 in a data frame, you can use

data.loc[data['Class'] == 0]

Class column name is case sensitive. You won't get anything out of using data['class'].

Mule Http Client Request logging

Best piece of logging i found - literally no code modification. Just add the following code in your log4j configuration file and all your logs will be revealed. :)

<AsyncLogger name="org.mule.module.http.internal.HttpMessageLogger" level="DEBUG" />
<AsyncLogger name="com.ning.http" level="DEBUG" />

Getting started with Credit Card Detection using xgBoost

One fine day i came across this article. Curiously wanted to see if this works, i found a way to quickly setup your machine to run it using docker. Yeap you can setup and run it in 30 minutes time.

All you have to do is install docker and run the following command

docker pull continuumio/anaconda docker run -i -t continuumio/anaconda /bin/bash This install anaconda with python 2.7. Don't worry about this version. Its all good plus xgboost works only on this version.

Additional library you might need to install are

conda install -c bioconda xgboost=0.6a2

conda install pyqt=4
After that, just run python and you can run all the command given in the article. 

django serving static files

In order to serve static files, you need to configure  In this example, say we are hosting our static files under a folder called 'static' (and app) with a filename called index.html.

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['static', 'app'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

And finally set your "" 
from django.conf.urls import url from django.views.generic.base import TemplateView
urlpatterns = [     #url(r'^$', views.index, name='index2…