コード例 #1
0
        public void SendMessage(RedisChannels channel, RedisMessage message = null)
        {
            message = message ?? new DefaultRedisMessage();

            string str = JsonConvert.SerializeObject(message, new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.Objects
            });
            #if log

            Console.WriteLine("Sending Message: " + channel + "    " + str);
            Console.WriteLine();
            #endif

            database.ListLeftPush($"{channel}-bl", str);
            subscriber.Publish(channel.ToString(), "");
        }
コード例 #2
0
        public Task<RedisMessage> AskQuestion(RedisChannels channelEnum, RedisMessage message = null)
        {
            var channel = channelEnum.ToString();

            message = message ?? new DefaultRedisMessage();

            string str = JsonConvert.SerializeObject(message, new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.Objects
            });
            #if log

            Console.WriteLine("Asking Question: " + channel + "    " + str);
            Console.WriteLine();
            #endif
            database.ListLeftPush($"{channel}-bl", str);
            subscriber.Publish(channel, "");

            return lateTaskManager.Build(message.Guid);
        }