.net core 发布后未触发dotnet core订阅服务器
我正在dotnetcore中开发一个Redis(StackExchange.Redis)PUBSUB系统,在我发布到我的频道之前,一切都正常工作。订户永远不会被触发 这是我的密码: program.cs.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
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
});