Exemplo n.º 1
0
func NewClient(config *skynet.ClientConfig) *Client {
	if config.Log == nil {
		config.Log = skynet.NewConsoleLogger(os.Stderr)
	}

	if config.ConnectionPoolSize == 0 {
		config.ConnectionPoolSize = 1
	}

	client := &Client{
		Config:     config,
		DoozerConn: skynet.NewDoozerConnectionFromConfig(*config.DoozerConfig, config.Log),
		Log:        config.Log,
	}

	client.Log.Item(config)

	client.DoozerConn.Connect()

	return client
}
Exemplo n.º 2
0
func NewClient(config *skynet.ClientConfig) *Client {
	if config.Log == nil {
		config.Log = skynet.NewConsoleLogger(os.Stderr)
	}

	if config.ConnectionPoolSize == 0 {
		config.ConnectionPoolSize = 1
	}

	client := &Client{
		Config:       config,
		DoozerConn:   skynet.NewDoozerConnectionFromConfig(*config.DoozerConfig, config.Log),
		Log:          config.Log,
		servicePools: map[string]*servicePool{},
	}

	client.Log.Item(config)

	client.DoozerConn.Connect()

	client.instanceMonitor = NewInstanceMonitor(client.DoozerConn)

	return client
}