// 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/EventSink.java
// public interface EventSink {
// 
// 	String INPUT = "events";
// 
// 	@Input(EventSink.INPUT)
// 	SubscribableChannel input();
// }


import io.spring.cloud.samples.brewery.common.events.Event;
import io.spring.cloud.samples.brewery.common.events.EventSink;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.messaging.handler.annotation.Headers;
import java.util.Map;
package io.spring.cloud.samples.brewery.reporting;



@MessageEndpoint
@Slf4j
class EventListener {

	private final ReportingRepository reportingRepository;
	private final Tracer tracer;

	@Autowired
	public EventListener(ReportingRepository reportingRepository, Tracer tracer) {
		this.reportingRepository = reportingRepository;
		this.tracer = tracer;
	}

	@ServiceActivator(inputChannel = EventSink.INPUT)
	public void handleEvents(Event event, @Headers Map<String, Object> headers) throws InterruptedException {
// 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/EventSink.java
// public interface EventSink {
// 
// 	String INPUT = "events";
// 
// 	@Input(EventSink.INPUT)
// 	SubscribableChannel input();
// }


// Path: reporting/src/main/java/io/spring/cloud/samples/brewery/reporting/EventListener.java
import io.spring.cloud.samples.brewery.common.events.Event;
import io.spring.cloud.samples.brewery.common.events.EventSink;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.messaging.handler.annotation.Headers;
import java.util.Map;

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



@MessageEndpoint
@Slf4j
class EventListener {

	private final ReportingRepository reportingRepository;
	private final Tracer tracer;

	@Autowired
	public EventListener(ReportingRepository reportingRepository, Tracer tracer) {
		this.reportingRepository = reportingRepository;
		this.tracer = tracer;
	}

	@ServiceActivator(inputChannel = EventSink.INPUT)
	public void handleEvents(Event event, @Headers Map<String, Object> headers) throws InterruptedException {
		log.info("Received the following message with headers [{}] and body [{}]", headers, event);