Search code examples
methodsstartupgremlintitanrexster

Load methods on bootup, Aurelius Titan with Rexster


Is there a way to load gremlin methods into the rexster/Titan on bootup?

This way I don't have to resend these methods each time I want to use them via rexpro. Currently I do stuff like this (trivial example):

rexpro_client.execute("def some_method(a){a.outE.count()}\n some_method("+some_variables+");")
rexpro_client.execute("def some_method(a){a.outE.count()}\n some_method("+some_variables2+");")
....

Which is obviously not efficient when executing this multiple times.

For extra clarification: I would obviously like to have my some_method pre-defined so I could simply do this in stead:

rexpro_client.execute("some_method("+some_variables+");")
rexpro_client.execute("some_method("+some_variables2+");")

Solution

  • See Rexster Configuation.

    The <init-scripts> element defines one or more comma-separated script files that gets executed at the initialization of a Gremlin Script Engine. The initialization allows for the creation of user-defined steps and functions to be made available.

    Cheers, Daniel