后浪笔记一零二四

4主题(Subject)命名及通配符的使用

主题

主题就是一个字符串表示的名称,能确保发布者和订阅者可以使用该名称来查找对方。

主题命名

推荐字符: a to z, A to Z, 0 to 9 (大小写敏感,不能有空格).

特殊字符: 区分层次结构用“.”,两个通配符: “*”,“>

主题层次结构

order.sys

order.third

order.sys.created

order.third.finished

通配符的使用

                                                  +-msg-->{SUB order.*.created}
[PUB order.sys.created]------msg-->(nats-server)--+
                                                  +-msg-->{SUB order.sys.created}

                                                  +-msg-->{SUB order.sys.notify.email}
[PUB order.sys.notify.email]-msg-->(nats-server)--+       {SUB order.sys.*}<---不能匹配
                                                  +-msg-->{SUB order.sys.>}

*: 表示同级的匹配

>: 表示所有子级的匹配

问题

订阅可以使用通配符,同理,发送消息能使用通配符么?


专题:

本文发表于 2022-01-01,最后修改于 2022-01-01。

本站永久域名「 jiavvc.top 」,也可搜索「 后浪笔记一零二四 」找到我。


上一篇 « 3Go SDK的使用 下一篇 » 1jetstream理论篇

赞赏支持

请我吃鸡腿 =^_^=

i ysf

云闪付

i wechat

微信

推荐阅读

Big Image