Message queues vs sockets

本小妞迷上赌 提交于 2019-12-03 22:20:32

eeeeemph... this someone was very wrong. The two are incomparable, as they live in different layers. It's like saying that "a relational database is not much more than a file on a disk" or "a house is not much more than a brick".

Messaging queue is a piece of software that glues senders and receivers so that they can communicate without knowing much about each other (they both need to know about the queue, of course) and do not need to implement networking code, handling failure, routing one message to many receivers etc. The system works even if senders and receivers are never alive at the same time, as queues also serve as a temporary storage for undelivered messages. Aside from that, queues can provide additional services, like authorization, transactions etc.

A socket connection is just a low-level abstraction that says: "currently two programs can send data over network to each other, at least until connection breaks for some reason". So yes, usually a messaging queue will use socket connections in order to work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!