gremlin-javascript icon indicating copy to clipboard operation
gremlin-javascript copied to clipboard

Is it supports the GraphSONMessageSerializerV3d0?

Open tibraga opened this issue 8 years ago • 1 comments

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!

tibraga avatar Jan 14 '18 12:01 tibraga

Duplicate of #91

Tomen avatar Jan 14 '18 14:01 Tomen