package.dist.src.config.topic-configurations.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk Show documentation
Show all versions of sdk Show documentation
Client SDK for Momento services
The newest version!
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lambda = exports.Default = void 0;
const default_momento_logger_1 = require("./logging/default-momento-logger");
const topic_configuration_1 = require("./topic-configuration");
const topics_1 = require("./transport/topics");
const defaultLoggerFactory = new default_momento_logger_1.DefaultMomentoLoggerFactory();
/**
* Default config provides defaults suitable for most environments; prioritizes success of publishing and receiving messages.
* @export
* @class Default
*/
class Default extends topic_configuration_1.TopicClientConfiguration {
/**
* Provides the latest recommended configuration for a default environment. NOTE: this configuration may
* change in future releases to take advantage of improvements we identify for default configurations.
* @param {MomentoLoggerFactory} [loggerFactory=defaultLoggerFactory]
* @returns {TopicConfiguration}
*/
static latest(loggerFactory = defaultLoggerFactory) {
return new topic_configuration_1.TopicClientConfiguration({
loggerFactory: loggerFactory,
transportStrategy: new topics_1.StaticTopicTransportStrategy({
grpcConfiguration: new topics_1.StaticTopicGrpcConfiguration({
numClients: 1,
keepAlivePermitWithoutCalls: 1,
keepAliveTimeMs: 5000,
keepAliveTimeoutMs: 1000,
}),
}),
throwOnErrors: false,
});
}
}
exports.Default = Default;
/**
* Default config provides defaults suitable for AWS lambda or similar environments; relaxes timeouts, disables keep-alives
* to avoid issues with execution environments being frozen and resumed, etc.
* @export
* @class Lambda
*/
class Lambda extends topic_configuration_1.TopicClientConfiguration {
/**
* Provides the latest recommended configuration for a lambda environment. NOTE: this configuration may
* change in future releases to take advantage of improvements we identify for default configurations.
* @param {MomentoLoggerFactory} [loggerFactory=defaultLoggerFactory]
* @returns {CacheConfiguration}
*/
static latest(loggerFactory = defaultLoggerFactory) {
const grpcConfig = new topics_1.StaticTopicGrpcConfiguration({
numClients: 1,
});
const transportStrategy = new topics_1.StaticTopicTransportStrategy({
grpcConfiguration: grpcConfig,
});
return new Lambda({
loggerFactory: loggerFactory,
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