ZeroMQ 持久化模式
谁必须管理 ZeroMQ 中的持久性?
当我们使用Python语言的ZeroMQ客户端时,有哪些插件/模块可用于管理持久性?
我想知道使用 ZeroMQ 的模式。
Who has to manages the persistent in the ZeroMQ?
When we use the ZeroMQ clients in Python language, what are the plug-ins/modules available to manage the persistent?
I would like to know the patterns to use the ZeroMQ.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知,Zeromq没有任何持久性。它超出了它的范围,需要由最终用户处理。就像序列化消息一样。
在 C# 中,我使用 db4o 来添加持久性。通常,我将对象保留为其原始状态,然后将其序列化并将其发送到 ZMQ 套接字。顺便说一句,这是针对 PUB/SUB 对的。
As far as I know, Zeromq does not have any persistence. It is out of scope for it and needs to be handled by the end user. Just like serializing the message.
In C#, I have used db4o to add persistence. Typically I persist the object in its raw state, then serialize it and send it to ZMQ socket. Btw, this was for PUB/SUB pair.
在应用程序端,您可以相应地进行持久化,例如,我在 node.js 中构建了一个持久层,它通过 websocket 与后端 php 调用进行通信。
持久性方面将消息保留一段时间(http://en.wikipedia.org/wiki/Time_to_live),这是为了给客户端提供连接的机会。我使用了内存数据结构,但也考虑过使用 Redis 来获得磁盘持久性。
On the application ends you can persist accordingly, for example I've built a persistance layer in node.js which communicated to back-end php calls and via websockets.
The persistance aspect held messages for a certain period of time (http://en.wikipedia.org/wiki/Time_to_live) this was to give clients a chance to connect. I used in-memory data structures but I toyed with the idea of using redis to gain on-disk persistance.
在处理之前,我们需要保留从订阅者处收到的消息。消息在单独的线程中接收并存储在磁盘上,而持久化的消息队列在主线程中进行操作。
该模块位于:https://pypi.org/project/persizmq。从文档中:
We needed to persist the received messages from a subscriber before processing them. The messages are received in a separate thread and stored on disk, while the persisted message queue is manipulated in the main thread.
The module is available at: https://pypi.org/project/persizmq. From the documentation: