zoukankan      html  css  js  c++  java
  • 【消息传输123】JMS

     背景:

    上游系统要做Migration,其中中间接口部分从MQ换到更便宜的JMS Topic。

    从测试和质量保证的角度需要Cover哪些环节?

    功能上的显而易见通过E2E SIT来tracking。

    另外还有重要一个环节,从本身MQ和JMS Topic的不同之处,需要考虑消息传输的可靠安全性。

    由于项目需要,还要熟悉相关英语专业术语词汇。

    https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.explorer.doc/j_destination.htm

    一、Topic 和 Queue

    In point-to-point messaging, destinations represent queues;

    in publish/subscribe messaging, destinations represent topics. Consumers can subscribe to a particular topic, or channel, and receive all messages within the chosen topic. This model is asynchronous.

    Topic: Best-Effort Delivery

    MQ: Guaranteed Delivery

    SUMMARY:

    1.The point-to-point or queue model works by the sender to receiver setup. On the other hand, publisher/subscriber or topic model works by bulletin setup.

    2.In the queue model there is acknowledgement of the identity of the receiver and oftentimes the sender. In the topic model there is anonymity in the identities of both the subscriber and publisher.

    3.Queue model is only allowed one recipient; topic, on the other hand, can have multiple recipients.

    4.In queue model, the sender and receiver do not have to be both active at the same time. In the topic model, timing is very vital.

    5.In the queue model, the sender will receive a notification when the message gets to the receiver. The topic model, on the other hand, will not notify you with such, and there is even a risk that you will have no subscribers.

    其他参考:https://www.cnblogs.com/cathygx/p/10727847.html

    二、Durable持久

    https://www.cnblogs.com/austinspark-jessylu/p/7827638.html

    几种情况:

    1. 生产者发送持久消息和非持久消息,但是消息没有消费者,即这是一条无用消息; 无论是持久消息,还是非持久消息,如果消息没有对应的消费者,那么activeMQ会认为这些消息无用,直接删除。

    2. 生产者发送持久消息和非持久消息,只有非持久订阅者; 非持久订阅者只有在活动状态,并且和jms provider的保持连接情况下,才能收到消息。如果非持久订阅者挂掉了,那么不能再接收任何消息(无论是持久消息,还是非持久消息)。如果订阅者挂掉了,后续jms provider再收到消息,就变成了上述情况1。也就是说:消息是否持久化,和非持久订阅者没有关系。

    3. 发送者发送持久消息和非持久消息,只发送给离线的持久订阅者;持久订阅者能够接收离线消息, 不管该消息是不是持久消息。

    我们好像还看不出持久消息和非持久消息的区别,这是因为我们进行上述测试的时候,没有关闭activeMQ服务器,所以无论是硬盘上的持久消息,还是内存中的非持久消息,都不会丢。

    4. 当activeMQ服务器挂掉再重启的时候,持久订阅者只能收到持久消息,不能收到非持久消息。

    总结:

    持久订阅者/非持久订阅者,只影响离线的时候消息(包括持久消息和非持久消息)是否能接收到,和消息是否持久无关;

    持久消息/非持久消息,只是影响jms provider宕机后,消息是否会丢失,如果永远不会宕机,那么持久消息和非持久消息没有区别。

    扩展:

    1. 参考其他上游应用系统,在Publisher上加装一个EarlyMonitor+WarningMechanism,实时监控出口Topic的性能指标,一旦发现异常情况(预定义),可及时中断Publish来一定成度上提高可靠性。

    2. 这篇是在MQ两端搭建Topic连接Producers和Customs实现,既能满足Destination分离的需求,又能满足Message Keep in Order的需求。

    不过很显然,在经过前端第一个Topic时候,也可能会出现Unsafe Transport情况。

    https://solace.com/blog/topic-subscription-queues/

  • 相关阅读:
    DAY13-前端之JavaScript
    DAY12-前端之CSS
    DAY12-前端之HTML
    DAY11-MYSQL之ORM框架SQLAlchemy
    DAY11-MYSQL视图、触发器、事务、存储过程、函数
    DAY11-MYSQL数据备份、pymysql模块
    DAY11-MYSQL索引原理与慢查询优化
    020.2.2 runtime类
    020.2.1 system
    020.1.2 Arrays集合工具类
  • 原文地址:https://www.cnblogs.com/cathygx/p/10827745.html
Copyright © 2011-2022 走看看