Harlan T Wood
Harlan T Wood

Reputation: 2434

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!

Upvotes: 2

Views: 909

Answers (2)

pantalohnes
pantalohnes

Reputation: 1046

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.

Upvotes: 4

stephen mallette
stephen mallette

Reputation: 46226

OrientDB has LiveQuery though I don't know that it integrates with Gremlin - https://orientdb.com/docs/2.1/Live-Query.html - that's the closest thing I know of to this kind of feature in any TinkerPop-enabled graph database

Upvotes: 1

Related Questions