// Path: src/main/java/org/nextrtc/signalingserver/Names.java
// public interface Names {
//     String EVENT_BUS = "nextRTCEventBus";
//     String EVENT_DISPATCHER = "nextRTCEventDispatcher";
// 
//     String SCHEDULER_SIZE = "${nextrtc.scheduler_size:10}";
//     String SCHEDULER_NAME = "nextRTCPingScheduler";
//     String SCHEDULED_PERIOD = "${nextrtc.ping_period:3}";
//     String MAX_CONNECTION_SETUP_TIME = "${nextrtc.max_connection_setup_time:30}";
//     String JOIN_ONLY_TO_EXISTING = "${nextrtc.join_only_to_existing:false}";
// 
//     String DEFAULT_CONVERSATION_TYPE = "${nextrtc.default_conversation_type:MESH}";
// }
// 
// Path: src/main/java/org/nextrtc/signalingserver/api/NextRTCEvents.java
// public enum NextRTCEvents {
//     SESSION_OPENED,
//     SESSION_CLOSED,
//     CONVERSATION_CREATED,
//     CONVERSATION_DESTROYED,
//     UNEXPECTED_SITUATION,
//     MEMBER_JOINED,
//     MEMBER_LEFT,
//     MEDIA_LOCAL_STREAM_REQUESTED,
//     MEDIA_LOCAL_STREAM_CREATED,
//     MEDIA_STREAMING,
//     TEXT,
//     MESSAGE;
// 
//     public NextRTCEvent basedOn(InternalMessage message, Conversation conversation) {
//         return EventContext.builder()
//                 .from(message.getFrom())
//                 .to(message.getTo())
//                 .custom(message.getCustom())
//                 .conversation(conversation)
//                 .type(this)
//                 .build();
//     }
// 
//     public NextRTCEvent basedOn(EventContext.EventContextBuilder builder) {
//         return builder
//                 .type(this)
//                 .build();
//     }
// 
//     public NextRTCEvent occurFor(Connection connection, String reason) {
//         return EventContext.builder()
//                 .from(new InternalMember(connection))
//                 .type(this)
//                 .exception(Exceptions.UNKNOWN_ERROR.exception())
//                 .content(reason)
//                 .build();
//     }
// 
//     public NextRTCEvent occurFor(Connection connection) {
//         return EventContext.builder()
//                 .type(this)
//                 .from(new InternalMember(connection))
//                 .exception(Exceptions.UNKNOWN_ERROR.exception())
//                 .build();
//     }
// 
//     public NextRTCEvent basedOn(InternalMessage message) {
//         return EventContext.builder()
//                 .from(message.getFrom())
//                 .to(message.getTo())
//                 .custom(message.getCustom())
//                 .content(message.getContent())
//                 .conversation(message.getFrom().getConversation().orElse(null))
//                 .type(this)
//                 .build();
//     }
// 
//     private static class InternalMember implements NextRTCMember {
// 
//         private final Connection connection;
// 
//         InternalMember(Connection connection) {
//             this.connection = connection;
//         }
// 
//         @Override
//         public Connection getConnection() {
//             return connection;
//         }
// 
//         @Override
//         public String getId() {
//             if (connection == null) {
//                 return null;
//             }
//             return connection.getId();
//         }
// 
//         @Override
//         public String toString() {
//             return getId();
//         }
//     }
// }


import lombok.extern.slf4j.Slf4j;
import org.nextrtc.signalingserver.Names;
import org.nextrtc.signalingserver.api.NextRTCEvents;
import org.nextrtc.signalingserver.api.annotation.NextRTCEventListener;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Map;
import static org.springframework.core.annotation.AnnotationUtils.getValue;
package org.nextrtc.signalingserver.eventbus;




@Slf4j
@Component(Names.EVENT_DISPATCHER)
@Scope("singleton")
@NextRTCEventListener
// Path: src/main/java/org/nextrtc/signalingserver/Names.java
// public interface Names {
//     String EVENT_BUS = "nextRTCEventBus";
//     String EVENT_DISPATCHER = "nextRTCEventDispatcher";
// 
//     String SCHEDULER_SIZE = "${nextrtc.scheduler_size:10}";
//     String SCHEDULER_NAME = "nextRTCPingScheduler";
//     String SCHEDULED_PERIOD = "${nextrtc.ping_period:3}";
//     String MAX_CONNECTION_SETUP_TIME = "${nextrtc.max_connection_setup_time:30}";
//     String JOIN_ONLY_TO_EXISTING = "${nextrtc.join_only_to_existing:false}";
// 
//     String DEFAULT_CONVERSATION_TYPE = "${nextrtc.default_conversation_type:MESH}";
// }
// 
// Path: src/main/java/org/nextrtc/signalingserver/api/NextRTCEvents.java
// public enum NextRTCEvents {
//     SESSION_OPENED,
//     SESSION_CLOSED,
//     CONVERSATION_CREATED,
//     CONVERSATION_DESTROYED,
//     UNEXPECTED_SITUATION,
//     MEMBER_JOINED,
//     MEMBER_LEFT,
//     MEDIA_LOCAL_STREAM_REQUESTED,
//     MEDIA_LOCAL_STREAM_CREATED,
//     MEDIA_STREAMING,
//     TEXT,
//     MESSAGE;
// 
//     public NextRTCEvent basedOn(InternalMessage message, Conversation conversation) {
//         return EventContext.builder()
//                 .from(message.getFrom())
//                 .to(message.getTo())
//                 .custom(message.getCustom())
//                 .conversation(conversation)
//                 .type(this)
//                 .build();
//     }
// 
//     public NextRTCEvent basedOn(EventContext.EventContextBuilder builder) {
//         return builder
//                 .type(this)
//                 .build();
//     }
// 
//     public NextRTCEvent occurFor(Connection connection, String reason) {
//         return EventContext.builder()
//                 .from(new InternalMember(connection))
//                 .type(this)
//                 .exception(Exceptions.UNKNOWN_ERROR.exception())
//                 .content(reason)
//                 .build();
//     }
// 
//     public NextRTCEvent occurFor(Connection connection) {
//         return EventContext.builder()
//                 .type(this)
//                 .from(new InternalMember(connection))
//                 .exception(Exceptions.UNKNOWN_ERROR.exception())
//                 .build();
//     }
// 
//     public NextRTCEvent basedOn(InternalMessage message) {
//         return EventContext.builder()
//                 .from(message.getFrom())
//                 .to(message.getTo())
//                 .custom(message.getCustom())
//                 .content(message.getContent())
//                 .conversation(message.getFrom().getConversation().orElse(null))
//                 .type(this)
//                 .build();
//     }
// 
//     private static class InternalMember implements NextRTCMember {
// 
//         private final Connection connection;
// 
//         InternalMember(Connection connection) {
//             this.connection = connection;
//         }
// 
//         @Override
//         public Connection getConnection() {
//             return connection;
//         }
// 
//         @Override
//         public String getId() {
//             if (connection == null) {
//                 return null;
//             }
//             return connection.getId();
//         }
// 
//         @Override
//         public String toString() {
//             return getId();
//         }
//     }
// }


// Path: src/main/java/org/nextrtc/signalingserver/eventbus/SpringEventDispatcher.java
import lombok.extern.slf4j.Slf4j;
import org.nextrtc.signalingserver.Names;
import org.nextrtc.signalingserver.api.NextRTCEvents;
import org.nextrtc.signalingserver.api.annotation.NextRTCEventListener;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Map;
import static org.springframework.core.annotation.AnnotationUtils.getValue;

package org.nextrtc.signalingserver.eventbus;




@Slf4j
@Component(Names.EVENT_DISPATCHER)
@Scope("singleton")
@NextRTCEventListener
public class SpringEventDispatcher extends AbstractEventDispatcher {