Commit 9a27577b authored by project's avatar project

--no commit message

--no commit message
parent 688c99ee
function execute_function(context,response){ function execute_function(context,response){
// var job_id = context.profile.job_id; var job_id = context.jobconfig.job_id;
// var transaction_id = context.profile.transaction_id; var transaction_id = context.job.transaction_id;
// var param = ctx.parameter; var param = context.jobconfig.data_in.param;
var memstore = context.job.memstore
var data = 'hello world'; var data = 'hello world';
setTimeout(function () {
response.success(context.jobid + ' ' + data);
}, 1000);
//memstore.setvalue('timestamp.xxx',ts)
//response.cancel();
//response.reject();
//response.error("error message") //response.error("error message")
//response.success(data); //response.success(data);
} }
......
...@@ -3,7 +3,8 @@ var DIPlugin = require('../di-plugin'); ...@@ -3,7 +3,8 @@ var DIPlugin = require('../di-plugin');
function DITask(context){ function DITask(context){
DIPlugin.call(this,context); DIPlugin.call(this,context);
this.name = "http" this.name = "http-request";
this.output_type = "text";
} }
util.inherits(DITask,DIPlugin); util.inherits(DITask,DIPlugin);
......
...@@ -38,11 +38,11 @@ DIResponse.prototype.success = function(data){ ...@@ -38,11 +38,11 @@ DIResponse.prototype.success = function(data){
} }
DIResponse.prototype.error = function(err){ DIResponse.prototype.error = function(err){
this.handle.emit('done',response('error',data)); this.handle.emit('done',response('error',err));
} }
DIResponse.prototype.cancel = function(){ DIResponse.prototype.reject = function(){
this.handle.emit('done',response('cancel',null)); this.handle.emit('done',response('reject',null));
} }
function response(status,data){ function response(status,data){
......
...@@ -5,4 +5,4 @@ var di = new DITask({jobid:'j01'}); ...@@ -5,4 +5,4 @@ var di = new DITask({jobid:'j01'});
di.run(); di.run();
di.on('done',function(response){ di.on('done',function(response){
console.log('>> ' + response.data); console.log('>> ' + response.data);
}) });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment