Message queues vs sockets

二次信任 提交于 2019-12-05 09:33:51

问题


I don't have much of a socket programming experience but I tried read a little about it. I am quite familiar with MDB and messaging queues. Someone has told me that queue(e.g. MDB) is "Not much more than a direct socket connection". Can someone compare these two for me.


回答1:


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.



来源:https://stackoverflow.com/questions/10668028/message-queues-vs-sockets

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