TW201038019A - Message processing method and system - Google Patents

Message processing method and system Download PDF

Info

Publication number
TW201038019A
TW201038019A TW98110902A TW98110902A TW201038019A TW 201038019 A TW201038019 A TW 201038019A TW 98110902 A TW98110902 A TW 98110902A TW 98110902 A TW98110902 A TW 98110902A TW 201038019 A TW201038019 A TW 201038019A
Authority
TW
Taiwan
Prior art keywords
message
subscribing
group
node
connection
Prior art date
Application number
TW98110902A
Other languages
Chinese (zh)
Other versions
TWI477113B (en
Inventor
Xu-Qiang Yue
Lin Wang
zhen-wei Yao
Zuo-Hong Liu
Xian-Jie Ceng
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to TW098110902A priority Critical patent/TWI477113B/en
Publication of TW201038019A publication Critical patent/TW201038019A/en
Application granted granted Critical
Publication of TWI477113B publication Critical patent/TWI477113B/en

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present invention discloses a message processing method and system to solve the problem existed in the current message processing system, in which the message subscribing end is realized by a single node. In the method, an announcement end announces messages to a message mediator. Based on the message type, the message mediator searches for the grouping marker of the subscribing end corresponding to the message type. If found, the message mediator transmits the message to the node of the corresponding grouping at the subscribing end according to the searched grouping marker at the subscribing end. The present invention can avoid two problems in the prior art as follows: first, if one or more nodes at the subscribing end of message malfunctions, the other nodes in the group can continue to receive the message for processing, thereby preventing the interruption of processing; second, if the message flow is very large, it can be processed by plural nodes in a group, or process the pressure in a balanced way by adding the number of nodes at the subscribing end.

Description

201038019 六、發明說明: 【發明所屬之技術領域】 本發明關於網路技術領域,特別是關於一種訊息處理 方法及系統。 【先前技術】 在實際應用中,存在這樣一種業務系統: 0 系統包括訊息發佈端、訊息訂閱端和訊息中間件,訊 息發佈端和訊息訂閱端之間通過訊息中間件傳送訊息資料 。其中,該訊息發佈端可以發佈各種主題或各種類型的訊 息資料,該訊息訂閱端可以訂閱自己感興趣的訊息,該訊 息中間件要將訊息發佈端發佈的訊息非同步地傳送給該訊 息主題的訂閱端。所以,針對同一主題下的訊息,可以有 多個訂閱端同時訂閱。而訂閱端不同,每個訂閱端收到自 己訂閱的訊息後也會進行不同的處理。假設有兩個訂閱端 ❹ 分別(SubscriberA 和 SubscriberB)訂閱了 TopicA 這個 主題,兩個訂閱端收到訊息後分別進行各自的處理。 舉例說明,在電子交易過程中,當創建交易成功後, 交易處理系統(即訊息發佈端)會發出交易創建成功的通 知訊息。交易日誌伺服器(即訊息訂閱端)會訂閱該訊息 ,用於記錄交易日誌;而賣家通知伺服器(即另一訊息訂 閱端)也會訂閱該訊息,用於通知賣家有商品被購買。因 此,這兩種伺服器對同一個訊息有不同的處理。 類似的應用還有很多,這些業務系統中都存在多個訂 -5- 201038019 閱端訂閱同一訊息主題的情況,此時就需要訊息中間件將 同一主題的訊息傳送給不同的訂閱端。目前,這類系統的 實現方式是.每個訊息g了閱端都由一個節點構成,即只有 一台機器提供服務。但隨著業務的發展,系統處理的資料 量不斷增加,這種系統結構已不能滿足大資料量的處理, 常常存在以下問題: 第一,如果訊息訂閱端的節點出現故障,就可能無法 從訊息中間件接收自己訂閱的訊息;或者接收到訊息但無 法進行處理,即訂閱端的訊息處理過程會被中斷,從而影 響與之關聯的其他系統的處理; 第二’如果訊息流量非常大,一個節點的處理能力可 能達不到處理要求;而當訊息量超過一個節點的處理能力 後’只能通過升級硬體來解決,並且如果達到硬體的極限 ,則可能導致整個應用系統結構的修改。 【發明內容】 本發明所要解決的技術問題是提供一種訊息處理方法 及系統,以解決現有的訊息處理系統中訊息訂閱端由單節 點實現所存在的問題。 爲解決上述技術問題,根據本發明提供的具體實施例 ,本發明公開了以下技術方案: 一種訊息處理系統,包括:訊息發佈端、訊息訂閱端 和訊息中間件,其中, 該訊息訂閱端包括一個或多個分組,每組具有唯一標 -6- 201038019 識;每組訊息訂閱端又包括一個或多個節點,每個節點通 過本組的唯一標識連接到該訊息中間件; 該訊息發佈端用於將訊息發佈到訊息中間件; 該訊息中間件用於根據接收到的訊息的類型,查找對 應該訊息類型的訂閱端分組標識;如果查找到,則根據查 找到的訂閱端分組標識,將該訊息發送到相應訂閱端分組 中的一個節點上。 0 較佳的,該訊息訂閱端中的每個節點採用長連接方式 與訊息中間件連接,即每個訂閱端節點與訊息中間件在建 立連接後保持該連接。 其中,該訊息中間件從當前的連接中查找對應該訂閱 端分組標識的連接,如果查找到多個連接,則從中選擇一 個連接,並通過該連接將該訊息發送到該連接對應的節點 上。 其中,該訊息訂閱端節點用於對接收到的訊息進行相 〇 應處理。 其中,新增加的訊息訂閱端節點使用與本組其他節點 相同的標識連接到該訊息中間件。 較佳的,該系統還包括:資料庫,用於與該訊息中間 件連接,儲存訊息中間件接收到的訊息,以及訊息類型與 訂閱端分組標識的對應關係,以及每個訂閱端分組標識對 應的節點資訊。 較佳的,該訊息發佈端也包括一個或多個分組,每組 具有唯一標識;每組訊息分佈端又包括一個或多個節點, 201038019 每個節點通過本組的唯一標識連接到該訊息中間件。 本發明還提供了一種訊息處理方法,包括: 發佈端將訊息發佈到訊息中間件; 訊息中間件根據該訊息的類型,查找對應該訊息類型 的訂閱端分組標識; 如果查找到’則訊息中間件根據查找到的訂閱端分組 標識’將該訊息發送到相應訂閱端分組中的一個節點上。 較佳的,該訊息中間件根據查找到的訂閱端分組標識 ,將該訊息發送到相應訂閱端分組中的一個節點上,具體 包括:採用長連接方式,每個訂閱端節點與訊息中間件在 建立連接後保持該連接;從當前連接到訊息中間件的連接 中查找對應該訂閱端分組標識的連接,如果查找到多個連 接,則從中選擇一個連接;訊息中間件通過該連接將該訊 息發送到該連接對應的節點上。 其中’如果查找到多個連接,則從中隨機選擇一個連 接,或者輪詢每個連接。 其中’如果查找到多個訂閱端分組標識,則依次將該 訊息發送到每個訂閱端分組中的一個節點上。 較佳的’該發佈端將訊息發佈到訊息中間件之後,還 包括:訊息中間件將該訊息存入資料庫,並向該發佈端返 回發佈成功的訊息。 其中’該訊息中間件根據查找到的訂閱端分組標識, 將該訊息發送到相應訂閱端分組中的一個節點上之後,還 包括:收到訊息的訂閱端節點對該訊息進行相應處理。 201038019 較佳的,該發佈端將訊息發佈到訊息中間件,具體包 括:該發佈端包括一個或多個分組,每組包括一個或多個 節點;每組發佈端選擇其中一個節點將該組的訊息發佈到 訊息中間件。 根據本發明提供的具體實施例,本發明具有以下技術 效果: 首先’本發明通過將訊息訂閱端分組,每組再部署多 0 個節點的系統架構方式,由多個節點共同承擔一個訊息訂 閱端的工作。這樣,在訊息到達訊息中間件後,會從每個 分組標識下的節點中選擇一個節點,主動將訊息推送給訂 閱端節點。該方案能夠避免現有技術存在的兩個問題: 第一,如果訊息訂閱端的一個或幾個節點出現故障, 則可以由該組中的其他節點繼續接收訊息進行處理,因此 避免了處理被中斷的問題; 第二,如果訊息流量非常大,則可以由一組中的多個 © 節點來處理,或者通過增加訂閱端節點的方式來均衡處理 壓力。 其次,本發明採用長連接方式,即每個訂閱端節點與 訊息中間件在建立連接後保持該連接。這樣,在訊息中間 件收到訊息後,可以從當前建立的連接中查找訂閱端節點 的連接’主動將訊息推動給訂閱端節點。該連接方式由於 避免了建立、斷開連接的消耗,因此即時性很高’訊息能 夠以最快的速度發送給訂閱端。 再次’上述針對訊息訂閱端的方案同樣適用於訊息發 -9- 201038019 佈端。該訊息發佈端也可以分組’每組部署多個節點,發 佈訊息時選擇組內的一個節點進行發送。這樣,訊息發佈 端可以避免一個節點出故障而影響訊息的發佈;並且,如 果需要發佈的訊息流量非常大,可以通過一組內的多個節 點進行發佈,從而緩解了發佈端的處理壓力。 【實施方式】 爲使本發明的上述目的、特徵和優點能夠更加明顯易 懂,下面結合附圖和具體實施方式對本發明作進一步詳細 的說明。 本發明實施例提供了一種訊息處理系統,是對現有技 術中的訊息處理系統的改進。參照圖1,是實施例該系統 的結構圖。 該系統主要包括訊息發佈端U 1 1、訊息中間件u 1 2和 訊息訂閱端U 1 3,其中,該訊息發佈端U 1 1和訊息訂閱端 U 1 3分別與訊息中間件U 1 2的伺服器連接,訊息發佈端 U 1 1和訊息訂閱端U 1 3之間通過訊息中間件U 1 2傳送訊息 資料。 與現有技術不同的是,該訊息訂閱端U13按照用戶端 功能進彳了 了分組,如圖中的分組A、分組B......,每組有 一個分組ID作爲該組的唯一標識;而每組訊息訂閱端又 可以包括一個或多個節點,屬於同一個分組的訂閱端節點 具有相同的分組ID,所以每個訂閱端節點通過本組的ID 連接到該訊息中間件U 1 2。 -10- 201038019 該訊息發佈端U 1 1將訊息發佈到訊息中間件u 1 2的 伺服器上’訊息中間件U 1 2根據接收到的訊息的類型,查 找對應該訊息類型的訂閱端分組ID ;如果查找到,則根 據查找到的訂閱端分組ID,從分組中選擇一個節點,主 動將訊息推送給該節點。由於同一主題的訊息可以被多組 訊息訂閱端訂閱’所以一個訊息可能會發送給多組訊息訂 閱端,並且每組訊息訂閱端中只會有一個節點收到該訊息 ❹。 訂閱端節點收到訊息後,會進行相應的處理。相同分 組的訂閱端節點對訊息進行相同的處理,不同分組的訂閱 端節點對訊息進行各自的處理,而同一條訊息在一個分組 內只會由一個節點處理。例如,在電子交易過程中,交易 曰誌伺服器組的每台機器(即訊息訂閱端節點)收到交易 創建成功的訊息,都用於記錄交易日誌;而賣家通知伺服 器組的每台機器(即另一訊息訂閱端節點)收到交易創建 〇 成功的訊息,都用於通知賣家有商品被購買。 較佳的,該系統還可以包括資料庫U14,該資料庫 U 1 4與該訊息中間件u 1 2相連接,用於儲存訊息中間件 U 1 2接收到的訊息,以及訊息類型與訂閱端分組標識的對 應關係,以及每個訂閱端分組標識對應的節點資訊。當然 ’這些資訊也可以儲存在訊息中間件U 1 2伺服器設置的內 部儲存結構中,本實施例在此不作限定。 由上可知,該系統由於在訊息訂閱端部署了多個節點 ’由多個節點共同承擔一個訊息訂閱端的工作,所以具有 -11 - 201038019 容錯和處理大流量訊息的功能。具體分析如下: 第一 ’如果訊息訂閱端的一個或幾個節點出現故障, 則可以由該組中的其他節點繼續接收訊息進行處理,因此 避免了處理被中斷的問題’該系統具有良好的容錯功能; 第二’如果訊息流量非常大,則可以由一組中的多個 節點來處理,或者通過增加訂閱端節點的方式來均衡處理 壓力。 其中,上述的“共同”是指:某種訊息每秒鐘可能會 產生5 0 0條’假設一個分組有5個訂閱端節點,則是該的 5個節點去處理500條訊息,每個訂閱端節點處理1 00條 。如果有一個節點出現故障’則是其他4個訂閱端節點去 處理這500條訊息。這樣,整個系統就不會因爲一個訂閱 端節點的問題而影響到訊息的處理。 基於圖1系統實施例的說明,在本發明的另一系統實 施例中,還提供了如下的較佳功能: 每個訂閱端節點與訊息中間件的伺服器之間採用長連 接的方式’如果通信協定是TCP協定(Transmission Control protoc〇i ’傳輸控制協定),則爲TCP長連接。 該長連接是相對於短連接來說的,短連接是指用戶端和伺 服器端建立連接後,處理完畢就斷開了連接,而長連接是 指建立了連接後就保持連接。採用長連接方式,在有訊息 的時候’訊息中間件的伺服器可以從當前建立的連接中查 找訂閱端節點的連接’主動將訊息推送給訂閱端節點。由 於建立 '斷開連接本身是有消耗的,所以長連接的即時性 -12- 201038019 很高,訊息能夠以最快的速度發送給訂閱端節點。 基於圖1系統實施例的說明,在本發明的另一系統實 施例中,還提供了如下的較佳功能: 該系統還可以動態調整每組訊息訂閱端中的節點數量 ,靈活地增加或刪除某個分組下的節點。在訊息流量增大 的時候,現有的節點可能滿足不了處理需求,就可以增加 新的節點’使用和本組中當前工作的節點相同的分組Id 〇 來連接到訊息中間件的伺服器,就完成了節點的增加。如 果是節點數量過多,需要去掉一些節點,則直接停掉這些 要去除的節點上的應用就可以了。 基於圖1系統實施例的說明,在本發明的另一系統實 施例中,還提供了如下的較佳功能: 該訊息發佈端也可以進行分組,每組有一個分組ID 作爲該組的唯一標識;而每組訊息發佈端又可以包括一個 或多個節點’屬於同一個分組的發佈端節點具有相同的分 〇 組1D,所以每個發佈端節點通過本組的ID連接到該訊息 中間件。訊息發佈端發佈訊息時可以選擇組內的一個節點 進行發送’這樣’訊息發佈端可以避免一個節點出故障而 影響訊息的發佈;並且,如果需要發佈的訊息流量非常大 ’可以通過一組內的多個節點進行發佈,緩解發佈端的處 理壓力。參照圖2所示,訊息訂閱端包括分組a和分組B ’每個分組下包括2個節點;訊息發佈端包括分組C和分 組D,每個分組下也包括2個節點。 針對上述系統實施例的說明,本發明還提供了相應的 -13- 201038019 訊息處理方法實施例。該方法包括雨部分處理’一部分是 訂閱者註冊流程,一部分是訊息的處理流程’下面分別說 明。 參照圖3,是實施例該訂閱者註冊訂閱訊息的流程圖 〇 S301,訊息訂閱端進行註冊’訂閱自己需要或感興趣 的訊息主題; 該訊息訂閱端代表一個訂閱端分組’註冊的過程即把 該分組的ID發送給訊息中間件伺服器,並把該分組訂閱 的訊息類型也發送給訊息中間件伺服器。 S3 02,訊息中間件伺服器根據訂閱端訂閱的訊息類型 ’將該訂閱端的分組ID記錄下來’即將訂閱端分組ID與 所訂閱的訊息類型的映射關係記錄到資料庫中; S3 03,訊息中間件伺服器向訂閱端返回訂閱成功的訊 息。 訂閱端按照上述流程進行註冊後’訊息中間件會把訊 息主動推送給訂閱該訊息的訂閱端,推送時會選擇訂閱端 分組中的一個節點進行推送。 參照圖4,是實施例該訊息的處理流程圖。 S40 1,訊息發佈端發送訊息到訊息中間件伺服器; S402,訊息中間件伺服器把訊息存入資料庫,並在任 務佇列中放入一個推送訊息任務,並返回“成功”給訊息 發送端; S403,訊息中間件伺服器從任務佇列中取出任務’根 -14- 201038019 據訊息的類型找到相應的訂閱端分組ID ( 可能是多個); S404,依次處理每個訂閱者分組’處理 分組ID與訂閱端節點連接的映射關係,從 息中間件伺服器上的連接中找到是屬於該訂 接; S405,如果連接大於一個則隨機選擇一 0 接選擇這一個連接; 此外,除了隨機選擇的方式,也可以採 每個節點的方式,將訊息方式給空閒的節點 S406,訊息中間件伺服器將訊息通過該 閱端節點; S407,收到訊息的訂閱端節點對該訊息 〇 上述處理過程中,訂閱端節點與訊息中 〇 長連接方式,所以訊息中間件伺服器在收到 就可以從當前建立的連接中査找訂閱端節點 將訊息推送給訂閱端節點。 而且,該訊息發佈端也可以包括多個分 一個或多個節點,每組發佈端選擇其中一個 訊息發佈到訊息中間件,從而避免一個節點 訊息的發佈;並且,如果需要發佈的訊息流 以通過一組內的多個節點進行發佈,均衡發 力0 可能是一個也 過程是:根據 當前連接到訊 閱者分組的連 個,否則就直 用輪詢分組中 0 連接推送給訂 進行相應處理 間件伺服器是 訊息的時候, 的連接,主動 組,每組包括 節點將該組的 出故障而影響 量非常大,可 佈端的處理壓 -15- 201038019 圖3所示流程中未詳述的部分可以參見圖1、圖2所 示系統的相關部分,爲了篇幅考慮’在此不再詳述。 以上對本發明所提供的一種訊息處理方法及系統’進 行了詳細介紹,本文中應用了具體個例對本發明的原理及 實施方式進行了闡述,以上實施例的說明只是用於幫助理 解本發明的方法及其核心思想;同時,對於本領域的一般 技術人員,依據本發明的思想,在具體實施方式及應用範 圍上均會有改變之處。綜上該,本說明書內容不應理解爲 對本發明的限制。 【圖式簡單說明】 圖1是本發明實施例所述一種訊息處理系統的結構圖 1 圖2是本發明另一實施例所述的一種訊息處理系統的 結構圖; 圖3是本發明實施例所述訂閱者註冊訂閱訊息的流程 圖, 圖4是本發明實施例所述訊息的處理流程圖。 【主要元件符號說明】 U 1 1 :訊息發佈端 U 1 2 :訊息中間件 U 1 3 :訊息訂閱端 U 1 4 :資料庫 -16-201038019 VI. Description of the Invention: [Technical Field] The present invention relates to the field of network technology, and more particularly to a message processing method and system. [Prior Art] In practical applications, there is such a service system: 0 The system includes a message publishing end, a message subscribing end, and a message middleware, and the message publishing device and the message subscribing end transmit message data through the message middleware. The message publisher can publish various topics or various types of message materials, and the message subscriber can subscribe to the message of interest to the message, and the message middleware needs to transmit the message posted by the message publisher to the message subject asynchronously. Subscriber. Therefore, for messages under the same topic, multiple subscribing sites can subscribe at the same time. Different subscribers, each subscriber will receive different processing after receiving the message subscribed to by itself. Suppose there are two subscribing ❹ (SubscriberA and SubscriberB) subscribe to the topic TopicA, and the two subsenses receive their own messages after receiving the messages. For example, in the electronic transaction process, when the transaction is successfully created, the transaction processing system (ie, the message issuing end) issues a notification message that the transaction is successfully created. The transaction log server (ie, the message subscriber) subscribes to the message to record the transaction log; the seller notification server (ie, another message subscription) also subscribes to the message to notify the seller that the item has been purchased. Therefore, the two servers have different processing for the same message. There are many similar applications. In these business systems, there are multiple subscriptions to the same message subject. In this case, the message middleware is required to transmit the message of the same topic to different subscribers. At present, the implementation of such a system is that each message g is composed of one node, that is, only one machine provides services. However, with the development of the business, the amount of data processed by the system is increasing. This system structure can not meet the processing of large data volume. The following problems often exist: First, if the node at the message subscriber end fails, it may not be able to get from the middle of the message. The device receives the message subscribed to by itself; or receives the message but cannot process it, that is, the message processing process of the subscriber is interrupted, thereby affecting the processing of other systems associated with it; secondly, if the message traffic is very large, the processing of one node The ability may not meet the processing requirements; and when the amount of information exceeds the processing power of one node, 'can only be solved by upgrading the hardware, and if the limit of the hardware is reached, it may result in the modification of the entire application system structure. SUMMARY OF THE INVENTION The technical problem to be solved by the present invention is to provide a message processing method and system for solving the problem that the message subscribing end of the existing message processing system is implemented by a single node. In order to solve the above technical problem, the present invention discloses the following technical solutions according to the specific embodiments provided by the present invention: A message processing system includes: a message publishing end, a message subscribing end, and a message middleware, wherein the message subscribing end includes a Or a plurality of groups, each group having a unique label -6-201038019; each group of message subscribing includes one or more nodes, each node is connected to the message middleware by the unique identifier of the group; Posting the message to the message middleware; the message middleware is configured to search for the subscribing group identifier corresponding to the message type according to the type of the received message; if found, according to the found subscribing group identifier, The message is sent to a node in the corresponding subscribing group. Preferably, each node in the message subscriber is connected to the message middleware by using a long connection method, that is, each subscriber node maintains the connection after establishing a connection with the message middleware. The message middleware searches for a connection corresponding to the subscribing group identifier from the current connection. If multiple connections are found, a connection is selected from the connection, and the message is sent to the node corresponding to the connection through the connection. The message subscribing node is configured to perform corresponding processing on the received message. The newly added message subscribing node connects to the message middleware using the same identity as the other nodes of the group. Preferably, the system further comprises: a database for connecting with the message middleware, storing the message received by the message middleware, and the correspondence between the message type and the subscribing group identifier, and corresponding to each subscribing group identifier Node information. Preferably, the message publishing end also includes one or more packets, each group has a unique identifier; each group of message distribution ends includes one or more nodes, and 201038019 each node is connected to the middle of the message by the unique identifier of the group. Pieces. The invention also provides a message processing method, comprising: the publishing end publishing the message to the message middleware; the message middleware searching for the subscribing end group identifier corresponding to the message type according to the type of the message; if the message is found, the message middleware The message is sent to a node in the corresponding subscribing group according to the found subscribing packet identifier. Preferably, the message middleware sends the message to a node in the corresponding subscribing group according to the found subscribing group identifier, which comprises: using a long connection mode, each subscribing node and the message middleware are The connection is maintained after the connection is established; the connection corresponding to the subscribing group identifier is found in the connection currently connected to the message middleware, and if multiple connections are found, one connection is selected; the message middleware sends the message through the connection Go to the node corresponding to the connection. Where 'if multiple connections are found, one connection is randomly selected from them, or each connection is polled. Where 'if multiple subscribing group identifiers are found, the message is sent in turn to one of the nodes in each subscribing group. Preferably, after the publisher posts the message to the message middleware, the message middleware stores the message in the database and returns a successful message to the publisher. The message middleware sends the message to a node in the corresponding subscribing group according to the found subscribing group identifier, and further includes: the subscribing end node that receives the message processes the message accordingly. 201038019 Preferably, the publishing end publishes the message to the message middleware, specifically, the publishing end includes one or more groups, each group includes one or more nodes; each group of publishing ends selects one of the nodes to select the group. The message is posted to the message middleware. According to the specific embodiment provided by the present invention, the present invention has the following technical effects: First, the present invention combines a message subscribing end, and each group re-deploys a system architecture of more than 0 nodes, and multiple nodes share a message subscribing end. jobs. Thus, after the message arrives at the message middleware, a node is selected from the nodes under each group identity, and the message is actively pushed to the subscription node. The solution can avoid two problems existing in the prior art: First, if one or several nodes of the message subscribing fail, the other nodes in the group can continue to receive messages for processing, thereby avoiding the problem that the processing is interrupted. Second, if the message traffic is very large, it can be handled by multiple © nodes in a group, or by adding a subscribing node to balance the processing pressure. Second, the present invention employs a long connection mode in which each subscribing node maintains the connection with the message middleware after establishing a connection. In this way, after the message middleware receives the message, it can search for the connection of the subscribing node from the currently established connection to actively push the message to the subscribing node. This connection method can be sent to the subscriber as quickly as possible because it avoids the consumption of establishing and disconnecting, so the immediacy is high. Again, the above scheme for the message subscriber is also applicable to the message -9- 201038019. The message issuing end can also be grouped. 'A plurality of nodes are deployed in each group. When a message is sent, one node in the group is selected for transmission. In this way, the message issuing end can avoid the failure of one node to affect the release of the message; and if the traffic to be published is very large, it can be distributed through multiple nodes in a group, thereby alleviating the processing pressure on the publishing end. The present invention will be further described in detail with reference to the drawings and specific embodiments. The embodiment of the invention provides a message processing system, which is an improvement of the prior art message processing system. Referring to Figure 1, there is shown a block diagram of the system of the embodiment. The system mainly includes a message publishing terminal U 1 1 , a message middleware u 1 2 and a message subscribing terminal U 1 3, wherein the message publishing terminal U 1 1 and the message subscribing terminal U 1 3 are respectively associated with the message middleware U 1 2 The server is connected, and the message publishing unit U 1 1 and the message subscribing unit U 1 3 transmit the message data through the message middleware U 1 2 . Different from the prior art, the message subscribing terminal U13 enters the group according to the function of the client, as shown in the group A, group B, ..., each group has a group ID as the unique identifier of the group. Each group of message subscribing ends may include one or more nodes, and the subscribing end nodes belonging to the same group have the same group ID, so each subscribing node is connected to the message middleware U 1 2 by the ID of the group. . -10- 201038019 The message issuing terminal U 1 1 posts the message to the server of the message middleware u 1 2. The message middleware U 1 2 searches for the subscribing group ID corresponding to the message type according to the type of the received message. If found, according to the found subscribing group ID, select a node from the group and actively push the message to the node. Since messages of the same subject can be subscribed to by multiple groups of message subscribers, a message may be sent to multiple groups of message subscriptions, and only one node in each group of message recipients will receive the message. After the subscribing node receives the message, it will process it accordingly. The same group of subscribing nodes perform the same processing on the message, and the subscribing nodes of different groups process the messages separately, and the same message is processed by only one node in one packet. For example, in an electronic transaction process, each machine of the transaction server group (ie, the message subscribing node) receives a message that the transaction is successfully created, and is used to record the transaction log; and the seller notifies each machine of the server group. (ie, another message subscribing node) receives a message that the transaction was created successfully, and is used to notify the seller that the item has been purchased. Preferably, the system may further include a database U14 connected to the message middleware u 1 2 for storing the message received by the message middleware U 1 2, and the message type and the subscription end. The correspondence between the group identifiers and the node information corresponding to each subscribing group identifier. Of course, the information may be stored in the internal storage structure of the message middleware U 1 2 server, which is not limited herein. As can be seen from the above, the system has a function of fault tolerance and processing of large traffic messages by -11 - 201038019 due to the deployment of multiple nodes at the message subscription end, where multiple nodes share the work of a message subscriber. The specific analysis is as follows: Firstly, if one or several nodes of the message subscriber end fails, the other nodes in the group can continue to receive messages for processing, thus avoiding the problem of interrupted processing. The system has good fault tolerance. Secondly, if the message traffic is very large, it can be handled by multiple nodes in a group, or the processing pressure can be balanced by increasing the number of subscribing nodes. Wherein, the above-mentioned "common" means: a certain message may generate 500 items per second. Assuming that one group has 5 subscribing nodes, the 5 nodes are to process 500 messages, each subscription. The end node processes 1 000 pieces. If one node fails, then the other four sub-nodes handle the 500 messages. In this way, the entire system will not affect the processing of the message due to the problem of a subscribing node. Based on the description of the system embodiment of FIG. 1, in another system embodiment of the present invention, the following preferred functions are also provided: a long connection is used between each subscribing node and the server of the message middleware. The communication protocol is a TCP protocol (Transmission Control protoc〇i 'Transmission Control Protocol), which is a TCP long connection. The long connection is relative to the short connection. When the connection between the client and the server is established, the connection is disconnected after the processing is completed, and the long connection is the connection after the connection is established. With the long connection method, when there is a message, the server of the message middleware can find the connection of the subscribing node from the currently established connection, and actively pushes the message to the subscribing node. Since the establishment of the disconnection itself is consumable, the immediacy of the long connection -12- 201038019 is very high, and the message can be sent to the subscribing node as quickly as possible. Based on the description of the system embodiment of FIG. 1, in another system embodiment of the present invention, the following preferred functions are also provided: The system can also dynamically adjust the number of nodes in each group of message subscriptions, and flexibly add or delete A node under a group. When the message traffic increases, the existing node may not be able to meet the processing requirements, and the new node can be added to use the same packet Id of the currently working node in the group to connect to the server of the message middleware. The increase in nodes. If there are too many nodes and need to remove some nodes, just stop the applications on the nodes to be removed. Based on the description of the system embodiment of FIG. 1, in another system embodiment of the present invention, the following preferred functions are also provided: The message issuing end can also perform grouping, and each group has a group ID as a unique identifier of the group. And each group of message publishing ends may include one or more nodes 'the publishing end nodes belonging to the same group have the same branch group 1D, so each publishing end node is connected to the message middleware by the ID of the group. When the message publisher publishes a message, it can select a node in the group to send 'such a message'. The publisher can avoid a node failure and affect the release of the message; and if the message to be published is very large, it can pass through a group. Multiple nodes are released to ease the processing pressure on the publishing end. Referring to FIG. 2, the message subscribing includes packet a and packet B'. Each packet includes 2 nodes; the message issuing end includes packet C and packet D, and each packet also includes 2 nodes. For the description of the above system embodiment, the present invention also provides a corresponding embodiment of the message processing method of -13-201038019. The method includes rain partial processing, 'part of which is the subscriber registration process, and part of which is the processing flow of the message'. Referring to FIG. 3, which is a flowchart of the subscriber registering a subscription message in the embodiment, S301, the message subscriber performs registration to subscribe to a message subject that is needed or interested by itself; the message subscription end represents a subscribing group packet. The ID of the packet is sent to the message middleware server, and the message type subscribed to the packet is also sent to the message middleware server. S3 02, the message middleware server records the packet ID of the subscribing end according to the message type subscribed by the subscribing unit, and records the mapping relationship between the subscribing end packet ID and the subscribed message type into the database; S3 03, the middle of the message The server returns a message of successful subscription to the subscriber. After the subscriber completes the registration according to the above process, the message middleware will actively push the message to the subscribing party that subscribes to the message, and pushes a node in the subscribing group to push. Referring to Figure 4, there is shown a process flow diagram of the message in the embodiment. S40 1, the message issuing end sends a message to the message middleware server; S402, the message middleware server stores the message in the database, and puts a push message task in the task queue, and returns "success" to send the message S403, the message middleware server retrieves the task from the task queue 'root-14- 201038019 according to the type of the message, find the corresponding subscribing group ID (may be multiple); S404, processing each subscriber group in turn' Processing the mapping relationship between the packet ID and the subscribing node connection, which is found in the connection on the information middleware server belongs to the subscription; S405, if the connection is greater than one, randomly selects a 0 to select the one connection; The method of selecting may also adopt the manner of each node, and the message mode is given to the idle node S406, and the message middleware server passes the message through the read node; S407, the subscribing node receiving the message processes the message. In the process, the subscribing node and the message are connected in a long way, so the message middleware server can be established from the current when it is received. Find the subscription end node is connected to the end node messages pushed to subscribers. Moreover, the message issuing end may also include a plurality of nodes or nodes, and each group of publishing terminals selects one of the messages to be posted to the message middleware, thereby avoiding the issuance of a node message; and if the message stream needs to be published to pass Multiple nodes in a group are released, and the equalization force 0 may be one. The process is: according to the current connection to the reader group, otherwise the polling packet is directly used to push the subscription to the corresponding processing room. When the server is a message, the connection, the active group, each group including the node has a very large impact on the failure of the group, and the processing pressure of the cloth end is -15-201038019. The part not detailed in the process shown in Figure 3 See the relevant parts of the system shown in Figure 1, Figure 2, for the sake of space, 'will not be detailed here. The method and system for providing a message according to the present invention have been described in detail. The principles and embodiments of the present invention are described in the following. The description of the above embodiments is only for helping to understand the method of the present invention. And its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific embodiments and application scope. In conclusion, the content of the present specification should not be construed as limiting the invention. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a structural diagram of a message processing system according to an embodiment of the present invention. FIG. 1 is a structural diagram of a message processing system according to another embodiment of the present invention; FIG. 3 is an embodiment of the present invention. A flowchart of the subscriber registering the subscription message, and FIG. 4 is a flowchart of processing the message according to the embodiment of the present invention. [Main component symbol description] U 1 1 : Message publishing terminal U 1 2 : Message middleware U 1 3 : Message subscribing terminal U 1 4 : Library -16-

Claims (1)

201038019 七、申請專利範圍: 1. 一種訊息處理系統’其特徵在於,包括:訊息發 佈端、訊息訂閱端和訊息中間件,其中, 該訊息訂閱端包括一個或多個分組,每組具有唯一標 識;每組訊息訂閱端又包括一個或多個節點,每個節點通 過本組的唯一標識連接到該訊息中間件; 該訊息發佈端用於將訊息發佈到訊息中間件; D 該訊息中間件用於根據接收到的訊息的類型,查找對 應該訊息類型的訂閱端分組標識;如果查找到,則根據查 找到的訂閱端分組標識,將該訊息發送到相應訂閱端分組 中的一個節點上。 2. 根據申請專利範圍第1項所述的系統,其中: 該訊息訂閱端中的每個節點採用長連接方式與訊息中 間件連接,即每個訂閱端節點與訊息中間件在建立連接後 保持該連接。 0 3.根據申請專利範圍第2項所述的系統,其中: 該訊息中間件從當前的連接中查找對應該訂閱端分組 標識的連接,如果查找到多個連接,則從中選擇一個連接 ,並通過該連接將該訊息發送到該連接對應的節點上。 4. 根據申請專利範圍第1項所述的系統,其中:該 訊息訂閱端節點用於對接收到的訊息進行相應處理。 5. 根據申請專利範圍第1項所述的系統,其中:新 增加的訊息訂閱端節點使用與本組其他節點相同的標識連 接到該訊息中間件。 -17- 201038019 6. 根據申請專利範圍第1項所述的系統,其中,該 系統還包括: 資料庫,用於與該訊息中間件連接,儲存訊息中間件 接收到的訊息,以及訊息類型與訂閱端分組標識的對應關 係,以及每個訂閱端分組標識對應的節點資訊。 7. 根據申請專利範圍第1項所述的系統,其中: 該訊息發佈端也包括一個或多個分組,每組具有唯一 標識;每組訊息分佈端又包括一個或多個節點,每個節點 通過本組的唯一標識連接到該訊息中間件。 8. —種訊息處理方法,其特徵在於,包括: 發佈端將訊息發佈到訊息中間件; 該訊息中間件根據該訊息的類型,查找對應該訊息類 型的訂閱端分組標識; 如果查找到,則該訊息中間件根據查找到的訂閱端分 組標識,將該訊息發送到相應訂閱端分組中的一個節點上 〇 9. 根據申請專利範圍第8項所述的方法,其中,該 訊息中間件根據查找到的訂閱端分組標識,將該訊息發送 到相應訂閱端分組中的一個節點上,具體包括: 採用長連接方式,每個訂閱端節點與訊息中間件在建 立連接後保持該連接: 從當前連接到訊息中間件的連接中查找對應該訂閱端 分組標識的連接,如果查找到多個連接,則從中選擇一個 連接; -18- 201038019 訊息中間件通過該連接將該訊息發送到該連接對應的 節點上。 1 0.根據申請專利範圍第9項所述的方法,其中:如 果查找到多個連接’則從中隨機選擇一個連接’或者輪詢 每個連接。 11. 根據申請專利範圍第8、9或10項所述的方法, 其中:如果查找到多個訂閱端分組標識,則依次將該訊息 0 發送到每個訂閱端分組中的一個節點上。 12. 根據申請專利範圍第8項所述的方法,其中,該 發佈端將訊息發佈到訊息中間件之後,還包括: 訊息中間件將該訊息存入資料庫,並向該發佈端返回 發佈成功的訊息。 1 3 ·根據申請專利範圍第8項所述的方法,其中,該 訊息中間件根據查找到的訂閱端分組標識,將該訊息發送 到相應訂閱端分組中的一個節點上之後,還包括: 〇 收到訊息的訂閱端節點對該訊息進行相應處理。 I4.根據申請專利範圍第8項所述的方法,其中,該 發佈端將訊息發佈到訊息中間件,具體包括: 該發佈端包括一個或多個分組,每組包括一個或多個 節點; 每組發佈端選擇其中一個節點將該組的訊息發佈到訊 息中間件。 -19-201038019 VII. Patent application scope: 1. A message processing system is characterized in that it comprises: a message publishing end, a message subscribing end and a message middleware, wherein the message subscribing end comprises one or more sub-groups, each group having a unique identifier Each group of message subscribing ends includes one or more nodes, each node is connected to the message middleware by the unique identifier of the group; the message publishing end is used to post the message to the message middleware; D the message middleware is used And searching for a subscribing group identifier corresponding to the type of the message according to the type of the received message; if found, sending the message to a node in the corresponding subscribing group according to the found subscribing group identifier. 2. The system according to claim 1, wherein: each node in the message subscriber is connected to the message middleware by using a long connection manner, that is, each subscriber node and the message middleware are maintained after establishing a connection. The connection. The system of claim 2, wherein: the message middleware searches for a connection corresponding to the subscribing group identifier from the current connection, and if a plurality of connections are found, selects a connection from the The message is sent over the connection to the node corresponding to the connection. 4. The system of claim 1, wherein: the message subscribing node is configured to process the received message accordingly. 5. The system of claim 1, wherein the newly added message subscriber node is connected to the message middleware using the same identity as the other nodes of the group. -17-201038019 6. The system of claim 1, wherein the system further comprises: a database for connecting to the message middleware, storing the message received by the message middleware, and the type of the message and The correspondence between the subscribing group identifiers and the node information corresponding to each subscribing group identifier. 7. The system according to claim 1, wherein: the message issuing end also includes one or more groups, each group having a unique identifier; each group of information distribution ends includes one or more nodes, each node Connect to the message middleware through the unique identity of the group. 8. A message processing method, comprising: a publishing end publishing a message to a message middleware; the message middleware searching for a subscribing end group identifier corresponding to the message type according to the type of the message; if found, The message middleware sends the message to a node in the corresponding subscribing group according to the found subscribing group identifier. The method according to claim 8, wherein the message middleware is searched according to the method. The subscribing end packet identifier is sent to a node in the corresponding subscribing group packet, which comprises: using a long connection mode, each subscribing node and the message middleware maintain the connection after establishing a connection: from the current connection Find the connection corresponding to the subscribing group identifier in the connection to the message middleware, and select a connection if multiple connections are found; -18- 201038019 The message middleware sends the message to the node corresponding to the connection through the connection on. The method of claim 9, wherein: if a plurality of connections are found, then a connection is randomly selected from or polled for each connection. 11. The method of claim 8, 9 or 10, wherein: if a plurality of subscribing packet identifiers are found, the message 0 is sent to one of each of the subscribing packets in turn. 12. The method according to claim 8 , wherein after the publishing end posts the message to the message middleware, the method further includes: the message middleware storing the message in the database, and returning the publishing success to the publishing end Message. The method of claim 8, wherein the message middleware sends the message to a node in the corresponding subscribing group according to the found subscribing group identifier, and further includes: The subscribing node that receives the message processes the message accordingly. The method of claim 8, wherein the publishing end publishes the message to the message middleware, specifically comprising: the publishing end comprises one or more groups, each group comprising one or more nodes; The group publishing side selects one of the nodes to post the message of the group to the message middleware. -19-
TW098110902A 2009-04-01 2009-04-01 Information processing methods and systems TWI477113B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW098110902A TWI477113B (en) 2009-04-01 2009-04-01 Information processing methods and systems

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW098110902A TWI477113B (en) 2009-04-01 2009-04-01 Information processing methods and systems

Publications (2)

Publication Number Publication Date
TW201038019A true TW201038019A (en) 2010-10-16
TWI477113B TWI477113B (en) 2015-03-11

Family

ID=44856889

Family Applications (1)

Application Number Title Priority Date Filing Date
TW098110902A TWI477113B (en) 2009-04-01 2009-04-01 Information processing methods and systems

Country Status (1)

Country Link
TW (1) TWI477113B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468339A (en) * 2014-12-30 2015-03-25 合一网络技术(北京)有限公司 Subscribing message managing method and system
TWI549060B (en) * 2010-11-12 2016-09-11 Alibaba Group Holding Ltd Access methods and devices for virtual machine data
CN110457141A (en) * 2019-07-04 2019-11-15 阿里巴巴集团控股有限公司 A kind of processing method of service message, system, device and equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5920562A (en) * 1996-11-22 1999-07-06 Sprint Communications Co. L.P. Systems and methods for providing enhanced services for telecommunication call
US7319857B2 (en) * 2004-09-13 2008-01-15 Tekelec Methods, systems, and computer program products for delivering messaging service messages

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI549060B (en) * 2010-11-12 2016-09-11 Alibaba Group Holding Ltd Access methods and devices for virtual machine data
CN104468339A (en) * 2014-12-30 2015-03-25 合一网络技术(北京)有限公司 Subscribing message managing method and system
CN104468339B (en) * 2014-12-30 2018-03-27 合一网络技术(北京)有限公司 Subscribe to information management method and system
CN110457141A (en) * 2019-07-04 2019-11-15 阿里巴巴集团控股有限公司 A kind of processing method of service message, system, device and equipment
CN110457141B (en) * 2019-07-04 2023-12-05 创新先进技术有限公司 Service message processing method, system, device and equipment

Also Published As

Publication number Publication date
TWI477113B (en) 2015-03-11

Similar Documents

Publication Publication Date Title
CN101668031B (en) Message processing method and message processing system
JP5898980B2 (en) Method, system, and storage medium for managing multiple queues of non-persistent messages in a network environment
CA2770138C (en) Cluster server of an instant messaging system and messaging method between clusters
JP4415773B2 (en) Multicast packet relay device for virtual router
CN101521927B (en) Method and system for restraining multicast transmitting path
CN110661871B (en) Data transmission method and MQTT server
CN101068378B (en) Method, system and equipment for realizing multimedia information service system disaster recovery
US20100281169A1 (en) Presence-awareness for wireless devices
CN104509073A (en) Discovering ip multicast group memberships in software defined networks
CN108289055B (en) Distributed real-time chat system and method based on Redis subscription service
TWI477113B (en) Information processing methods and systems
CN1487706B (en) Method, system and control process for enterprise to communicate timely
US7543030B2 (en) Peer-to-peer communication for instant messaging between different instant message application types
WO2024032094A1 (en) Instant messaging system and method
CN101009669A (en) A method and system and route device for transmitting the multicast message
CN113132487A (en) Simplified distributed long-connection data transmission method and system
EP1936876B1 (en) Method and system for ensuring data exchange between a server system and a client system
CN110474781B (en) Method and device for forwarding multicast data
US9015309B2 (en) Networked probe system
JP5713499B2 (en) Multi-point distribution method and multi-point distribution system
CN113612812B (en) Implementation of distributed group server and data synchronization method thereof
EP2169875A1 (en) Event distribution in distributed systems
CN117640508A (en) Message interaction method, device, computer equipment and readable storage medium
JP2000253043A (en) Packet communication method
Hoque et al. Modified Algorithms for Multilevel GRSB Protocol