// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/TestConfigurationHolder.java
// @Data
// @Builder
// public class TestConfigurationHolder {
// 	public static final String TEST_COMMUNICATION_TYPE_HEADER_NAME = "TEST-COMMUNICATION-TYPE";
// 	public static final ThreadLocal<TestConfigurationHolder> TEST_CONFIG = new ThreadLocal<>();
// 
// 	private TestCommunicationType testCommunicationType;
// 
// 	public enum TestCommunicationType {
// 		FEIGN, REST_TEMPLATE
// 	}
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/model/Wort.java
// @Data
// public class Wort {
//     private int wort;
// 
//     public Wort(int wort) {
//         this.wort = wort;
//     }
// }


import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
import com.netflix.hystrix.HystrixCommandKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.TraceKeys;
import org.springframework.cloud.sleuth.instrument.hystrix.TraceCommand;
import org.springframework.stereotype.Service;
import io.spring.cloud.samples.brewery.common.BottlingService;
import io.spring.cloud.samples.brewery.common.TestConfigurationHolder;
import io.spring.cloud.samples.brewery.common.model.Wort;
import lombok.extern.slf4j.Slf4j;
package io.spring.cloud.samples.brewery.bottling;




@Service
@Slf4j
class Bottler implements BottlingService {

    private final BottlerService bottlerService;
    private final Tracer tracer;
    private final TraceKeys traceKeys;

    @Autowired
    public Bottler(BottlerService bottlerService, Tracer tracer, TraceKeys traceKeys) {
        this.bottlerService = bottlerService;
        this.tracer = tracer;
        this.traceKeys = traceKeys;
    }

	/**
     * [SLEUTH] TraceCommand
     */
    @Override
    public void bottle(Wort wort, String processId, String testCommunicationType) {
        log.info("I'm in the bottling service");
        log.info("Process ID from headers {}", processId);
        String groupKey = "bottling";
        String commandKey = "bottle";
        HystrixCommand.Setter setter = HystrixCommand.Setter
                .withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey))
                .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey));
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/TestConfigurationHolder.java
// @Data
// @Builder
// public class TestConfigurationHolder {
// 	public static final String TEST_COMMUNICATION_TYPE_HEADER_NAME = "TEST-COMMUNICATION-TYPE";
// 	public static final ThreadLocal<TestConfigurationHolder> TEST_CONFIG = new ThreadLocal<>();
// 
// 	private TestCommunicationType testCommunicationType;
// 
// 	public enum TestCommunicationType {
// 		FEIGN, REST_TEMPLATE
// 	}
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/model/Wort.java
// @Data
// public class Wort {
//     private int wort;
// 
//     public Wort(int wort) {
//         this.wort = wort;
//     }
// }


// Path: brewing/src/main/java/io/spring/cloud/samples/brewery/bottling/Bottler.java
import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
import com.netflix.hystrix.HystrixCommandKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.TraceKeys;
import org.springframework.cloud.sleuth.instrument.hystrix.TraceCommand;
import org.springframework.stereotype.Service;
import io.spring.cloud.samples.brewery.common.BottlingService;
import io.spring.cloud.samples.brewery.common.TestConfigurationHolder;
import io.spring.cloud.samples.brewery.common.model.Wort;
import lombok.extern.slf4j.Slf4j;

package io.spring.cloud.samples.brewery.bottling;




@Service
@Slf4j
class Bottler implements BottlingService {

    private final BottlerService bottlerService;
    private final Tracer tracer;
    private final TraceKeys traceKeys;

    @Autowired
    public Bottler(BottlerService bottlerService, Tracer tracer, TraceKeys traceKeys) {
        this.bottlerService = bottlerService;
        this.tracer = tracer;
        this.traceKeys = traceKeys;
    }

	/**
     * [SLEUTH] TraceCommand
     */
    @Override
    public void bottle(Wort wort, String processId, String testCommunicationType) {
        log.info("I'm in the bottling service");
        log.info("Process ID from headers {}", processId);
        String groupKey = "bottling";
        String commandKey = "bottle";
        HystrixCommand.Setter setter = HystrixCommand.Setter
                .withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey))
                .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey));
        TestConfigurationHolder testConfigurationHolder = TestConfigurationHolder.TEST_CONFIG.get();