Connection pool setting in node.js app which connects to Azure GraphDB and query using gremlin

389 views Asked by At

Following this tutorial where a node.js app connects to Azure cosmos - GraphDB and query the GraphDB using gremlin https://learn.microsoft.com/en-us/azure/cosmos-db/create-graph-nodejs

Created an app.js as below. This is working fine. I can submit a gremlin query and get the result. Can I set a connection pool using this gremlin library? I couldn't find any source on how to set up a fixed number of the connection pool and use a connection from the pool and send the connection to the pool back after getting a result or after a fixed time out delay.

package.json

"gremlin": "^3.3.4"

app.js

const gremlin = require('gremlin');

const endpoint = 'endpoint';
const port = 'port';
const username = 'username';
const password = 'password';

const url = `wss://${endpoint}:${port}/gremlin`;

const authenticator = new gremlin.driver.auth.PlainTextSaslAuthenticator(
    username,
    password
  );

graphDBClient = new GremlinClient(url, {
    authenticator,
    traversalsource: 'g',
    rejectUnauthorized: true,
    mimeType: 'application/vnd.gremlin-v2.0+json'
  });

graphDBClient.submit(gremlinQuery);
0

There are 0 answers