消息队列与套接字 [英] Message queues vs sockets

查看:136
本文介绍了消息队列与套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有太多的套接字编程经验,但是我尝试阅读一些有关它的内容.我对MDB和消息传递队列非常熟悉.有人告诉我,队列(例如MDB)只不过是直接套接字连接".有人可以为我比较这两个.

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.

推荐答案

eeeeemph ...这个人是非常错误的.两者无可比拟,因为它们生活在不同的层次.就像说关系数据库只不过是磁盘上的文件"或房子只不过是砖头"一样.

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.

这篇关于消息队列与套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆