Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net core 发布后未触发dotnet core订阅服务器_.net Core_Redis_Publish Subscribe_Stackexchange.redis_Subscribe - Fatal编程技术网

.net core 发布后未触发dotnet core订阅服务器

.net core 发布后未触发dotnet core订阅服务器,.net-core,redis,publish-subscribe,stackexchange.redis,subscribe,.net Core,Redis,Publish Subscribe,Stackexchange.redis,Subscribe,我正在dotnetcore中开发一个Redis(StackExchange.Redis)PUBSUB系统,在我发布到我的频道之前,一切都正常工作。订户永远不会被触发 这是我的密码: program.cs public static void Main(string[] args) { _ = RunConsumer(); BuildWebHost(args).Run(); } 出版商 // ... code th

我正在dotnetcore中开发一个Redis(StackExchange.Redis)PUBSUB系统,在我发布到我的频道之前,一切都正常工作。订户永远不会被触发

这是我的密码:

program.cs

public static void Main(string[] args)
        {
            _ = RunConsumer();
            BuildWebHost(args).Run();
        }

出版商

// ... code that creates my key

// add my data to a batch and save it to redis
batchTasks.Add(batch.ListRightPushAsync("jobs", key));
batch.Execute();
Task.WaitAll(batchTasks.ToArray());

// publishing
ISubscriber sub = _connection.GetSubscriber();
await sub.PublishAsync("uploaded", key);
var db = _connection.GetDatabase();
ISubscriber sub = _connection.GetSubscriber();

// it will never pass here
            await sub.SubscribeAsync("uploaded", async (channel, value) =>
            {
                var key = (await db.ListLeftPopAsync("jobs")).ToString();
               // do my stuff here
            });

订户

// ... code that creates my key

// add my data to a batch and save it to redis
batchTasks.Add(batch.ListRightPushAsync("jobs", key));
batch.Execute();
Task.WaitAll(batchTasks.ToArray());

// publishing
ISubscriber sub = _connection.GetSubscriber();
await sub.PublishAsync("uploaded", key);
var db = _connection.GetDatabase();
ISubscriber sub = _connection.GetSubscriber();

// it will never pass here
            await sub.SubscribeAsync("uploaded", async (channel, value) =>
            {
                var key = (await db.ListLeftPopAsync("jobs")).ToString();
               // do my stuff here
            });