Example #1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMessageQueueHandler mqHandler)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseCors("CorsPolicy");

            app.UseAuthentication();

            app.UseHttpsRedirection();

            app.UseMvc();

            app.UseSignalR(routes =>
            {
                routes.MapHub <ChatHub>("/chat");
            });

            mqHandler.Launch();
        }
Example #2
0
    public EntryPoint_World(IMessageQueueHandler queueHandler)
    {
        EntryPoint_World.queueHandler = queueHandler;
#if UNITY_WEBGL && !UNITY_EDITOR
        SetCallback_CreateEntity(CreateEntity);
        SetCallback_RemoveEntity(RemoveEntity);
        SetCallback_SceneReady(SceneReady);

        SetCallback_SetEntityId(SetEntityId);
        SetCallback_SetSceneId(SetSceneId);
        SetCallback_SetTag(SetTag);

        SetCallback_SetEntityParent(SetEntityParent);

        SetCallback_EntityComponentCreateOrUpdate(EntityComponentCreateOrUpdate);
        SetCallback_EntityComponentDestroy(EntityComponentDestroy);

        SetCallback_SharedComponentCreate(SharedComponentCreate);
        SetCallback_SharedComponentAttach(SharedComponentAttach);
        SetCallback_SharedComponentUpdate(SharedComponentUpdate);
        SetCallback_SharedComponentDispose(SharedComponentDispose);

        SetCallback_OpenExternalUrl(OpenExternalUrl);
        SetCallback_OpenNftDialog(OpenNftDialog);

        SetCallback_Query(Query);
#endif
    }
        public MessageEntranceTest()
        {
            this.PlatformMessageInQueue = new PlatformMessage()
            {
                Command = new ScrapyCore.Core.Platform.Commands.Command()
                {
                    CommandCode = ScrapyCore.Core.Platform.Commands.CommandCode.Configure,
                    CommandType = ScrapyCore.Core.Platform.Commands.CommandTransfer.Random
                }
            };
            this.PlatformMessageInMemory = new PlatformMessage()
            {
                Command = new ScrapyCore.Core.Platform.Commands.Command()
                {
                    CommandCode = ScrapyCore.Core.Platform.Commands.CommandCode.HeartBeat,
                    CommandType = ScrapyCore.Core.Platform.Commands.CommandTransfer.Forward
                }
            };

            IMessageQueueHandler <PlatformMessage> messageQueueHandler = Moq.Mock.Of <IMessageQueueHandler <PlatformMessage> >();

            Moq.Mock.Get(messageQueueHandler).Setup(x => x.MessageObject).Returns(PlatformMessageInQueue);
            IMessageQueue messageQueue = Moq.Mock.Of <IMessageQueue>();

            Moq.Mock.Get(messageQueue).Setup(x => x.GetMessage <PlatformMessage>())
            .Returns(Task.FromResult(messageQueueHandler));

            messageEntrance = new MessageEntrance(messageQueue);
        }
        public void Setup()
        {
            _messageQueueHandler = new MessageQueueHandler(Guid.Empty);

            _message = new Message
            {
                DataSize    = 1,
                ServiceSize = 1,
                Route       = new Channel[0]
            };
        }
Example #5
0
        private void ReplaceMessageInChannel(Channel channel, Message message,
                                             IMessageQueueHandler messageQueueHandler)
        {
            var isSuccess = TryMoveMessageToChannel(channel, message);

            messageQueueHandler.RemoveMessage(message);

            if (!isSuccess)
            {
                if (message.MessageType == MessageType.SendingRequest)
                {
                    var sender = _network.GetNodeById(message.LastTransferNodeId);
                    _messageReceiver.HandleReceivedMessage(sender, message);
                }
                else
                {
                    messageQueueHandler.AddMessageInStart(message);
                }
            }
            else
            {
                _handledMessagesInNode.Add(message);
            }
        }
Example #6
0
 public SportReader(IMessageQueueHandler messageQueueHandler)
 {
     leagueAndTeamsToGames =
         new ConcurrentDictionary <Tuple <string, string, string>, List <Game> >();
     this.messageQueueHandler = messageQueueHandler;
 }
Example #7
0
 public StorageBL(IMessageQueueHandler <Game> messageQueueHandler, IStorageRepo dbRepo)
 {
     this.messageQueueHandler = messageQueueHandler;
     this.dbRepo = dbRepo;
 }
Example #8
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="currentQueue">当前消息处理器</param>
 /// <param name="message">当前消息</param>
 public MessageReceivedEventArgs(IMessageQueueHandler currentQueue, IMessage message)
 {
     Handler = currentQueue;
     Message = message;
 }
Example #9
0
 public SoccerReader(IMessageQueueHandler messageQueueHandler) : base(messageQueueHandler)
 {
     sportType = SportType.Soccer;
 }