// Path: remainder-service/src/main/java/com/apssouza/events/TodoServiceMethodInvokedEvent.java
// public class TodoServiceMethodInvokedEvent {
// 
//     private String methodName;
//     private long duration;
// 
//     public TodoServiceMethodInvokedEvent(String methodName, long duration) {
//         this.methodName = methodName;
//         this.duration = duration;
//     }
// 
//     public TodoServiceMethodInvokedEvent() {
//     }
// 
//     public String getMethodName() {
//         return methodName;
//     }
// 
//     public long getDuration() {
//         return duration;
//     }
// 
//     @Override
//     public String toString() {
//         return "CallEvent{" + "methodName=" + methodName + ", duration=" + duration + '}';
//     }
// 
// }
// 
// Path: remainder-service/src/main/java/com/apssouza/monitors/TodoServiceMethodInvokedStore.java
// @Component
// public class TodoServiceMethodInvokedStore {
// 
//     private CopyOnWriteArrayList<TodoServiceMethodInvokedEvent> events;
// 
//     @PostConstruct
//     public void init() {
//         this.events = new CopyOnWriteArrayList<>();
//     }
// 
//     public void addNewEvent(TodoServiceMethodInvokedEvent event) {
//         this.events.add(event);
//     }
// 
//     public List<TodoServiceMethodInvokedEvent> getRecentChanges() {
//         return this.events;
//     }
// 
//     public LongSummaryStatistics getStatistics() {
//         return this.events.stream().
//                 collect(Collectors.summarizingLong(TodoServiceMethodInvokedEvent::getDuration));
//     }
// }


import com.apssouza.events.TodoServiceMethodInvokedEvent;
import com.apssouza.monitors.TodoServiceMethodInvokedStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
package com.apssouza.listeners;


/**
 * TodoService method invoked listener
 * 
 * @author apssouza
 */
@Component
public class TodoServiceMethodListener {
    
    @Autowired
    private TodoServiceMethodInvokedStore methodMonitor;
    
// Path: remainder-service/src/main/java/com/apssouza/events/TodoServiceMethodInvokedEvent.java
// public class TodoServiceMethodInvokedEvent {
// 
//     private String methodName;
//     private long duration;
// 
//     public TodoServiceMethodInvokedEvent(String methodName, long duration) {
//         this.methodName = methodName;
//         this.duration = duration;
//     }
// 
//     public TodoServiceMethodInvokedEvent() {
//     }
// 
//     public String getMethodName() {
//         return methodName;
//     }
// 
//     public long getDuration() {
//         return duration;
//     }
// 
//     @Override
//     public String toString() {
//         return "CallEvent{" + "methodName=" + methodName + ", duration=" + duration + '}';
//     }
// 
// }
// 
// Path: remainder-service/src/main/java/com/apssouza/monitors/TodoServiceMethodInvokedStore.java
// @Component
// public class TodoServiceMethodInvokedStore {
// 
//     private CopyOnWriteArrayList<TodoServiceMethodInvokedEvent> events;
// 
//     @PostConstruct
//     public void init() {
//         this.events = new CopyOnWriteArrayList<>();
//     }
// 
//     public void addNewEvent(TodoServiceMethodInvokedEvent event) {
//         this.events.add(event);
//     }
// 
//     public List<TodoServiceMethodInvokedEvent> getRecentChanges() {
//         return this.events;
//     }
// 
//     public LongSummaryStatistics getStatistics() {
//         return this.events.stream().
//                 collect(Collectors.summarizingLong(TodoServiceMethodInvokedEvent::getDuration));
//     }
// }


// Path: remainder-service/src/main/java/com/apssouza/listeners/TodoServiceMethodListener.java
import com.apssouza.events.TodoServiceMethodInvokedEvent;
import com.apssouza.monitors.TodoServiceMethodInvokedStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

package com.apssouza.listeners;


/**
 * TodoService method invoked listener
 * 
 * @author apssouza
 */
@Component
public class TodoServiceMethodListener {
    
    @Autowired
    private TodoServiceMethodInvokedStore methodMonitor;
    
    @EventListener