Beispiel #1
0
func Start(name string) error {
	serv := registry.Get(name)
	if serv != nil {
		symphony.add <- serv
	}
	return core.ErrServiceNotFound
}
Beispiel #2
0
func Send(ctx context.Context, name string, payload core.Payload) core.Payload {
	service := registry.Get(name)
	if service == nil {
		return nil
	}
	talk := core.NewTalk(payload)
	go service.Serve(talk)
	var rst core.Payload
STOP:
	for {
		select {
		case resp := <-talk.Respond():
			rst = resp
			break STOP
		case <-ctx.Done():
			break STOP
		}
	}
	return rst
}