Ejemplo n.º 1
0
        public void SendMessage(RedisChannels channel, RedisMessage message = null)
        {
            message = message ?? new DefaultRedisMessage();


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

            database.ListLeftPush($"{channel}-bl", ObjectToByteArray(message));
            subscriber.Publish(channel.ToString(), "");
        }
Ejemplo n.º 2
0
        public Task <RedisMessage> AskQuestion(RedisChannels channelEnum, RedisMessage message = null)
        {
            var channel = channelEnum.ToString();

            message = message ?? new DefaultRedisMessage();


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

            return(lateTaskManager.Build(message.Guid));
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public void SubscribeToAnswers(RedisChannels channel)
 {
     subscriber.Subscribe(channel.ToString(), onReceiveMessage);
 }
Ejemplo n.º 5
0
 public void Subscribe(RedisChannels channel, Action <RedisMessage> resolve)
 {
     subscriptions.Add(channel.ToString(), resolve);
     subscriber.Subscribe(channel.ToString(), onReceiveMessage);
 }
Ejemplo n.º 6
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(), "");
        }
Ejemplo n.º 7
0
 public void SubscribeToAnswers(RedisChannels channel)
 {
     subscriber.Subscribe(channel.ToString(), onReceiveMessage);
 }
Ejemplo n.º 8
0
 public void Subscribe(RedisChannels channel, Action<RedisMessage> resolve)
 {
     subscriptions.Add(channel.ToString(), resolve);
     subscriber.Subscribe(channel.ToString(), onReceiveMessage);
 }