监听所有通知,如 `LISTEN *`

huangapple go评论47阅读模式
英文:

Listen to all notifications like `LISTEN *`

问题

是否可以监听由PostgreSQL广播的所有通知?例如,类似于LISTEN *这样的方式,而不必创建任何临时通道,如all_channels?我需要这样做来最小化正在监听通知的活动连接数量。想象一下,可能会有200个通道,这种方法实际上可以将捕获所有通知的活动连接数量最小化为仅为1。

英文:

Is it possible to listen to all notification that are broadcast by Postgress? For example something like LISTEN * without having to create any ad-hoc channels like all_channels? I need this to minimize the number of active connection that are listening to notifications. Imagine that there would be 200 channels, this approach can actually minimize the number of active connections to only 1 for capturing all notifications.

答案1

得分: 0

不,这是不可能的。尝试设计一个需要更少通道的方案,也许你可以通过通知的有效负载来区分:

通知通道,'4711';
英文:

No, that is not possible. Try to come up with a design that needs fewer channels – perhaps you can differentiate via the payload of the notification:

NOTIFY channel, '4711';

huangapple
  • 本文由 发表于 2023年7月13日 19:20:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76678799.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定