public MessagingController(
            IGlobalSessionsRegistry sessionsRegistry,
            IGroupChatsRepository groupChatsRepository,
            IDevicesRepository devicesRepository,
            ProcessedMessagesQueue processedMessagesQueue,
            ISessionsServer server,
            IUndeliveredEventsRepository<Message> undeliveredMessagesRepository,
            IUndeliveredEventsRepository<DeliveryNotification> undeliveredDeliveryNotificationsRepository,
            IUndeliveredEventsRepository<SeenNotification> undeliveredSeenNotificationsRepository,
            IInternalMessageBus internalMessageBus)
        {
            _groupChatsRepository = groupChatsRepository;
            _devicesRepository = devicesRepository;
            _processedMessagesQueue = processedMessagesQueue;

            _messageEventManager = new ReliableEventManager<Message, IncomingMessage>(server,
                undeliveredMessagesRepository, sessionsRegistry,internalMessageBus,MessageDtoConverter, OnMessageProcessed);
            RegisterPulsable(_messageEventManager);

            _deliveryStatusEventManager = new ReliableEventManager<DeliveryNotification, ServerClient.Entities.Ws.Events.DeliveryNotification>(server,
                undeliveredDeliveryNotificationsRepository, sessionsRegistry, internalMessageBus,
                n => new ServerClient.Entities.Ws.Events.DeliveryNotification { MessageToken = n.MessageToken, EventId = n.EventId, DeliveredAt = n.CreatedAt });
            RegisterPulsable(_deliveryStatusEventManager);

            _seenStatusEventManager = new ReliableEventManager<SeenNotification, ServerClient.Entities.Ws.Events.SeenNotification>(server, 
                 undeliveredSeenNotificationsRepository, sessionsRegistry, internalMessageBus,
                n => new ServerClient.Entities.Ws.Events.SeenNotification { MessageToken = n.MessageToken, EventId = n.EventId, SeenAt = n.CreatedAt });
            RegisterPulsable(_seenStatusEventManager);

            _isTypingEventManager = new InstantEventManager<IsTypingEvent, IsTypingNotification>(server,
                sessionsRegistry, internalMessageBus, n => new IsTypingNotification { IsTyping = n.IsTyping, SenderUserId = n.SenderUserId, GroupId = n.GroupId });
            RegisterPulsable(_isTypingEventManager);
        }
예제 #2
0
        public RootController(AccessTokenFastValidator accessTokenFastValidator, ISessionsServer server, IDevicesRepository devicesRepository)
        {
            _accessTokenFastValidator = accessTokenFastValidator;
            _server = server;
            _devicesRepository = devicesRepository;

            var controllerTypes = Assembly.GetExecutingAssembly().ExportedTypes.Where(t => t.IsSubclassOf(typeof(BaseController)) && t != GetType()).ToList();
            _childrenControllers.AddRange(controllerTypes.Select(ServiceLocator.Resolve).OfType<BaseController>());
        }
예제 #3
0
        public RootController(AccessTokenFastValidator accessTokenFastValidator, ISessionsServer server, IDevicesRepository devicesRepository)
        {
            _accessTokenFastValidator = accessTokenFastValidator;
            _server            = server;
            _devicesRepository = devicesRepository;

            var controllerTypes = Assembly.GetExecutingAssembly().ExportedTypes.Where(t => t.IsSubclassOf(typeof(BaseController)) && t != GetType()).ToList();

            _childrenControllers.AddRange(controllerTypes.Select(ServiceLocator.Resolve).OfType <BaseController>());
        }
예제 #4
0
        public InstantEventManager(ISessionsServer server,
                                   IGlobalSessionsRegistry sessionsRegistry,
                                   IInternalMessageBus internalMessageBus,
                                   Func <TEvent, TEventDto> dtoMapper)
        {
            _server             = server;
            _sessionsRegistry   = sessionsRegistry;
            _internalMessageBus = internalMessageBus;
            _dtoMapper          = dtoMapper;

            if (_internalMessageBus != null)
            {
                _internalMessageBus.EventReceived += OnMessageFromAnotherInstance;
            }
        }
        public GroupChatsController(ISessionsServer server,
                                    IDevicesRepository devicesRepository,
                                    IUndeliveredEventsRepository <GroupChangedEvent> undeliveredGroupChangedEventsRepository,
                                    IGroupChatsRepository groupChatsRepository,
                                    IGlobalSessionsRegistry sessionsRegistry,
                                    IInternalMessageBus internalMessageBus)
        {
            _devicesRepository        = devicesRepository;
            _groupChatsRepository     = groupChatsRepository;
            _groupChangedEventManager = new ReliableEventManager <GroupChangedEvent, ClientDto.Events.GroupChangedNotification>(server,
                                                                                                                                undeliveredGroupChangedEventsRepository,
                                                                                                                                sessionsRegistry,
                                                                                                                                internalMessageBus,
                                                                                                                                GroupChangedDtoConverter);

            RegisterPulsable(_groupChangedEventManager);
        }
예제 #6
0
        public ReliableEventManager(ISessionsServer server,
                                    IUndeliveredEventsRepository <TEvent> undeliveredEventsRepository,
                                    IGlobalSessionsRegistry sessionsRegistry,
                                    IInternalMessageBus internalMessageBus,
                                    Func <TEvent, TEventDto> dtoMapper,
                                    Action <TEvent, bool> eventDeliveryStatusChanged = null)
        {
            _server = server;
            _undeliveredEventsRepository = undeliveredEventsRepository;
            _sessionsRegistry            = sessionsRegistry;
            _internalMessageBus          = internalMessageBus;
            _dtoMapper = dtoMapper;
            _eventDeliveryStatusChanged = eventDeliveryStatusChanged ?? delegate { };

            if (_internalMessageBus != null)
            {
                _internalMessageBus.EventReceived += OnMessageFromAnotherInstance;
            }
        }
        public MessagingController(
            IGlobalSessionsRegistry sessionsRegistry,
            IGroupChatsRepository groupChatsRepository,
            IDevicesRepository devicesRepository,
            ProcessedMessagesQueue processedMessagesQueue,
            ISessionsServer server,
            IUndeliveredEventsRepository <Message> undeliveredMessagesRepository,
            IUndeliveredEventsRepository <DeliveryNotification> undeliveredDeliveryNotificationsRepository,
            IUndeliveredEventsRepository <SeenNotification> undeliveredSeenNotificationsRepository,
            IInternalMessageBus internalMessageBus)
        {
            _groupChatsRepository   = groupChatsRepository;
            _devicesRepository      = devicesRepository;
            _processedMessagesQueue = processedMessagesQueue;

            _messageEventManager = new ReliableEventManager <Message, IncomingMessage>(server,
                                                                                       undeliveredMessagesRepository, sessionsRegistry, internalMessageBus, MessageDtoConverter, OnMessageProcessed);
            RegisterPulsable(_messageEventManager);

            _deliveryStatusEventManager = new ReliableEventManager <DeliveryNotification, ServerClient.Entities.Ws.Events.DeliveryNotification>(server,
                                                                                                                                                undeliveredDeliveryNotificationsRepository, sessionsRegistry, internalMessageBus,
                                                                                                                                                n => new ServerClient.Entities.Ws.Events.DeliveryNotification {
                MessageToken = n.MessageToken, EventId = n.EventId, DeliveredAt = n.CreatedAt
            });
            RegisterPulsable(_deliveryStatusEventManager);

            _seenStatusEventManager = new ReliableEventManager <SeenNotification, ServerClient.Entities.Ws.Events.SeenNotification>(server,
                                                                                                                                    undeliveredSeenNotificationsRepository, sessionsRegistry, internalMessageBus,
                                                                                                                                    n => new ServerClient.Entities.Ws.Events.SeenNotification {
                MessageToken = n.MessageToken, EventId = n.EventId, SeenAt = n.CreatedAt
            });
            RegisterPulsable(_seenStatusEventManager);

            _isTypingEventManager = new InstantEventManager <IsTypingEvent, IsTypingNotification>(server,
                                                                                                  sessionsRegistry, internalMessageBus, n => new IsTypingNotification {
                IsTyping = n.IsTyping, SenderUserId = n.SenderUserId, GroupId = n.GroupId
            });
            RegisterPulsable(_isTypingEventManager);
        }