Difference between Point-To-Point and Publish/Subscribe JMS Messaging Models

 

Point-to-Point (PTP) and Publish/Subscribe (Pub/Sub) are two types of messaging models or messaging domains provided by JMS. Both of these have significant differences and should be used as per the application’s requirement. For instance, point-to-point messaging should be used when each message delivered by a producer should be consumed successfully by one receiver andpublish/subscribe messaging should be used when each message delivered by a producer should be consumed by zero or more receivers.

Here is a more detailed difference between the two messaging models:

 

Point-to-Point (Queue)

Publish-Subscribe (Topic)

1. Each message is addressed to a virtual channel known as Queue Each message is addressed to a virtual channel know as Topic
2. One-to-One i.e. a message delivered by a producer is consumed by only one receiver One-to-Many i.e. a message delivered by a producer (publisher) can be consumed by zero or more receivers (subscribers)
3. A queue can have multiple receivers, but each message is consumed by only one receiver A topic can have multiple receivers and every receiver receives a copy of each message
4. Pull-based model i.e. client polls the queue for new messages and sends the request Push-based model i.e. messages are broadcasted to all the subscribers without them having to poll the topic
5. Messages are retained in the queue until they are delivered to the receiver. The receiver can fetch the message even if it was not running when producer sent the messages. Messages are retained in the topic until they are delivered to the “current“ subscribers.There is an option to have durable subscriptions in pub-sub model which allows the subscriber to dis-connect, reconnect again and collect the messages that were delivered when it was not active.
6. The receiver acknowledges the successful processing of a message. Acknowledgment is optional.

Thus whether to use queue or topic as JMS message destination, depends solely on the requirements of a specific application.

转自: http://verticalhorizons.in/difference-between-point-to-point-and-publishsubscribe-jms-messaging-models/

【转】Difference between Point-To-Point and Publish/Subscribe JMS Messaging Models的更多相关文章

  1. 使用Guava EventBus构建publish/subscribe系统

    Google的Guava类库提供了EventBus,用于提供一套组件内publish/subscribe的解决方案.事件总线EventBus,用于管理事件的注册和分发.在系统中,Subscribers ...

  2. 【RabbitMQ】Publish/Subscribe

    Publish/Subscribe 在上一节我们创建了一个work queue.背后的设想为每个任务被分发给明确的消费者.这节内容我们将做一些完全不同的事情 -- 我们将发送一条消息给多个消费者.这种 ...

  3. publish/subscribe

    Pub/Sub功能 Pub/Sub功能(means Publish, Subscribe)即发布及订阅功能.基于事件的系统中,Pub/Sub是目前广泛使用的通信模型,它采用事件作为基本的通信机制,提供 ...

  4. Mina、Netty、Twisted一起学(七):发布/订阅(Publish/Subscribe)

    消息传递有很多种方式,请求/响应(Request/Reply)是最常用的.在前面的博文的例子中,很多都是采用请求/响应的方式,当服务器接收到消息后,会立即write回写一条消息到客户端.HTTP协议也 ...

  5. RabbitMQ(三) -- Publish/Subscribe

    RabbitMQ(三) -- Publish/Subscribe `rabbitmq`支持一对多的模式,一般称为发布/订阅.也就是说,生产者产生一条消息后,`rabbitmq`会把该消息分发给所有的消 ...

  6. ZeroMQ之Publish/Subscribe (Java)

    前面的文章介绍了比较简单的Request/Subscribe模式, 这篇文章介绍更为经典的Publish/Subscribe通信模式用来ZeroMQ的实现,其通信方式如下图: 客户端(subscrib ...

  7. RabbitMQ学习总结 第四篇:发布/订阅 Publish/Subscribe

    目录 RabbitMQ学习总结 第一篇:理论篇 RabbitMQ学习总结 第二篇:快速入门HelloWorld RabbitMQ学习总结 第三篇:工作队列Work Queue RabbitMQ学习总结 ...

  8. (转)RabbitMQ消息队列(四):分发到多Consumer(Publish/Subscribe)

    上篇文章中,我们把每个Message都是deliver到某个Consumer.在这篇文章中,我们将会将同一个Message deliver到多个Consumer中.这个模式也被成为 "pub ...

  9. javascript设计模式——Publish/Subscribe

    推荐阅读http://dev.housetrip.com/2014/09/15/decoupling-javascript-apps-using-pub-sub-pattern/ 我们先引出问题的所在 ...

随机推荐

  1. 网页JavaScript2

    window.close()     关闭网页, window.opener.close()    关闭打开当前窗口的源窗口 间隔与延迟 window.setlnterval("执行代码&q ...

  2. input事件以及中文输入法的处理

    在项目的开发过程中,相信大家都处理过监听用户输入的事情,一般我们会用到onkeyup.onkeydown.onkeypress.onchange.oninput事件,虽然都很熟悉了,但是还是有必要巩固 ...

  3. (转)SQL Server 2008将数据导出为脚本 [SQL Server]

    之前我们要将一个表中的数据导出为脚本,那么只有在网上找一个导出数据的Script,然后运行就可以导出数据脚本了.现在在SQL Server 2008的Management Studio中增加了一个新特 ...

  4. QueryFilter与SpatialFilter - 浅谈

    我们知道,GIS不仅仅有属性查询,还有空间查询.而 QueryFilter 对应于 属性查询,而 SpatialFilter 对应于 空间查询.

  5. 17--Box2D使用(三、触摸交互)

    Box2D引擎与触摸的交互通过创建鼠标关节以及碰撞检测来得到触摸点下面的刚体,在根据触摸操作完成相应的功能.首先添加触摸响应函数声明 virtual void ccTouchesBegan(cocos ...

  6. PHP学习系列(1)——字符串处理函数(2)

    6.chunk_split() 函数把字符串分割为一连串更小的部分.本函数不改变原始字符串. 语法:chunk_split(string,length,end) 参数: string——必需.规定要分 ...

  7. Python 一路走来 HTML CSS Javascript

    前端三把利器 HTML          -标签 (成对写不容易忘记闭合)                     自闭和标签           标签里写个 xx=xx, 表示标签的属性       ...

  8. 阿里云服务器上架设apache php mysql 环境

    由于朋友一公司要做企业站,于是就买了阿里云的服务器.买完进去发现iptables 和selinux默认就是关掉的,可能是因为阿里云有云盾就可以不用自带的防火墙吧,具体配置过程如下(我边配边记录的): ...

  9. Python 基础教程中的问题及解决方案(1)

    1. 在ubuntu中,调用终端时如: f = open('/home/theone/test_input.txt', 'r') 中的txt格式文本不能加后缀 正确的应为:  f = open('/h ...

  10. 在jsp页面中使用自定义标签

    在某些场景中,自定义标签可封装大量代码,使页面变得更简洁,标签也可以很方便地在不同页面中实现通用而不必去粘贴大量的js代码.现在把最近做的一个自定义标签在这里总结一下.首先总结一下关于自定义标签的一些 ...