microsoft / spring-data-gremlin

We are in the process of deprecating Spring Data Gremlin. -- Provide generic annotation oriented programming form based on gremlin for graph database
Other
129 stars 76 forks source link

Cannot deserialize response with any Serializer except `GRAPHSON` #240

Closed ghost closed 3 years ago

ghost commented 4 years ago

Expected Behavior

When running the web-service example, I expect to be able to use any of the enum values specified in org.apache.tinkerpop.gremlin.driver.ser.Serializers as a value for the serializer parameter of the GremlinConfig.

The fact that this parameter is configurable and not, for example, hard-coded in GremlinFactory leads me to believe that it should be possible to use any of the serializers supported by gremlin-driver 3.2.x. However, if we look at GremlinResultVertexReader and AbstractGremlinResultReader this doesn't seem to be the case.

Current Behavior

Using the "steps to reproduce" below:

I didn't bother testing GRYO_LITE_V1D0 as this is not supported by the platform I want to use in production.

Possible Solution

Unknown.

Is it the intention of this project to support multiple serialization methods?

Steps to Reproduce (for bugs)

  1. Setup Gremlin server:
    1. Download and install Gremlin Server 3.3.8
    2. Run Gremlin Server with the config provided below.
  2. For each value in org.apache.tinkerpop.gremlin.driver.ser.Serializers:
    1. Setup Spring Data Gremlin:
      1. Edit examples/web-service/src/main/resources/application.yml to use endpoint: localhost and port: 8889.
      2. Change serializer to the serializer under test.
      3. Build web-service example (I used mvn clean package)
    2. Run Gremlin Server: bin/gremlin-server.sh conf/gremlin-server-ci.yaml
    3. Run the example:
      
      $ cd examples/web-service/target
      $ java -jar spring-data-gremlin-web-service-0.0.1.BUILD-SNAPSHOT.jar
    4. Attempt to save something: curl -X PUT -H "Content-Type: application/json" -d '{"id": "1234"}' http://localhost:8080/services/

Snapshot Code for Reproduce

https://github.com/microsoft/spring-data-gremlin/tree/master/examples/web-service

Gremlin server config:

host: localhost
port: 8889
gremlinPool: 8
threadPoolWorker: 8
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: { graph: conf/gremlin-server-ci.properties }

scriptEngines: {
  gremlin-groovy: {
    plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
               org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}

serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { serializeResultToString: true }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0] } }
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0] } }
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0] } }
ssl: { enabled: false }

gremlin-server-ci.properties:

gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
gremlin.tinkergraph.vertexIdManager=ANY

Branch

Your Environment

saragluna commented 4 years ago

Thanks for reporting this. GRAPHSON is indeed the only serializer we currently support. We will consider this and if this feature is important for you, welcome to contribute.

chenrujun commented 3 years ago

Closing this issue. Because it's not active for a long time. If anyone have similar issue, please create issue in new repo: https://github.com/Azure/azure-sdk-for-java/issues