Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
688c99ee
Commit
688c99ee
authored
Dec 09, 2016
by
project
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
a82ed16d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
10 deletions
+55
-10
execute.js
plugins/di/di-http-request/execute.js
+11
-5
index.js
plugins/di/di-http-request/index.js
+2
-1
di-plugin.js
plugins/di/di-plugin.js
+37
-2
testdi.js
test/testdi.js
+5
-2
No files found.
plugins/di/di-http-request/execute.js
View file @
688c99ee
function
execute_function
(
c
tx
,
out
){
function
execute_function
(
c
ontext
,
response
){
// var job_id = c
tx.profile.job
id;
// var job_id = c
ontext.profile.job_
id;
// var transaction_id = c
tx
.profile.transaction_id;
// var transaction_id = c
ontext
.profile.transaction_id;
// var param = ctx.parameter;
// var param = ctx.parameter;
var
data
=
''
;
var
data
=
'
hello world
'
;
setTimeout
(
function
()
{
response
.
success
(
context
.
jobid
+
' '
+
data
);
},
1000
);
console
.
log
(
this
.
getname
()
+
'plug-ins'
);
//response.cancel();
//response.error("error message")
//response.success(data);
}
}
module
.
exports
=
execute_function
;
module
.
exports
=
execute_function
;
plugins/di/di-http-request/index.js
View file @
688c99ee
var
util
=
require
(
'util'
);
var
util
=
require
(
'util'
);
var
DIPlugin
=
require
(
'../di-plugin'
);
var
DIPlugin
=
require
(
'../di-plugin'
);
function
DITask
(){
function
DITask
(
context
){
DIPlugin
.
call
(
this
,
context
);
this
.
name
=
"http"
this
.
name
=
"http"
}
}
util
.
inherits
(
DITask
,
DIPlugin
);
util
.
inherits
(
DITask
,
DIPlugin
);
...
...
plugins/di/di-plugin.js
View file @
688c99ee
var
util
=
require
(
'util'
);
var
util
=
require
(
'util'
);
var
EventEmitter
=
require
(
'events'
);
var
EventEmitter
=
require
(
'events'
).
EventEmitter
;
function
DIPlugin
(
context
){
EventEmitter
.
call
(
this
);
function
DIPlugin
(){
this
.
name
=
'base'
;
this
.
name
=
'base'
;
this
.
jobcontext
=
context
;
this
.
outputdata
=
null
;
}
}
util
.
inherits
(
DIPlugin
,
EventEmitter
);
util
.
inherits
(
DIPlugin
,
EventEmitter
);
...
@@ -10,6 +14,37 @@ DIPlugin.prototype.getname = function(){
...
@@ -10,6 +14,37 @@ DIPlugin.prototype.getname = function(){
return
this
.
name
;
return
this
.
name
;
}
}
DIPlugin
.
prototype
.
execute
=
function
(){}
DIPlugin
.
prototype
.
run
=
function
(){
this
.
emit
(
'start'
);
var
resp
=
new
DIResponse
(
this
);
this
.
execute
(
this
.
jobcontext
,
resp
);
}
module
.
exports
=
DIPlugin
;
module
.
exports
=
DIPlugin
;
/*
DIResponse
*/
function
DIResponse
(
handle
){
this
.
handle
=
handle
;
}
DIResponse
.
prototype
.
success
=
function
(
data
){
this
.
handle
.
emit
(
'done'
,
response
(
'success'
,
data
));
}
DIResponse
.
prototype
.
error
=
function
(
err
){
this
.
handle
.
emit
(
'done'
,
response
(
'error'
,
data
));
}
DIResponse
.
prototype
.
cancel
=
function
(){
this
.
handle
.
emit
(
'done'
,
response
(
'cancel'
,
null
));
}
function
response
(
status
,
data
){
return
{
'status'
:
status
,
'data'
:
data
}
}
test/testdi.js
View file @
688c99ee
var
DITask
=
require
(
'../plugins/di/di-http-request'
);
var
DITask
=
require
(
'../plugins/di/di-http-request'
);
var
di
=
new
DITask
();
var
di
=
new
DITask
(
{
jobid
:
'j01'
}
);
di
.
execute
();
di
.
run
();
di
.
on
(
'done'
,
function
(
response
){
console
.
log
(
'>> '
+
response
.
data
);
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment