Search code examples
graph-databasesgremlingremlin-serverjanusgraph

How can I get realtime streaming updates to a Gremlin query?


I fell in love with realtime streaming updates to a query when I was using Firebase, RethinkDB and similar. Now that I am working with graph databases via Gremlin, I'm wondering how to get this behavior.

As a trivial example, if I specified a gremlin query like:

g.V().values('name')

I'd like to receive an update when a new vertex is added with a name property, or a name is changed on an existing vertex.

I am beginning to use Janusgraph, so the ideal solution would work there -- but this is such a killer feature that I could be swayed to other Gremlin-friendly graph databases.

Thanks!


Solution

  • You could use an EventStrategy with any Tinkerpop compatible graph database. Once you create the event strategy, you add it to your traversal g = graph.traversal().withStrategies(strategy). You'll need to implement the MutationListener interface to do whatever you'd like to on those events.