func main() { runtime.GOMAXPROCS(4) router := router.Init() input := testevent.Init("input", "one") input_instance := moduler(input) router.Register(input_instance) // input2 := testevent.Init("input2", "two") // input3 := testevent.Init("input3", "three") // funnel := funnel.Init("funnel") output := stdout.Init("output") output_instance := moduler(output) router.Register(output_instance) // input1.Connect("outbox", output.Queuepool["inbox"].Queue) // input2.Connect("outbox", funnel.Queuepool["inbox2"].Queue) // input3.Connect("outbox", funnel.Queuepool["inbox3"].Queue) // funnel.Connect("outbox", output.Queuepool["inbox"].Queue) for { time.Sleep(time.Second * 1) } fmt.Println("The end.") }
func main() { router := router.NewRouter() input := testevent.NewModule("input", "Hello") roundrobin := roundrobin.NewModule("roundrobin") output_log := stdout.NewModule("output_log", false) output_metric := stdout.NewModule("output_metric", false) output1 := stdout.NewModule("output1", true) output2 := stdout.NewModule("output2", true) router.Register(&input) router.Register(&roundrobin) router.Register(&output1) router.Register(&output2) router.Register(&output_log) router.Register(&output_metric) router.Connect("_internal_logs.outbox", "output_log.inbox") router.Connect("_internal_metrics.outbox", "output_metric.inbox") router.Connect("input.outbox", "roundrobin.inbox") router.Connect("roundrobin.outbox1", "output1.inbox") router.Connect("roundrobin.outbox2", "output2.inbox") router.Start() router.Block() }
func main() { // go func() { // log.Println(http.ListenAndServe("localhost:6060", nil)) // }() runtime.GOMAXPROCS(2) router := router.NewRouter() input1 := testevent.NewModule("input1", "Hello I am number one.") input2 := testevent.NewModule("input2", "Hello I am number two.") input3 := testevent.NewModule("input3", "Hello I am number three.") funnel := funnel.NewModule("funnel") output := stdout.NewModule("output", true) logs := stdout.NewModule("logs", false) graphite := graphite.NewModule("graphite") metrics := tcp.NewModule("metrics", "graphite-001:2013", true, true) router.Register(&input1) router.Register(&input2) router.Register(&input3) router.Register(&funnel) router.Register(&output) router.Register(&logs) router.Register(&graphite) router.Register(&metrics) router.Connect("_internal_logs.outbox", "logs.inbox") router.Connect("_internal_metrics.outbox", "graphite.inbox") router.Connect("graphite.outbox", "metrics.inbox") router.Connect("input1.outbox", "funnel.input1") router.Connect("input2.outbox", "funnel.input2") router.Connect("input3.outbox", "funnel.input3") router.Connect("funnel.outbox", "output.inbox") router.Start() router.Block() }
func main() { runtime.GOMAXPROCS(3) router := router.NewRouter() input := testevent.NewModule("input", "Hello.") fanout := fanout.NewModule("fanout") output1 := stdout.NewModule("output1", true) output2 := stdout.NewModule("output2", true) output3 := stdout.NewModule("output3", true) logs := stdout.NewModule("logs", false) graphite := graphite.NewModule("graphite") metrics := tcp.NewModule("metrics", "graphite-001:2013", true, true) router.Register(&input) router.Register(&fanout) router.Register(&output1) router.Register(&output2) router.Register(&output3) router.Register(&logs) router.Register(&graphite) router.Register(&metrics) router.Connect("_internal_logs.outbox", "logs.inbox") router.Connect("_internal_metrics.outbox", "graphite.inbox") router.Connect("graphite.outbox", "metrics.inbox") router.Connect("input.outbox", "fanout.inbox") router.Connect("fanout.one", "output1.inbox") router.Connect("fanout.two", "output2.inbox") router.Connect("fanout.three", "output3.inbox") router.Start() router.Block() }