コード例 #1
0
ファイル: serve.go プロジェクト: benschw/chinchilla
func main() {
	bind := flag.String("bind", ":8080", "address to bind to")
	flag.Parse()

	s := ex.NewServer(*bind)
	s.Start()

}
コード例 #2
0
ファイル: component_test.go プロジェクト: benschw/chinchilla
func GetServices() (*ep.EndpointApp, *ex.Server, *ex.Publisher, *ex.Publisher) {
	port := uint16(rando.Port())

	server := ex.NewServer(fmt.Sprintf(":%d", port))

	epCfg := config.EndpointConfig{
		Name:        "Foo",
		ServiceHost: fmt.Sprintf("http://localhost:%d", port),
		Uri:         "/foo",
		Method:      "POST",
		QueueConfig: map[interface{}]interface{}{
			"queuename": "test.foo",
		},
	}
	epCfg2 := config.EndpointConfig{
		Name:        "Bar",
		ServiceHost: fmt.Sprintf("http://localhost:%d", port),
		Uri:         "/bar",
		Method:      "POST",
		QueueConfig: map[interface{}]interface{}{
			"queuename": "test.bar",
		},
	}

	p := GetPublisher(&epCfg)
	p2 := GetPublisher(&epCfg2)

	repo := &config.StaticRepo{
		Address: config.RabbitAddress{
			User:     "******",
			Password: "******",
			Host:     "localhost",
			Port:     5672,
		},
		Endpoints: []config.EndpointConfig{epCfg, epCfg2},
	}

	mgr := ep.NewApp(repo, repo)
	return mgr, server, p, p2
}