Skip to content

Instantly share code, notes, and snippets.

@ddossot
Created June 13, 2013 01:29
Show Gist options
  • Save ddossot/5770580 to your computer and use it in GitHub Desktop.
Save ddossot/5770580 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:neo4j="http://www.mulesoft.org/schema/mule/neo4j" xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/neo4j http://www.mulesoft.org/schema/mule/neo4j/current/mule-neo4j.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<neo4j:config name="Neo4j" doc:name="Neo4j">
<neo4j:connection-pooling-profile
initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW" />
</neo4j:config>
<flow name="hubway-hotspots" doc:name="hubway-hotspots">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" path="hubway/hotspots" doc:name="HTTP" />
<neo4j:run-cypher-query config-ref="Neo4j"
query="START n=node:locations('withinDistance:[#[message.InboundProperties.lat],#[message.InboundProperties.lon], 0.5]')
MATCH (t)-[:`START`|END]-&gt;n
RETURN n.stationId, n.name, count(*)
ORDER BY count(*) DESC"
doc:name="Query Stations Heat" />
<expression-transformer
expression="(['id':$.get(0),'name':$.get(1),'heat':$.get(2)] in payload.data)"
doc:name="Raw Data to Maps" />
<json:object-to-json-transformer doc:name="Object to JSON" />
</flow>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment