notification-processor
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -6,3 +6,4 @@ (function() { | ||
LoggerObserver: require("./observers/logger.observer"), | ||
DelayObserver: require("./observers/delay.observer") | ||
DelayObserver: require("./observers/delay.observer"), | ||
DeadLetterSucceeded: require("./observers/deadLetterSucceeded.observer") | ||
}, | ||
@@ -9,0 +10,0 @@ Processors: { |
@@ -82,2 +82,6 @@ (function() { | ||
DelayObserver.prototype._channelPrefix_ = function(type) { | ||
return "health-delay-" + type; | ||
}; | ||
DelayObserver.prototype._buildValue_ = _.identity; | ||
@@ -84,0 +88,0 @@ |
@@ -36,5 +36,17 @@ (function() { | ||
RedisObserver.prototype._getChannel = function(notification) { | ||
return "health-delay-" + notification.type + "/" + (this._messagePath_(notification)); | ||
return (this._channelPrefix_(notification.type)) + "/" + (this._messagePath_(notification)); | ||
}; | ||
RedisObserver.prototype._messagePath_ = function() { | ||
throw new Error("not supported `_messagePath_`"); | ||
}; | ||
RedisObserver.prototype._buildValue_ = function() { | ||
throw new Error("not supported `_buildValue_`"); | ||
}; | ||
RedisObserver.prototype._channelPrefix_ = function(type) { | ||
throw new Error("not supported `_channelPrefix_`"); | ||
}; | ||
return RedisObserver; | ||
@@ -41,0 +53,0 @@ |
@@ -32,2 +32,10 @@ (function() { | ||
ProcessorBuilder.prototype.withDeadLetterSucceeded = function(opts) { | ||
return this.withListeners(this.source.deadLetterSucceeded(opts)); | ||
}; | ||
ProcessorBuilder.prototype.withDidLastRetry = function(opts) { | ||
return this.withListeners(this.source.didLastRetry(opts)); | ||
}; | ||
ProcessorBuilder.prototype.fromServiceBus = function() { | ||
@@ -34,0 +42,0 @@ return this.withSource(ServiceBusSource); |
@@ -41,3 +41,3 @@ (function() { | ||
} | ||
Promise.method(this.runner)(notification).tap((function(_this) { | ||
Promise.method(this.runner)(notification, context).tap((function(_this) { | ||
return function() { | ||
@@ -44,0 +44,0 @@ return _this.emit("successful", { |
@@ -40,2 +40,8 @@ (function() { | ||
}); | ||
}, | ||
deadLetterSucceeded: function() { | ||
throw new Error("not supported `deadLetterSucceeded`"); | ||
}, | ||
didLastRetry: function() { | ||
throw new Error("not supported `didLastRetry`"); | ||
} | ||
@@ -42,0 +48,0 @@ }; |
(function() { | ||
var DelayObserver, IgnoredUsers, MeliUsersThanCanNotRefreshAccessToken, MeliUsersThanNotBelongsToProducteca, _, ref, ref1; | ||
var DeadLetterSucceeded, DelayObserver, DidLastRetry, IgnoredUsers, MeliUsersThanCanNotRefreshAccessToken, MeliUsersThanNotBelongsToProducteca, _, create, ref, ref1; | ||
@@ -8,2 +8,6 @@ _ = require("lodash"); | ||
DeadLetterSucceeded = require("../observers/deadLetterSucceeded.observer"); | ||
DidLastRetry = require("../observers/didLastRetry.observer"); | ||
MeliUsersThanNotBelongsToProducteca = ((ref = process.env.MeliUsersThanNotBelongsToProducteca) != null ? ref.split(",") : void 0) || []; | ||
@@ -15,2 +19,14 @@ | ||
create = function(Type) { | ||
return function(arg) { | ||
var app, redis, subscription, topic; | ||
redis = arg.redis, app = arg.app, topic = arg.topic, subscription = arg.subscription; | ||
return new Type({ | ||
redis: redis, | ||
app: app, | ||
path: topic + "/" + subscription | ||
}); | ||
}; | ||
}; | ||
module.exports = { | ||
@@ -34,13 +50,7 @@ newNotification: function(arg) { | ||
}, | ||
delayObserver: function(arg) { | ||
var app, redis, subscription, topic; | ||
redis = arg.redis, app = arg.app, topic = arg.topic, subscription = arg.subscription; | ||
return new DelayObserver({ | ||
redis: redis, | ||
app: app, | ||
path: topic + "/" + subscription | ||
}); | ||
} | ||
delayObserver: create(DelayObserver), | ||
deadLetterSucceeded: create(DeadLetterSucceeded), | ||
didLastRetry: create(DidLastRetry) | ||
}; | ||
}).call(this); |
@@ -20,2 +20,8 @@ (function() { | ||
throw new Error("not supported `delayObserver`"); | ||
}, | ||
deadLetterSucceeded: function() { | ||
throw new Error("not supported `deadLetterSucceeded`"); | ||
}, | ||
didLastRetry: function() { | ||
throw new Error("not supported `didLastRetry`"); | ||
} | ||
@@ -22,0 +28,0 @@ }; |
@@ -15,2 +15,3 @@ (function() { | ||
type: "sb", | ||
dequeueCount: 1, | ||
message: { | ||
@@ -17,0 +18,0 @@ CompanyId: 123, |
{ | ||
"name": "notification-processor", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "notification-processor", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
43864
31
1095