// 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/events/Event.java
// @Data
// public class Event implements Serializable {
// 	private String processId;
// 	private EventType eventType;
// 	private LocalDateTime eventTime = LocalDateTime.now();
// 
// 	public Event(String processId, EventType eventType) {
// 		this.processId = processId;
// 		this.eventType = eventType;
// 	}
// 
// 	public Event() {}
// 
// 	public static EventBuilder builder() {
// 		return new EventBuilder();
// 	}
// 
// 	public static class EventBuilder {
// 
// 		private String processId;
// 		private EventType eventType;
// 
// 		public EventBuilder eventType(EventType eventType) {
// 			this.eventType = eventType;
// 			return this;
// 		}
// 
// 		public EventBuilder processId(String processId) {
// 			this.processId = processId;
// 			return this;
// 		}
// 
// 		public Event build() {
// 			return new Event(this.processId, this.eventType);
// 		}
// 
// 	}
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/events/EventGateway.java
// @MessagingGateway
// public interface EventGateway {
// 
// 	@Gateway(requestChannel=EventSource.OUTPUT)
// 	void emitEvent(Event event);
// 
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/events/EventType.java
// public enum EventType {
// 	INGREDIENTS_ORDERED,
// 	BREWING_STARTED,
// 	BEER_MATURED,
// 	BEER_BOTTLED
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/model/Version.java
// public class Version {
//     public static final String BREWING_V1 = "application/vnd.io.spring.cloud.brewing.v1+json";
//     public static final String PRESENTING_V1 = "application/vnd.io.spring.cloud.presenting.v1+json";
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/TestRequestEntityBuilder.java
// public static TestRequestEntityBuilder requestEntity() {
// 	return new TestRequestEntityBuilder();
// }


import io.spring.cloud.samples.brewery.common.TestConfigurationHolder;
import io.spring.cloud.samples.brewery.common.events.Event;
import io.spring.cloud.samples.brewery.common.events.EventGateway;
import io.spring.cloud.samples.brewery.common.events.EventType;
import io.spring.cloud.samples.brewery.common.model.Version;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.HttpMethod;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import static io.spring.cloud.samples.brewery.common.TestConfigurationHolder.TestCommunicationType.FEIGN;
import static io.spring.cloud.samples.brewery.common.TestRequestEntityBuilder.requestEntity;
package io.spring.cloud.samples.brewery.bottling;




@Component
@Slf4j
class BottlingWorker {


    private Map<String, State> PROCESS_STATE = new ConcurrentHashMap<>();
    private final Tracer tracer;
    private final PresentingClient presentingClient;
    private final RestTemplate restTemplate;
    private final EventGateway eventGateway;

    @Autowired
    public BottlingWorker(Tracer tracer,
                          PresentingClient presentingClient,
                          @LoadBalanced RestTemplate restTemplate, EventGateway eventGateway) {
        this.tracer = tracer;
        this.presentingClient = presentingClient;
        this.restTemplate = restTemplate;
        this.eventGateway = eventGateway;
    }

    @Async
// 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/events/Event.java
// @Data
// public class Event implements Serializable {
// 	private String processId;
// 	private EventType eventType;
// 	private LocalDateTime eventTime = LocalDateTime.now();
// 
// 	public Event(String processId, EventType eventType) {
// 		this.processId = processId;
// 		this.eventType = eventType;
// 	}
// 
// 	public Event() {}
// 
// 	public static EventBuilder builder() {
// 		return new EventBuilder();
// 	}
// 
// 	public static class EventBuilder {
// 
// 		private String processId;
// 		private EventType eventType;
// 
// 		public EventBuilder eventType(EventType eventType) {
// 			this.eventType = eventType;
// 			return this;
// 		}
// 
// 		public EventBuilder processId(String processId) {
// 			this.processId = processId;
// 			return this;
// 		}
// 
// 		public Event build() {
// 			return new Event(this.processId, this.eventType);
// 		}
// 
// 	}
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/events/EventGateway.java
// @MessagingGateway
// public interface EventGateway {
// 
// 	@Gateway(requestChannel=EventSource.OUTPUT)
// 	void emitEvent(Event event);
// 
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/events/EventType.java
// public enum EventType {
// 	INGREDIENTS_ORDERED,
// 	BREWING_STARTED,
// 	BEER_MATURED,
// 	BEER_BOTTLED
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/model/Version.java
// public class Version {
//     public static final String BREWING_V1 = "application/vnd.io.spring.cloud.brewing.v1+json";
//     public static final String PRESENTING_V1 = "application/vnd.io.spring.cloud.presenting.v1+json";
// }
// 
// Path: common/src/main/java/io/spring/cloud/samples/brewery/common/TestRequestEntityBuilder.java
// public static TestRequestEntityBuilder requestEntity() {
// 	return new TestRequestEntityBuilder();
// }


// Path: brewing/src/main/java/io/spring/cloud/samples/brewery/bottling/BottlingWorker.java
import io.spring.cloud.samples.brewery.common.TestConfigurationHolder;
import io.spring.cloud.samples.brewery.common.events.Event;
import io.spring.cloud.samples.brewery.common.events.EventGateway;
import io.spring.cloud.samples.brewery.common.events.EventType;
import io.spring.cloud.samples.brewery.common.model.Version;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.HttpMethod;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import static io.spring.cloud.samples.brewery.common.TestConfigurationHolder.TestCommunicationType.FEIGN;
import static io.spring.cloud.samples.brewery.common.TestRequestEntityBuilder.requestEntity;

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




@Component
@Slf4j
class BottlingWorker {


    private Map<String, State> PROCESS_STATE = new ConcurrentHashMap<>();
    private final Tracer tracer;
    private final PresentingClient presentingClient;
    private final RestTemplate restTemplate;
    private final EventGateway eventGateway;

    @Autowired
    public BottlingWorker(Tracer tracer,
                          PresentingClient presentingClient,
                          @LoadBalanced RestTemplate restTemplate, EventGateway eventGateway) {
        this.tracer = tracer;
        this.presentingClient = presentingClient;
        this.restTemplate = restTemplate;
        this.eventGateway = eventGateway;
    }

    @Async
    public void bottleBeer(Integer wortAmount, String processId, TestConfigurationHolder configurationHolder) {