Groovy (or Java) frontend Hello World example?

71 views
Skip to first unread message

Ash

unread,
Mar 10, 2017, 9:41:42 AM3/10/17
to Gremlin-users
Hi,

I have been searching for nearly a week and have yet to find an example to work from.  Hoping someone will be able to point me in the right direction. As you can tell, I am new to Gremlin / Titan.

Ultimately what I want to do is the following (or open to suggestions):

Client (JSON) -> AWS Lambda -> Gremlin Server -> Titan-DynamoDB -> DynamoDB

As a POC, I'm trying to create a standalone client as a stand-in for the AWS Lambda step.  I have "Gremlin Console (remote) -> Gremlin Server -> Titan-DynamoDB -> DynamoDB" working fine.

So... How do I get the server to return either 1) an object I can serialize into GraphSON or 2) get the Gremlin Server to return GraphSON?

I am aware of the GraphSON serializer on the server but cannot seem to find an example of calling the Gremlin Server and getting GraphSON.  Or put another way, I see several serializers in the server config but do not understand how to specify one over another.

Can anyone point me to a simple Hello World Groovy (or Java) client -> Gremlin Server example?

Thank you!

-Ash

Stephen Mallette

unread,
Mar 10, 2017, 10:16:34 AM3/10/17
to Gremlin-users
I can imagine that you had trouble finding an example of that specific architecture, but there's documentation for usage of the driver itself for sure:

+ The "Connecting via Java" section of the reference documentation: http://tinkerpop.apache.org/docs/current/reference/#connecting-via-java
+ Perhaps use the gremiln-archetype-server to get started: http://tinkerpop.apache.org/docs/current/reference/#gremlin-archetypes

As for your serialization questions, when you construct the Cluster you just need to specify the serializer you want to use:


That documentation doesn't specify GraphSON serialization but you should get the general idea. For GraphSON basically do:

mapper = GraphSONMapper.build().version(GraphSONVersion.V2_0).create()
serializer = new GraphSONMessageSerializerV2d0(mapper)
cluster = Cluster.build()
                .serializer(serializer)
                .create()

btw, if there is no specific reason you have for wanting to use GraphSON, i would stick with the default of Gryo - it tends to be faster.



--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/711f7ba3-d750-4301-954c-be7404b99299%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ash

unread,
Mar 10, 2017, 12:02:39 PM3/10/17
to Gremlin-users
Stephen,

Thank you for the pointers!

Jason Plurad

unread,
Mar 10, 2017, 2:11:14 PM3/10/17
to Gremlin-users
I think I created this using the gremiln-archetype-server

On Fri, Mar 10, 2017 at 12:02 PM, Ash <ash.ho...@gmail.com> wrote:
Stephen,

Thank you for the pointers!
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages