Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("server should create a subscription (CreateSubscriptionRequest)", function (done) {
// CreateSubscriptionRequest
var request = new subscription_service.CreateSubscriptionRequest({
requestedPublishingInterval: 100,
requestedLifetimeCount: 100 * 60 * 10,
requestedMaxKeepAliveCount: 2,
maxNotificationsPerPublish: 2,
publishingEnabled: true,
priority: 6
});
g_session.createSubscription(request, function (err, response) {
if (!err) {
response.should.be.instanceof(subscription_service.CreateSubscriptionResponse);
subscriptionId = response.subscriptionId;
}
done(err);
});
});
ClientSubscription.prototype.__create_subscription = function (callback) {
assert(_.isFunction(callback));
const self = this;
const session = self.publish_engine.session;
debugLog("ClientSubscription created ".yellow.bold);
const request = new subscription_service.CreateSubscriptionRequest({
requestedPublishingInterval: self.publishingInterval,
requestedLifetimeCount: self.lifetimeCount,
requestedMaxKeepAliveCount: self.maxKeepAliveCount,
maxNotificationsPerPublish: self.maxNotificationsPerPublish,
publishingEnabled: self.publishingEnabled,
priority: self.priority
});
session.createSubscription(request, function (err, response) {
if (err) {
/* istanbul ignore next */
self.emit("internal_error", err);
if (callback) {
return callback(err);
}
ClientSession.prototype.createSubscription = function (options, callback) {
const self = this;
assert(_.isFunction(callback));
const request = new subscription_service.CreateSubscriptionRequest(options);
self.performMessageTransaction(request, function (err, response) {
/* istanbul ignore next */
if (err) {
return callback(err, response);
}
assert(response instanceof subscription_service.CreateSubscriptionResponse);
callback(null, response);
});
};