Ejemplo n.º 1
0
func sendMessageToSpecificService(requestID string, service string) error {
	instances, err := discovery.GetAvailableInstances(service)
	if err != nil {
		log.Println("Cannot dispatch message to service ", service)
		return err
	}
	destination := getDestination(instances)
	sendReqToDest(requestID, destination)
	return nil
}
Ejemplo n.º 2
0
func sendMessageToDestinations(requestID string) int {
	errCounter := 0

	for _, service := range destinations {
		instances, err := discovery.GetAvailableInstances(service)
		if err != nil {
			log.Println("Cannot dispatch message to service ", service)
			errCounter++
			break
		}
		destination := getDestination(instances)
		sendReqToDest(requestID, destination)
	}

	return errCounter
}