public RabbitMQAdapterFactory(
            string name,
            RabbitMQStreamProviderOptions config,
            HashRingStreamQueueMapperOptions queueMapperOptions,
            SimpleQueueCacheOptions cacheOptions,
            IServiceProvider serviceProvider,
            IOptions <ClusterOptions> clusterOptions,
            SerializationManager serializationManager,
            ILoggerFactory loggerFactory,
            IMessageSerializationHandler serializationHandler,
            IRabbitMQMapper mapper)

        {
            _config = config;

            _providerName         = name;
            _loggeFactory         = loggerFactory;
            _serializationHandler = serializationHandler;

            _mapper = mapper;
            _mapper.Init( );

            _cacheSize    = cacheOptions.CacheSize;
            _adapterCache = new SimpleQueueAdapterCache(cacheOptions, _providerName, _loggeFactory);

            _streamQueueMapper = new HashRingBasedStreamQueueMapper(queueMapperOptions, _providerName);
        }
Example #2
0
 public ITAlertClientRoom(PhotonClientWrapper photonClientWrapper,
                          IMessageSerializationHandler messageSerializationHandler,
                          Action <ClientRoom <ITAlertPlayer> > initializedCallback)
     : base(photonClientWrapper,
            messageSerializationHandler,
            initializedCallback)
 {
 }
Example #3
0
 public RabbitMQAdapter(RabbitMQStreamProviderOptions config, ILoggerFactory loggerFactory, string providerName, IStreamQueueMapper streamQueueMapper, IRabbitMQMapper mapper, IMessageSerializationHandler serializationHandler)
 {
     Direction             = config.Mode;
     _config               = config;
     _loggerFactory        = loggerFactory;
     Name                  = providerName;
     _streamQueueMapper    = streamQueueMapper;
     _mapper               = mapper;
     _queues               = new ConcurrentDictionary <QueueId, object>();
     _serializationHandler = serializationHandler;
     CreateConnection();
 }
Example #4
0
        protected Client(string gamePlugin, string gameVersion, IMessageSerializationHandler messageSerializationHandler)
        {
            ClientState = ClientState.Disconnected;

            _clientGameObject    = new GameObject("Playgen.PhotonClient", typeof(DontDestroyOnLoad));
            _photonClientWrapper = _clientGameObject.AddComponent <PhotonClientWrapper>();
            _photonClientWrapper.Initialize(gameVersion, gamePlugin);

            _messageSerializationHandler = messageSerializationHandler;

            _photonClientWrapper.ConnectedEvent    += OnConnected;
            _photonClientWrapper.DisconnectedEvent += OnDisconnected;
            _photonClientWrapper.JoinedRoomEvent   += OnJoinedRoom;
            _photonClientWrapper.LeftRoomEvent     += OnLeftRoom;
            _photonClientWrapper.ExceptionEvent    += OnException;
        }
        public void Init(string providerName, IServiceProvider serviceProvider)
        {
            _config = serviceProvider.GetService <RabbitMQStreamProviderOptions>();

            _providerName         = providerName;
            _loggeFactory         = serviceProvider.GetRequiredService <ILoggerFactory>();
            _serializationHandler = _config.MessageSerializationHandler; // serviceProvider.GetRequiredService<IMessageSerializationHandler>();

            _mapper = serviceProvider.GetRequiredService <IRabbitMQMapper>();
            _mapper.Init();

            _cacheSize    = 4096;// _config.SimpleQueueAdapterCache.ParseSize(config, 4096);
            _adapterCache = new SimpleQueueAdapterCache(_cacheSize, providerName, _loggeFactory);

            _streamQueueMapper = new HashRingBasedStreamQueueMapper(_config.NumberOfQueues, _providerName);

            if (StreamFailureHandlerFactory == null)
            {
                StreamFailureHandlerFactory =
                    qid => Task.FromResult <IStreamFailureHandler>(new NoOpStreamDeliveryFailureHandler(false));
            }
        }
Example #6
0
        public ClientRoom(PhotonClientWrapper photonClientWrapper,
                          IMessageSerializationHandler messageSerializationHandler,
                          Action <ClientRoom <TPlayer> > initializedCallback)
        {
            _photonClientWrapper = photonClientWrapper;
            _initializedCallback = initializedCallback;

            Messenger = new Messenger(messageSerializationHandler, photonClientWrapper);
            Logger.SetMessenger(Messenger);
            Logger.PlayerPhotonId = photonClientWrapper.Player.ID;
            Messenger.Subscribe((int)Channels.Players, ProcessPlayersMessage);

            //if (VoiceSettings.Instance.Enabled)
            //{
            _voiceClient = new VoiceClient();
            //}

            Players = new List <TPlayer>();

            _photonClientWrapper.EventRecievedEvent += OnRecievedEvent;

            Logger.LogDebug("Created ClientRoom");
        }
Example #7
0
 protected abstract TClientRoom CreateClientRoom(PhotonClientWrapper photonClientWrapper,
                                                 IMessageSerializationHandler messageSerializationHandler,
                                                 Action <ClientRoom <TPlayer> > initializedCallback);
Example #8
0
 protected override ITAlertClientRoom CreateClientRoom(PhotonClientWrapper photonClientWrapper,
                                                       IMessageSerializationHandler messageSerializationHandler,
                                                       Action <ClientRoom <ITAlertPlayer> > initializedCallback)
 {
     return(new ITAlertClientRoom(photonClientWrapper, messageSerializationHandler, initializedCallback));
 }
Example #9
0
 public ITAlertPhotonClient(string gamePlugin, string gameVersion, IMessageSerializationHandler messageSerializationHandler)
     : base(gamePlugin, gameVersion, messageSerializationHandler)
 {
 }
Example #10
0
 public Messenger(IMessageSerializationHandler serializationHandler, PhotonClientWrapper photonClientWrapper)
 {
     _serializationHandler = serializationHandler;
     _photonClientWrapper  = photonClientWrapper;
 }
 public ITAlertRoomControllerPlugin(IMessageSerializationHandler messageSerializationHandler,
                                    IRoomStateControllerFactory <ITAlertRoomStateController, ITAlertRoomState, ITAlertPlayerManager, ITAlertPlayer> roomStateControllerFactory,
                                    ExceptionHandler exceptionHandler)
     : base(messageSerializationHandler, roomStateControllerFactory, exceptionHandler)
 {
 }
Example #12
0
 public RabbitMQDefaultMapper(ILoggerFactory loggerFactory, IMessageSerializationHandler serializationHandler)
 {
     _logger = loggerFactory.CreateLogger(nameof(RabbitMQDefaultMapper));
     _serializationHandler = serializationHandler;
 }