The new connector, presented in this blog, allows Mule users to leverage the incredibly rich API that Neo4j offers with convenient configuration elements.

Mule has a very extensive support for NoSQL data stores, which covers pretty much the whole spectrum of what’s available out there, from key/value stores to document-oriented databases. The only piece that was missing in the puzzle was connectivity to a  database: with the introduction of the Neo4j connector, the gap is now closed. Popularized by the advent of social media, the need for efficiently storing, indexing, traversing and querying graphs of objects has become prominent in less than a decade. During this time, Neo4j has risen to the number one graph database on the market, with successful deployments across all types of industries and a strong commitment to open source. The new connector, presented in this blog, allows Mule users to leverage the incredibly rich API that Neo4j offers with convenient configuration elements. Read on to discover a simple example built with this connector.

Loading sample data in Neo4j

In this example, we will use the dataset that Neo4j made public for the Hubway Data Challenge (Hubway is a bike sharing service which is currently expanding worldwide). We will expose a Cypher query as a basic HTTP resource: this query will let the caller retrieve the nearby Hubway stations and how “hot” they are (ie how much trips started or ended at these stations).
  1. Download the dataset:
  2. Stop your Neo4j server
  3. In case you care, back-up your existing data, ie the /path/to/neo/data directory
  4. Extract the zip file into /path/to/neo/data/graph.db
  5. Start the server again
  6. Browse the Neo4j dashboard and confirm you have ~500K nodes loaded as shown below:

Getting Mule Studio Ready

The Neo4j module doesn’t come bundled with Mule Studio so we have to install it first. For this, we have to do the following:
  1. Open Mule Studio and from “Help” menu select “Install New Software…”. The installation dialog – shown below – opens.
  2. From “Work with” drop down, select “MuleStudio Cloud Connectors Update Site”. The list of available connectors will be shown to you.
  3. Find and select the Neo4j module in the list of available connectors.
  4. When you are done selecting the Neo4j module, click on “Next” button. Installation details are shown on the next page. Click on “Next” button again and accept the terms of the license agreement.
  5. Click on “Finish” button. The Neo4j module is downloaded and installed onto Studio. You’ll need to restart the Studio for the installation to be completed.

Setting up the project

Now that we’ve got Mule Studio up and running, it’s time to work on the Mule Application. Create a new Mule Project by clicking on “File > New > Mule Project”. In the new project dialog box, the only thing you are required to enter is the name of the project: use “neo4j-example” or similar. You can click on “Next” to go through the rest of pages. Read the full Article