diff --git a/examples/customPluginExample.js b/examples/customPluginExample.js index cd6d3e3d..5c08e52e 100644 --- a/examples/customPluginExample.js +++ b/examples/customPluginExample.js @@ -39,23 +39,12 @@ var myPlugin = function(worker, func, queue, job, args, options){ // PLUGIN METHODS // //////////////////// -myPlugin.prototype.before_enqueue = function(callback){ - callback(null, true); -}; - -myPlugin.prototype.after_enqueue = function(callback){ - callback(null, true); -}; - +// Learn all the callbacks you can use from the Readme. myPlugin.prototype.before_perform = function(callback){ console.log(this.options.messagePrefix + " | " + JSON.stringify(this.args)); callback(null, true); }; -myPlugin.prototype.after_perform = function(callback){ - callback(null, true); -}; - ////////////////////////////// // DEFINE YOUR WORKER TASKS // ////////////////////////////// @@ -119,4 +108,4 @@ var shutdown = function(){ }); }, 500); } -} +}; diff --git a/lib/pluginRunner.js b/lib/pluginRunner.js index 44ea5d45..c7cddedc 100644 --- a/lib/pluginRunner.js +++ b/lib/pluginRunner.js @@ -6,7 +6,7 @@ var runPlugin = function(self, pluginRefrence, type, func, queue, job, args, cal var pluginName = pluginRefrence; if(typeof pluginRefrence === 'function'){ - pluginName = new pluginRefrence().name; + pluginName = new pluginRefrence(self, func, queue, job, args, {}).name; } var pluginOptions = null;