public ChannelMessageQueue Subscribe(RedisChannel channel, CommandFlags flags = CommandFlags.None)
    {
        // Workaround for https://github.com/StackExchange/StackExchange.Redis/issues/969
        var redisSubscriberType = typeof(RedisChannel).Assembly.GetType("StackExchange.Redis.RedisSubscriber");
        var ctor = typeof(ChannelMessageQueue).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic,
                                                              binder: null,
                                                              new Type[] { typeof(RedisChannel).MakeByRefType(), redisSubscriberType }, modifiers: null);

        var queue = (ChannelMessageQueue)ctor.Invoke(new object[] { channel, null });

        _server.Subscribe(queue, _id);
        return(queue);
    }
예제 #2
0
 public void Subscribe(RedisChannel channel, Action <RedisChannel, RedisValue> handler, CommandFlags flags = CommandFlags.None)
 {
     _server.Subscribe(channel, handler, flags);
 }