How do I use Gremlin sessions in Neptune?

I'm trying to use Gremlin sessions with Amazon Neptune. I can execute bytecode queries fine outside of a session, and I can run string queries on a sessioned client, but attempting to run a bytecode query with a sessioned client results in this error:

"code":"MalformedQueryException",
"detailedMessage":"Message with op code [bytecode] is not recognized."

I've followed the AWS documentation exactly.

Cluster cluster = Cluster.build().with {
    addContactPoint('host')
    port(8182)
    enableSsl(true)
    serializer(Serializers.GRAPHBINARY_V1D0)
    create()
}

def client = cluster.connect('session ID')

println client.submit('g.V()').all().get() // works

println traversal().withRemote(DriverRemoteConnection.using(client))
    .V().iterate() // returns the error above

println traversal().withRemote(DriverRemoteConnection.using(cluster))
    .V().iterate() // works, without a session

I'm using Gremlin 3.4.8. How do I get this working?

Upvotes: 1

Views: 652

Answers (1)

stephen mallette
stephen mallette

Reputation: 46216

Bytecode based requests are simply not supported in Neptune (or even Gremlin Server itself as the reference implementation). The primary reason for this disparity is that TinkerPop has not wanted to promote the use of sessions any further than it was already in use. TinkerPop largely constructed sessions for the narrow use case of tool support - e.g. Gremlin Console remote connectivity, visualization toolkits and graph analysis tools. However, given the weak support for remote multi-request transactional use cases in Gremlin, users have expanded on session usage as a way to work around that weakness.

I sense that this expansion will perhaps force TinkerPop to provide bytecode support in sessions, but nothing is decided as of this time. The alternative would be to improve support for transactions, but that may be impossible within the scope of TinkerPop 3.x given the nature of such a change.

For now, if you wish to use sessions, you can only submit scripts.

Upvotes: 1

Related Questions