-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
41 lines (34 loc) · 1 KB
/
test.js
File metadata and controls
41 lines (34 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Testing Event broker
// and aesop functionality
var util = require("util");
var broker =require("./eventBroker");
var aesop = require("./aesop.js");
event = broker.createEvent("first1","seans","horse");
function me_handler(event) {
if(!this.checkInputs(event,this)){
return false;
}
console.log(this.input_values['joes'] + " " + this.input_values['seans']);
return 1;
}
channel = "seans";
channel2 = "joes";
inputs = [channel,channel2];
aesop.createMeh("first_meh",inputs,me_handler);
aesop.start("first_meh");
broker.publish(event);
event2 = broker.createEvent("second1","joes","cow");
broker.publish(event2);
channel3= "socks";
inputs2 = [channel3];
function second_handler(event){
if(!this.checkInputs(event,this)){
return false;
}
console.log("result of meh is ..");
console.log(this.input_values['socks']);
}
aesop.createMeh("second_meh",inputs2,second_handler);
aesop.start("second_meh");
event3 = broker.createEvent("new_event","socks","paisely");
broker.publish(event3);