예제 #1
0
파일: funnel.go 프로젝트: smetj/experiments
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()
}
예제 #2
0
파일: fanout.go 프로젝트: smetj/experiments
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()
}