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. AnkhSVN 中文版 支持VS2015

    简介:AnkhSVN是一款在VS中管理Subversion的插件,您可以在VS中轻松的提交.更新.添加文件,而不用在命令行或资源管理器中提交,而且该插件属于开源项目. 这个版本是简体中文的重新编译版本 ...

  2. 用Ant实现Java项目的自动构建和部署(转)

    Ant是一个Apache基金会下的跨平台的构件工具,它可以实现项目的自动构建和部署等功能.在本文中,主要让读者熟悉怎样将Ant应用到Java项目中,让它简化构建和部署操作. 一.            ...

  3. CSS Hack是什么意思

    CSS hack由于不同的浏览器,比如Internet Explorer 6,Internet Explorer 7,Mozilla Firefox等,对CSS的解析认识不一样,因此会导致生成的页面效 ...

  4. MVC 5.0 之奇葩错误-<类型“ASP._Page__ViewStart_cshtml”不从“System.Web.WebPages.StartPage”继承>

    在实际项目中,我们通常添加MVC项目会先添加一个MVC Empty 的项目,然后需要什么在往里面添加. 但是Empty项目里面只有一个路由注册,而且没有_ViewStart.cshtml文件需要自己添 ...

  5. Jquery JSOPN在WebApi中的问题

    1. 客户端代码: $.ajax({ data: { name: 'zhangsan' }, url: apiUrl.getTwo('TestFourth'), dataType: 'jsonp', ...

  6. 官方recovery签名验证的破解教程

    下面讲如何破解官方recovery签名验证(这个方法应该是通用的,其他手机可以参考,recovery签名验证破解了,也不用费力编译第三方recovery) 1.从官方ROM里提取recovery.im ...

  7. windows下adb+flash_image刷机

    刷机是常事,总要把刷机包放在卡上,然后关机三键一起按到recovery再刷,觉得不爽,麻烦,所以研究出了adb调用flash_image刷system分区,全部脚本windows脚本执行,点点鼠标就o ...

  8. CM源码同步编译教程

    一.操作系统 准备一个ubuntu安装镜像,我用的是12.10. 安装系统时请安装到30g以上的盘,最好就50g以上啦 安装教程不多说,网上很多教程,这里我推荐用自带的wubi工具安装,比较方便 用虚 ...

  9. 使用 ExpandableListView 实现折叠ListView

    1:layout/expandablelistview_groups.xml 标题文件 <?xml version="1.0" encoding="utf-8&qu ...

  10. QT类的继承结构

    QT类的继承结构 QT的类 core 数据集合 QString 几何类 QPoint QSize QRectangle 系统类 QColor QFont QImage QIcon QCursor QB ...