// Path: zuul-proxy/svcb-service/src/main/java/com/josedab/example/model/SocialProfile.java
// @Entity
// public class SocialProfile {
// 
//     @Id
//     @GeneratedValue
//     private Long id;
//     private String name;
// 
//     public SocialProfile() {}
// 
//     public SocialProfile(String name) {
//         this.name = name;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
// 
// 
// }


import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.hateoas.Resources;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.josedab.example.model.SocialProfile;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
package com.josedab.example.controller;




@RestController
@RequestMapping("/profiles")
public class SocialProfileApiGatewayController {
    
    private static final String SERVICE_A = "svca-service";
    private static final String SERVICE_B = "svcb-service";

    @Autowired
    private RestTemplate restTemplate;
    
    @Autowired
    private Source source;
    
    @HystrixCommand(fallbackMethod = "getProfileNamesFallback")
    @RequestMapping(method=RequestMethod.GET, value="/names/{service}")
    public Collection<String> getProfileNamesForService(@PathVariable("service") String service) {
        try {
// Path: zuul-proxy/svcb-service/src/main/java/com/josedab/example/model/SocialProfile.java
// @Entity
// public class SocialProfile {
// 
//     @Id
//     @GeneratedValue
//     private Long id;
//     private String name;
// 
//     public SocialProfile() {}
// 
//     public SocialProfile(String name) {
//         this.name = name;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
// 
// 
// }


// Path: zuul-proxy-cloud-bus/zuul-service/src/main/java/com/josedab/example/controller/SocialProfileApiGatewayController.java
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.hateoas.Resources;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.josedab.example.model.SocialProfile;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

package com.josedab.example.controller;




@RestController
@RequestMapping("/profiles")
public class SocialProfileApiGatewayController {
    
    private static final String SERVICE_A = "svca-service";
    private static final String SERVICE_B = "svcb-service";

    @Autowired
    private RestTemplate restTemplate;
    
    @Autowired
    private Source source;
    
    @HystrixCommand(fallbackMethod = "getProfileNamesFallback")
    @RequestMapping(method=RequestMethod.GET, value="/names/{service}")
    public Collection<String> getProfileNamesForService(@PathVariable("service") String service) {
        try {
            ParameterizedTypeReference<Resources<SocialProfile>> typeReference = new ParameterizedTypeReference<Resources<SocialProfile>>() {