Methods
(async) getConfig(documentDb, docType) → {Promise.<Object>}
- Description:
- returns an object containing config and the timestamp associated with it.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let docType = "mdx-mtmc-analytics";
let configManagerObject = new mdx.Services.ConfigManager();
let result = await configManagerObject.getConfig(elastic,docType);
Parameters:
Name | Type | Description |
---|---|---|
documentDb |
Database | Database Object |
docType |
"mdx-mtmc-analytics" |
Returns:
Config Object along with timestamp is returned
- Type
- Promise.<Object>
(async) initConfig(documentDb, docType, config)
- Description:
- Inserts the initial config into the database.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let docType = "mdx-mtmc-analytics";
let configManagerObject = new mdx.Services.ConfigManager();
await configManagerObject.initConfig(elastic,docType,config);
Parameters:
Name | Type | Description |
---|---|---|
documentDb |
Database | Database Object |
docType |
"mdx-mtmc-analytics" | |
config |
string | A json stringified config object |
(async) update(documentDb, messageBroker, docType, inputConfig) → {Promise.<Object>}
- Description:
- returns a success message once the config has been updated and kafka message is sent.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
const kafka = new mdx.Utils.Kafka({brokers: ["kafka-broker-url"]}, kafkaConfigMap);
let docType = "mdx-mtmc-analytics";
let configManagerObject = new mdx.Services.ConfigManager();
let result = await configManagerObject.update(elastic,kafka,docType,inputConfig);
Parameters:
Name | Type | Description |
---|---|---|
documentDb |
Database | Database Object |
messageBroker |
MessageBroker | MessageBroker Object |
docType |
"mdx-mtmc-analytics" | |
inputConfig |
string | A json stringified config object |
Returns:
A success message is returned
- Type
- Promise.<Object>
(static) getValidDocTypes() → {Set.<string>}
- Description:
- Returns valid docTypes for ConfigManager.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
let result = mdx.Services.ConfigManager.getValidDocTypes();
Returns:
A set containing valid docTypes is returned.
- Type
- Set.<string>