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. HTML5 Canvas图片操作简单实例1

    1.加载显示图片 <canvas id="canvasOne" class="myCanvas" width="500" height ...

  2. Asp.Net--上传大文件(页面超时)

    几个方法: 修改文件上传大小的限制 以文件形式保存到服务器 转换成二进制字节流保存到数据库 将二进制通过循环的方式写入磁盘 一.修改文件上传大小的限制 通过对web.config和machine.co ...

  3. Canvas--2

    Canvas2(关键词:setLineDash .rect .strokeRect .clearRect .arc.sin .strokeText )   绘制其他样式: lineCap 结束端点的设 ...

  4. web离线应用

    其实浏览器一直都是前端开发人员比较头痛的一个课题,各种兼容性.直到开始规范化和标准化,HTML5的出现. 在没有这套标准出现之前,对于客户端缓存的问题,我们基本上都是用cookie处理,当然目前除了后 ...

  5. 状态压缩dp zoj3802

    做这个题的时候看了看时间复杂度觉得应该是个贪心或者dp,然后贪心又很快被否定了,因为不具备贪心的一些特性,想了想觉得没什么思路.看了下网上的思路,真是让人拍案叫绝,算法的魅力就在于此啊.. 首先dp就 ...

  6. Thinking in Java——笔记(21)

    Concurrency However, becoming adept at concurrent programming theory and techniques is a step up fro ...

  7. Awesome Go

    A curated list of awesome Go frameworks, libraries and software. Inspired by awesome-python. Contrib ...

  8. Handler处理长时间事件

    当我们在处理一些比较长时间的事件时候,比如读取网络或者数据库的数据时候,就要用到Handler,有时候为了不影响用户操作应用的流畅还要开多一个线程来区别UI线程,在新的线程里面处理长时间的操作.开发的 ...

  9. bash与sh的区别

    在shell脚本的开头往往有一句话来定义使用哪种sh解释器来解释脚本.目前研发送测的shell脚本中主要有以下两种方式:(1) #!/bin/sh(2) #!/bin/bash在这里求教同福客栈的各位 ...

  10. 一位搬家师傅的O2O之旅

    一位搬家师傅的O2O之旅 By 诸神之黄昏 | 2014/08/14 [核心提示] 一位普通的搬家师傅,无意中被卷入如火如荼的 O2O 浪潮,起初,互联网让他尝到了甜头,后来则是更多的困惑和不解. 再 ...