How do I add global variables to an embedded Gremlin server instance?
Also, I want to avoid loading the server configuration from a file, although I can load resources from the classpath.
How do I add global variables to an embedded Gremlin server instance?
Also, I want to avoid loading the server configuration from a file, although I can load resources from the classpath.
getGlobalBindings()
onGremlinExecutor
is indeed deprecated, but the javadoc explains how you should proceed:That comes from the 3.2.5 javadoc when it was originally deprecated in preparation for pretty large changes in 3.3.0 when new interfaces were implement to better generalize the
GremlinScriptEngine
. While these new interfaces were defined for default use in 3.3.0, they are actually present in 3.2.x and may be used there. Note that thegetGlobalBindings()
method was actually removed completely in 3.3.0 so when you upgrade you will end up with compilation errors.Where there may be some confusion with respect to that javadoc comment is that to use the
getScriptEngineManager()
you must also use what is the default 3.3.0 yaml configuration on the 3.2.x line of code...an example is shown here:https://github.com/apache/tinkerpop/blob/3.3.0/gremlin-server/conf/gremlin-server-classic.yaml#L25
Note that under this new model, you have two other options for adding global bindings...you could also either:
BindingsGremlinPlugin
to add global bindings programmaticallyGremlinPlugin
instance to add your bindingsLooks like we can do it this way, although
getGlobalBindings()
is deprecated.