jbmusso / gremlin-javascript

JavaScript tools for graph processing in Node.js and the browser inspired by the Apache TinkerPop API
MIT License
215 stars 62 forks source link

Is it supports the GraphSONMessageSerializerV3d0? #100

Open tibraga opened 6 years ago

tibraga commented 6 years ago

Look my cenarius:

The tinerkpop server conf (serializer)

- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { useMapperFromGraph: graph }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { useMapperFromGraph: graph }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { useMapperFromGraph: graph }}

At log of server, shows below:

[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v1.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0
[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v2.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0
[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v3.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
[INFO] AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0

Before run the code below, In the console tinkerpop, I added one vertex: g.add('test')

When I run this code:

gremlin = require('gremlin');
const client = gremlin.createClient(8182, "localhost", { accept: "application/vnd.gremlin-v2.0+json" });
client.execute('g.V().limit(2)', (err, results) => {
      if (err) {
          return console.error(err)
      }
      console.log(results);
});

It's works. It's shows the log:

[ { '@type': 'g:Vertex',
    '@value': { id: [Object], label: 'test' } } ]

But when changes the option of client (accept) from application/vnd.gremlin-v2.0+json to application/json, happens the below error:

events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: Expected Stream, got object
    at /Users/tiago.machado/temp/node_modules/highland/lib/index.js:3504:26
    at /Users/tiago.machado/temp/node_modules/highland/lib/index.js:1576:9
    at Stream.s._send (/Users/tiago.machado/temp/node_modules/highland/lib/index.js:1532:9)
    at Stream.write (/Users/tiago.machado/temp/node_modules/highland/lib/index.js:1633:18)
    at Stream._send (/Users/tiago.machado/temp/node_modules/highland/lib/index.js:959:26)
    at push (/Users/tiago.machado/temp/node_modules/highland/lib/index.js:1498:19)
    at /Users/tiago.machado/temp/node_modules/highland/lib/index.js:2104:13
    at Stream.s._send (/Users/tiago.machado/temp/node_modules/highland/lib/index.js:1532:9)
    at Stream.write (/Users/tiago.machado/temp/node_modules/highland/lib/index.js:1633:18)
    at Stream._send (/Users/tiago.machado/temp/node_modules/highland/lib/index.js:959:26)

Is the client supports the GraphSONMessageSerializerV3d0?

Thanks!

Tomen commented 6 years ago

Duplicate of #91