在高速公路的pubsub中获取初始值的设计模式

编程入门 行业动态 更新时间:2024-10-22 22:54:27
本文介绍了在高速公路的pubsub中获取初始值的设计模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

通常,发布-订阅模式与获取内容更新有关.但是,订阅者如何获得订阅更新之前的初始内容?

Normally, a publish-subscribe pattern is about fetching content updates. But how do subscribers get initial content that was there before they subscribed for updates?

我在我的应用程序的高速公路框架内使用发布-订阅示例.当关节移动时,发布者后端发布机器人关节的位置.客户端前端有时稍后会订阅该主题.由于数据的性质,客户端上主题"的初始值与发布者随后进行的更新一样重要.因此,在建立成功的连接之后,我想获取该主题的当前"值.

I'm using publish-subscribe examples within autobahn framework for my application. The publisher backend publishes a position of the robotic joint when the joint moves. The client frontend subscribes to the topic sometimes later. Due to the nature of the data, the initial value of the "topic" on the client is just as important as subsequent updates made by the publisher. So right after a successful connection is established, I'd like to fetch the "current" value of the topic.

框架内是否可以使用某种类型的设计模式来获取当前"值(订阅前的值)?我可以想到某种单独的RPC服务来获取它,但似乎它将通过一个单独的交付渠道.理想情况下,我希望发布者注意到我刚刚订阅并将初始值推送给单个客户或类似的东西,但这可能要问的太多了,不是吗?

Is there some type of design pattern within the framework that I can leverage to get the "current" value (the value prior to subscription)? I can think of some sort of separate RPC service for fetching it, but it seems that it will be going through a separate delivery channel. Ideally, I would want for the publisher to notice that I just subscribed and push the initial value to the individual client, or something of that sort, but that might be too much to ask, or is it not?

推荐答案

理想情况下,我希望发布者注意到我刚刚订阅并将初始值推送给各个客户

Ideally, I would want for the publisher to notice that I just subscribed and push the initial value to the individual client

这是一个非常好的用例和所需的行为..实际上,它在WAMP Advanced Profile 的功能列表中: github/tavendo/WAMP/issues/69

This is a pefectly fine use case and desired behavior .. in fact, it's on the feature list for the WAMP Advanced Profile: github/tavendo/WAMP/issues/69

这似乎已经很清楚地定义了,并且在路由器中实现起来并不是特别困难..但是它需要路由核心中的代码.

This seems sufficiently clearly defined already and isn't particular hard to implement in routers .. but it needs code in the routing core.

更多推荐

在高速公路的pubsub中获取初始值的设计模式

本文发布于:2023-10-29 08:09:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539171.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:高速公路   模式   初始值   pubsub

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!