[go: up one dir, main page]

CN111770172A - Messaging middleware consumption proxy method, device, proxy server and storage medium - Google Patents

Messaging middleware consumption proxy method, device, proxy server and storage medium Download PDF

Info

Publication number
CN111770172A
CN111770172A CN202010603686.9A CN202010603686A CN111770172A CN 111770172 A CN111770172 A CN 111770172A CN 202010603686 A CN202010603686 A CN 202010603686A CN 111770172 A CN111770172 A CN 111770172A
Authority
CN
China
Prior art keywords
consumption
proxy
node
information
message middleware
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202010603686.9A
Other languages
Chinese (zh)
Other versions
CN111770172B (en
Inventor
卢道和
杨军
陈广胜
熊梦飞
梁炜强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co 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 WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202010603686.9A priority Critical patent/CN111770172B/en
Publication of CN111770172A publication Critical patent/CN111770172A/en
Application granted granted Critical
Publication of CN111770172B publication Critical patent/CN111770172B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • H04L67/5682Policies or rules for updating, deleting or replacing the stored data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to the technical field of financial technology (Fintech), and discloses a message middleware consumption proxy method, a device, a proxy server and a storage medium; the method comprises the following steps: when detecting that the proxy server is started, accessing a configuration center corresponding to the proxy server to acquire configuration information; determining a consumption group according to the configuration information, and starting an agent cluster according to the consumption group; obtaining subscription information in the message middleware through the agent cluster, and storing the subscription information to a buffer pool; and sending the subscription information in the buffer pool to each consumption node corresponding to the consumption group according to the configuration information. The invention controls and starts the proxy cluster through the proxy server by presetting the proxy server, accesses the message middleware through the proxy cluster, reduces the operation and maintenance cost of the consumption node, and improves the safety and the stability of the message middleware.

Description

消息中间件消费代理方法、装置、代理服务器及存储介质Messaging middleware consumption proxy method, device, proxy server and storage medium

技术领域technical field

本发明涉及金融科技(Fintech)技术领域,尤其涉及消息中间件消费代理方法、装置、代理服务器及存储介质。The present invention relates to the technical field of financial technology (Fintech), and in particular, to a message middleware consumption proxy method, device, proxy server and storage medium.

背景技术Background technique

随着互联网技术,尤其是互联网金融科技(Fintech)的飞速发展,越来越多的技术(大数据、分布式、人工智能等)应用在金融领域,使得金融业务相关的业务数据和金融用户爆炸式增长。With the rapid development of Internet technology, especially Internet financial technology (Fintech), more and more technologies (big data, distributed, artificial intelligence, etc.) are applied in the financial field, causing the explosion of financial business-related business data and financial users growth.

金融业务平台与金融用户之间的数据交互越来越多,当前金融业务平台通过消息中间件(消息中间件基于数据通信来进行分布式系统的集成,消息中间件通过提供消息传递和消息排队模型,在分布式环境下扩展进程间的通信)与金融用户对应的消费节点进行消息交互,当前消息中间件与消费节点之间的交互协议复杂,消费节点需要根据消息中间件提供的对外接口进行开发,代码的开发成本高,在协议发生变化时需要更改消费节点的代码对消费节点进行升级操作,代码维护成本高消费节点的升级操作麻烦;且由于接入消息中间件的消费节点数量不可控,接入的数量过多影响会消息中间件的可靠性和性能;此外在消息中间件与消费节点交互时,消费节点直接访问消息中间件存在一些安全隐患。There are more and more data interactions between financial business platforms and financial users. Currently, financial business platforms integrate distributed systems through message middleware (message middleware is based on data communication, and message middleware provides message delivery and message queuing models by providing , extending the communication between processes in a distributed environment) to interact with the consumer nodes corresponding to financial users. The current interaction protocol between the message middleware and the consumer nodes is complex, and the consumer nodes need to be developed according to the external interface provided by the message middleware. , the development cost of the code is high. When the protocol changes, the code of the consumer node needs to be changed to upgrade the consumer node, and the code maintenance cost is high. The upgrade operation of the consumer node is troublesome; and because the number of consumer nodes accessing the message middleware is uncontrollable, Too many accesses will affect the reliability and performance of the message middleware; in addition, when the message middleware interacts with the consumer node, there are some security risks when the consumer node directly accesses the message middleware.

发明内容SUMMARY OF THE INVENTION

本发明的主要目的在于提出一种消息中间件消费代理方法、装置、代理服务器及存储介质,旨在解决当前消费节点与消息中间件交互的方式,消费节点代码开发维护成本高,过量的消费节点接入会使得消息中间件的性能会受到影响,且消息中间件存在安全隐患的技术问题。The main purpose of the present invention is to provide a message middleware consumption proxy method, device, proxy server and storage medium, aiming to solve the current interaction between the consumption node and the message middleware, the consumption node code development and maintenance cost is high, and the excessive consumption nodes Access will affect the performance of the message middleware, and the message middleware has technical problems of potential security risks.

为实现上述目的,本发明提供一种消息中间件消费代理方法,所述消息中间件消费代理方法包括如下步骤:In order to achieve the above object, the present invention provides a message middleware consumption proxy method, and the message middleware consumption proxy method includes the following steps:

在检测到代理服务器启动时,访问所述代理服务器对应的配置中心获取配置信息;When detecting that the proxy server is started, access the configuration center corresponding to the proxy server to obtain configuration information;

根据所述配置信息确定消费群组,按照所述消费群组启动代理集群;Determine a consumption group according to the configuration information, and start an agent cluster according to the consumption group;

通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池;Obtain subscription information in the message middleware through the proxy cluster, and save the subscription information in a buffer pool;

将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点。Send the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information.

可选地,所述在检测到代理服务器启动时,访问所述代理服务器对应的配置中心获取配置信息的步骤之前,所述方法包括:Optionally, before the step of accessing the configuration center corresponding to the proxy server to obtain configuration information when it is detected that the proxy server is started, the method includes:

创建代理服务器对应的配置中心;Create a configuration center corresponding to the proxy server;

在接收到代理配置请求时,输出信息配置页面;When receiving the proxy configuration request, output the information configuration page;

获取基于所述信息配置页面输入的配置信息,将所述配置信息保存至所述配置中心。Acquire the configuration information input based on the information configuration page, and save the configuration information to the configuration center.

可选地,所述根据所述配置信息确定消费群组,按照所述消费群组启动代理集群的步骤,包括:Optionally, the step of determining a consumption group according to the configuration information and starting a proxy cluster according to the consumption group includes:

获取所述配置信息中的消费节点标识和所述消费节点标识对应的订阅主题,将订阅主题相同的消费节点标识组成消费群组;Obtain the consumer node identifier in the configuration information and the subscription topic corresponding to the consumer node identifier, and form a consumer group with the consumer node identifiers with the same subscription topic;

将每个消费群组单独与预设代理节点关联,将关联的预设代理节点组成代理集群,并启动所述代理集群。Each consumer group is individually associated with a preset proxy node, the associated preset proxy nodes are formed into a proxy cluster, and the proxy cluster is started.

可选地,所述通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池的步骤,包括:Optionally, the step of obtaining the subscription information in the message middleware through the proxy cluster and saving the subscription information to the buffer pool includes:

获取所述配置信息中的订阅主题,通过所述代理集群获取消息中间件中所述订阅主题对应的订阅信息;Obtain the subscription topic in the configuration information, and obtain the subscription information corresponding to the subscription topic in the message middleware through the proxy cluster;

获取所述消费群组中消费节点的节点数量;Obtain the number of nodes of the consumer node in the consumer group;

在所述消费节点的节点数量为至少为两个时,将所述订阅信息保存至缓冲池。When the number of the consuming nodes is at least two, the subscription information is saved to the buffer pool.

可选地,所述通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池的步骤之后,所述方法包括:Optionally, after the step of obtaining the subscription information in the message middleware through the proxy cluster and saving the subscription information to the buffer pool, the method includes:

检测所述代理集群中的代理节点是否全部启动成功;Detecting whether all the proxy nodes in the proxy cluster are successfully started;

在所述代理集群中的代理节点没有全部启动成功时,确定启动失败的目标代理节点,启动所述目标代理节点对应的热设备节点,并通过所述热设备节点获取消息中间件中的订阅信息,并将所述订阅信息保存至缓冲池;When all the proxy nodes in the proxy cluster are not successfully started, determine the target proxy node that fails to start, start the hot device node corresponding to the target proxy node, and obtain the subscription information in the message middleware through the hot device node , and save the subscription information to the buffer pool;

在所述代理集群中的代理节点全部启动成功时,执行所述通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池的步骤。When all the proxy nodes in the proxy cluster are successfully started, the steps of acquiring the subscription information in the message middleware through the proxy cluster and saving the subscription information in the buffer pool are performed.

可选地,所述将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点的步骤之后,所述方法包括:Optionally, after the step of sending the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information, the method includes:

若预设时间段没有接收到所述消费节点反馈的确认字符信息时,执行所述将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点的步骤,直至接收到所述消费节点反馈的确认字符信息。If the confirmation character information fed back by the consuming node is not received within a preset time period, execute the sending of the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information until the confirmation character information fed back by the consuming node is received.

可选地,所述消息中间件消费代理方法,包括:Optionally, the message middleware consumption proxy method includes:

在检测到消费节点对应消息队列中新增消息订阅请求时,获取所述消息订阅请求对应的消费节点标识;When detecting that a new message subscription request is added to the message queue corresponding to the consumer node, obtain the consumer node identifier corresponding to the message subscription request;

访问配置中心,获取配置信息中所述消费节点标识所属的消费群组,按照所述消费群组启动代理集群;Access the configuration center, obtain the consumer group to which the consumer node identifier in the configuration information belongs, and start the proxy cluster according to the consumer group;

通过所述代理集群获取消息中间件中的订阅信息,并将所述订阅信息发送至所述消费节点。Obtain subscription information in the message middleware through the proxy cluster, and send the subscription information to the consuming node.

此外,为实现上述目的,本发明还提供一种消息中间件消费代理装置,所述消息中间件消费代理装置包括:In addition, in order to achieve the above object, the present invention also provides a message middleware consumption proxy device, the message middleware consumption proxy device includes:

访问获取模块,用于在检测到代理服务器启动时,访问所述代理服务器对应的配置中心获取配置信息;an access acquisition module, configured to access the configuration center corresponding to the proxy server to acquire configuration information when detecting that the proxy server is started;

节点启动模块,用于根据所述配置信息确定消费群组,按照所述消费群组启动代理集群;a node startup module, configured to determine a consumption group according to the configuration information, and start an agent cluster according to the consumption group;

获取保存模块,用于通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池;an acquiring and saving module, configured to acquire subscription information in the message middleware through the proxy cluster, and save the subscription information to a buffer pool;

信息发送模块,用于将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点。an information sending module, configured to send the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information.

此外,为实现上述目的,本发明还提供一种代理服务器,所述代理服务器包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的消息中间件消费代理程序,所述消息中间件消费代理程序被所述处理器执行时实现如上所述的消息中间件消费代理方法的步骤。In addition, in order to achieve the above object, the present invention also provides a proxy server, the proxy server includes: a memory, a processor, and a message middleware consumption proxy program stored on the memory and running on the processor, When the message middleware consuming proxy program is executed by the processor, the steps of the above message middleware consuming proxy method are implemented.

此外,为实现上述目的,本发明还提供一种计算机存储介质,所述计算机存储介质上存储有消息中间件消费代理程序,所述消息中间件消费代理程序被处理器执行时实现如上所述的消息中间件消费代理方法的步骤。In addition, in order to achieve the above object, the present invention also provides a computer storage medium, where a message middleware consumption agent program is stored on the computer storage medium, and the message middleware consumption agent program is executed by a processor to realize the above-mentioned Steps of message middleware consuming proxy method.

本发明提供一种消息中间件消费代理方法、装置、代理服务器及存储介质。本发明实施例中在检测到代理服务器启动时,访问所述代理服务器对应的配置中心获取配置信息;根据所述配置信息确定消费群组,按照所述消费群组启动代理集群;通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池;将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点。本发明实施例中预设代理服务器,代理服务器启动时访问配置中心获取配置信息,代理服务器根据配置信息启动代理集群,通过代理集群访问消息中间件,这样消息中间件的协议变更时,只需要更新配置信息,代理服务器就可以根据新的配置信息启动对应的代理集群获取消息中间件中的订阅信息,而不需要针对每个消费节点进行升级操作,降低了消费节点的运维成本,与此同时根据配置信息代理集群中每个代理节点都可以代理多个消费节点,这样接入消费节点的连接较少,提高了消息中间件的稳定性,减少了消息中间件的性能占用;此外,由于代理集群中的代理节点是可控的,这样消息中间件可以避免受到攻击,提高了消息中间件的安全性。The present invention provides a message middleware consumption proxy method, device, proxy server and storage medium. In the embodiment of the present invention, when it is detected that the proxy server is started, the configuration center corresponding to the proxy server is accessed to obtain configuration information; a consumption group is determined according to the configuration information, and a proxy cluster is started according to the consumption group; The cluster acquires the subscription information in the message middleware, saves the subscription information in a buffer pool, and sends the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information. In the embodiment of the present invention, a proxy server is preset. When the proxy server is started, it accesses the configuration center to obtain configuration information. The proxy server starts the proxy cluster according to the configuration information, and accesses the message middleware through the proxy cluster. In this way, when the protocol of the message middleware is changed, it only needs to update Configuration information, the proxy server can start the corresponding proxy cluster according to the new configuration information to obtain the subscription information in the message middleware, without the need to upgrade each consumer node, reduce the operation and maintenance cost of the consumer node, and at the same time According to the configuration information, each proxy node in the proxy cluster can proxy multiple consumer nodes, so that there are fewer connections to the consumer nodes, which improves the stability of the message middleware and reduces the performance occupation of the message middleware; in addition, because the proxy The proxy nodes in the cluster are controllable, so that the message middleware can be prevented from being attacked and the security of the message middleware is improved.

附图说明Description of drawings

图1是本发明实施例方案涉及的硬件运行环境的设备结构示意图;1 is a schematic diagram of a device structure of a hardware operating environment involved in an embodiment of the present invention;

图2为本发明消息中间件消费代理方法第一实施例中消费代理配置的流程示意图;FIG. 2 is a schematic flowchart of the configuration of a consumption agent in the first embodiment of the message middleware consumption agent method of the present invention;

图3为本发明消息中间件消费代理方法第一实施例的流程示意图;3 is a schematic flowchart of a first embodiment of a message middleware consumption proxy method according to the present invention;

图4为本发明消息中间件消费代理装置一实施例的功能模块示意图。FIG. 4 is a schematic diagram of functional modules of an embodiment of a message middleware consumption proxy device according to the present invention.

本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments.

具体实施方式Detailed ways

应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.

现在的消息中间件接入方法使用基于TCP(Transmission Control Protocol传输控制协议TCP是一种面向连接导向的、可靠的、基于字节流的运输层(Transport layer)通信协议)的复杂交互协议的消费节点(又叫客户端)接入消息中间件,消费节点进行消息订阅的步骤包括:The current message middleware access method uses the consumption of complex interaction protocols based on TCP (Transmission Control Protocol TCP is a connection-oriented, reliable, byte stream-based transport layer communication protocol). The node (also called the client) accesses the message middleware, and the steps for the consuming node to subscribe to the message include:

1、消息中间件(例如,MQServer1与MQServer2)将自身信息注册至注册中心(注册中心又叫Registry,Registry中包含订阅主题、服务信息,例如,注册中心在记录T1被维护在MQServer1上,T2被维护在MQServer2上等的路由信息);1. The message middleware (for example, MQServer1 and MQServer2) registers its own information with the registry (the registry is also called the Registry, and the registry contains subscription topics and service information. For example, the registry records T1 is maintained on MQServer1, and T2 is maintained on MQServer1. maintain routing information on MQServer2);

2、消费者节点订阅T1,消费者节点查询Registry,得到T1的路由信息;2. The consumer node subscribes to T1, and the consumer node queries the Registry to obtain the routing information of T1;

3、消费者节点根据路由信息确定T1订阅主题的消息维护在MQServer1,消费者节点与MQServer1建立长链接;3. The consumer node determines that the message of the T1 subscription topic is maintained in MQServer1 according to the routing information, and the consumer node establishes a long link with MQServer1;

4、消费者节点使用建立的长链接,对MQServer1发起持续不断的长轮询方式的消费请求,将消息到本地进行持续消费,此时消费的节奏取决于T1上是否有新的消息被投递进来。4. The consumer node uses the established long link to initiate a continuous long polling consumption request to MQServer1, and sends the message to the local for continuous consumption. At this time, the rhythm of consumption depends on whether a new message is delivered on T1. .

当前基于TCP的消息中间件消费方式,消费者节点与消息中间件之间的交互协议复杂,消费者节点中的消息订阅逻辑笨重,消费者节点的逻辑块需要执行包含并不限于实例心跳状态保持,发送与消费的负载均衡,ACL(AccessControlLis,控制访问列表)鉴权,流量控制,ACK(Acknowledgement,确认字符)机制,Trace跟踪的操作,其中的任何一个逻辑块出现较大改动,都需要推动使用方消费者节点进行代码更新,这样消费者节点的运维操作较为复杂,消费节点升级操作复杂,且消费节点与消息中间件之间的交互协议笨重,不同语言的消费节点开发维护成本太高,当前难以满足消费节点的需求语言多样性需求。In the current consumption mode of message middleware based on TCP, the interaction protocol between the consumer node and the message middleware is complex, the message subscription logic in the consumer node is cumbersome, and the logic block of the consumer node needs to execute, including but not limited to maintaining the instance heartbeat state. , load balancing of sending and consumption, ACL (AccessControlLis, control access list) authentication, flow control, ACK (Acknowledgement, confirmation character) mechanism, Trace tracking operations, any major change in any of the logic blocks needs to be promoted The consumer node on the consumer side updates the code, so the operation and maintenance of the consumer node is complicated, the upgrade operation of the consumer node is complicated, and the interaction protocol between the consumer node and the message middleware is cumbersome, and the development and maintenance cost of the consumer node in different languages is too high , it is currently difficult to meet the demand for language diversity of consumer nodes.

针对上述基于TCP的消息中间件消费方式存在的问题,提出了本发明中间件消费代理方法实施例;在本发明实施例中该方法基于HTTP(HTTP,Hyper Text TransferProtocol超文件传输协定)协议,该方法包括:在检测到代理服务器启动时,访问所述代理服务器对应的配置中心获取配置信息;根据所述配置信息确定消费群组,按照所述消费群组启动代理集群;通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池;将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点。In view of the problems existing in the above-mentioned consumption mode of message middleware based on TCP, an embodiment of the middleware consumption proxy method of the present invention is proposed; in the embodiment of the present invention, the method is based on the HTTP (HTTP, Hyper Text Transfer Protocol) protocol, which The method includes: when it is detected that a proxy server is started, accessing a configuration center corresponding to the proxy server to obtain configuration information; determining a consumption group according to the configuration information, and starting a proxy cluster according to the consumption group; obtaining through the proxy cluster The subscription information in the message middleware is stored in a buffer pool; the subscription information in the buffer pool is sent to each consuming node corresponding to the consuming group according to the configuration information.

本发明实施例中基于HTTP的消息中间件消费代理方法使用,有效地解决了基于TCP的消息中间件消费方式中存在的问题,具有以下好处,包括:The use of the HTTP-based message middleware consumption proxy method in the embodiment of the present invention effectively solves the problems existing in the TCP-based message middleware consumption mode, and has the following advantages, including:

1、通过将心跳状态保持,发送与消费的负载均衡,ACL鉴权,流量控制,ACK机制,Trace跟踪等放在代理服务器的逻辑块,不需要由消费节点维护,也就是可以做到自行维护,不需要频繁去推动消费节点升级,降低了运维难度。将消费节点的逻辑块迁移至代理服务器,那么在代理服务器可以仅保留HTTP协议承载的发送与消费,消费ACK指令,开发一个某语言的代理节点仅需要实现几个简单的HTTP指令即可,大大减轻语言多样化的工作量。1. By maintaining the heartbeat state, load balancing between sending and consumption, ACL authentication, flow control, ACK mechanism, trace tracking, etc. placed in the logic block of the proxy server, it does not need to be maintained by the consumer node, that is, it can be maintained by itself , there is no need to frequently promote the upgrade of consumer nodes, which reduces the difficulty of operation and maintenance. Migrate the logic block of the consumer node to the proxy server, then the proxy server can only retain the transmission and consumption carried by the HTTP protocol, and consume the ACK command. To develop a proxy node in a certain language only needs to implement a few simple HTTP commands. Reduce the workload of language diversification.

2、消费者节点与代理服务器建立连接,代理服务器再控制代理集群中的代理节点接入消息中间件,代理节点的数量有限,大大收敛了消息中间件上的TCP长链接数量,增强消息中间件服务端的可靠性,且可以通过安全方面的校验消除了将消息中间件服务端直接暴露给消费节点的安全隐患。2. The consumer node establishes a connection with the proxy server, and the proxy server controls the proxy nodes in the proxy cluster to access the message middleware. The number of proxy nodes is limited, which greatly reduces the number of TCP long links on the message middleware and enhances the message middleware. The reliability of the server, and the security check can eliminate the security risk of directly exposing the message middleware server to the consumer node.

如图1所示,图1是本发明实施例方案涉及的硬件运行环境的设备结构示意图。As shown in FIG. 1 , FIG. 1 is a schematic diagram of a device structure of a hardware operating environment involved in an embodiment of the present invention.

本发明实施例消息中间件消费代理方法应用于代理服务器。The message middleware consumption proxy method according to the embodiment of the present invention is applied to a proxy server.

如图1所示,该代理服务器可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 1 , the proxy server may include: a processor 1001 , such as a CPU, a network interface 1004 , a user interface 1003 , a memory 1005 , and a communication bus 1002 . Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. Optionally, the network interface 1004 may include a standard wired interface and a wireless interface (eg, a WI-FI interface). The memory 1005 may be high-speed RAM memory, or may be non-volatile memory, such as disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001 .

本领域技术人员可以理解,图1中示出的设备结构并不构成对设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the device structure shown in FIG. 1 does not constitute a limitation on the device, and may include more or less components than the one shown, or combine some components, or arrange different components.

如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及消息中间件消费代理程序。As shown in FIG. 1 , the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a message middleware consumption agent program.

在图1所示的设备中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接消费节点(用户端),与消费节点进行数据通信;而处理器1001可以用于调用存储器1005中存储的消息中间件消费代理程序,并执行下述消息中间件消费代理方法中的操作。In the device shown in FIG. 1 , the network interface 1004 is mainly used to connect to the backend server and perform data communication with the backend server; the user interface 1003 is mainly used to connect the consumer node (client) and perform data communication with the consumer node; and the processor 1001 can be used to call the message middleware consuming proxy program stored in the memory 1005, and perform the operations in the following message middleware consuming proxy method.

基于上述硬件结构,提出本发明消息中间件消费代理方法实施例。Based on the above hardware structure, an embodiment of the message middleware consumption proxy method of the present invention is proposed.

在检测到代理服务器启动时,访问所述代理服务器对应的配置中心获取配置信息;When detecting that the proxy server is started, access the configuration center corresponding to the proxy server to obtain configuration information;

根据所述配置信息确定消费群组,按照所述消费群组启动代理集群;Determine a consumption group according to the configuration information, and start an agent cluster according to the consumption group;

通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池;Obtain subscription information in the message middleware through the proxy cluster, and save the subscription information in a buffer pool;

将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点。Send the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information.

本实施例消息中间件消费代理方法应用于代理服务器,代理服务器是消息中间件消费代理计算机程序的硬件载体,本实施例中的代理服务器作为一个中间平台对接消费节点和消息中间件,本实施例中的代理服务器还可以设置在消息中间件的前端。The message middleware consumption proxy method in this embodiment is applied to a proxy server, and the proxy server is the hardware carrier of the message middleware consumption proxy computer program. The proxy server can also be set in the front end of the message middleware.

为了方便理解,本实施例中以代理服务器设置在消息中间件的前端为例进行说明。For ease of understanding, in this embodiment, the proxy server is set at the front end of the message middleware as an example for description.

在本发明消息中间件消费代理方法第一实施例的步骤之前,预先创建消费代理框架,通过消费代理框架进行消息推送操作,参照图2,图2为本发明消息中间件消费代理方法第一实施例中消费代理配置的流程示意图,在本实施例中消费代理配置的步骤包括:Before the steps of the first embodiment of the message middleware consumption proxy method of the present invention, a consumption proxy framework is created in advance, and the message push operation is performed through the consumption proxy framework. Referring to FIG. 2, FIG. 2 is the first implementation of the message middleware consumption proxy method of the present invention. In the example, a schematic flowchart of the configuration of the consumption agent, in this embodiment, the steps of the configuration of the consumption agent include:

步骤S01,创建代理服务器对应的配置中心;Step S01, creating a configuration center corresponding to the proxy server;

代理服务器根据开发者预先编写消费代理的公共代码信息创建消费代理框架,消费代理框架是指执行消费代理的公共代码,开发人员在消费代理框架编写功能代码,代理服务器同步设置配置中心,其中,配置中心是用于保存配置信息的数据表或者数据库,配置信息是指用户或者开发人员配置的各消费节点的订阅主题、订阅时间和消费节点标识等信息,代理服务器利用消费代理框架根据配置中心中的配置信息调用代理集群(代理集群代替消费节点从消息中间件中获取订阅消息的设备,代理集群中每个代理节点都可以代替一个消费节点或者多个消费节点,从消息中间件中获取各个消费节点订阅的订阅消息,然后,将订阅消息保存至缓存,再将缓存中的订阅消息推送至各个消费节点),通过代理集群执行消费代理操作,具体地:The proxy server creates the consumer proxy framework based on the public code information of the consumer proxy pre-written by the developer. The consumer proxy framework refers to the execution of the public code of the consumer proxy. The developer writes the function code in the consumer proxy framework, and the proxy server sets the configuration center synchronously. The center is a data table or database used to save configuration information. Configuration information refers to the subscription topic, subscription time, and consumer node identification of each consumer node configured by the user or developer. The configuration information calls the proxy cluster (the proxy cluster replaces the consumer node to obtain subscription messages from the message middleware. Each proxy node in the proxy cluster can replace one consumer node or multiple consumer nodes, and obtain each consumer node from the message middleware. subscribed subscription messages, then save the subscription messages to the cache, and then push the subscription messages in the cache to each consumer node), and perform the consumption proxy operation through the proxy cluster, specifically:

步骤S02,在接收到代理配置请求时,输出信息配置页面;Step S02, when receiving the proxy configuration request, output the information configuration page;

用户在代理服务器触发代理配置请求,其中,代理配置请求的触发方式不作具体限定,代理服务器在接收到代理配置请求时,代理服务器输出信息配置页面,以供用户在信息配置页面输入各个消费节点的订阅主题、订阅时间和消费节点标识等配置信息。The user triggers the proxy configuration request on the proxy server. The triggering method of the proxy configuration request is not specifically limited. When the proxy server receives the proxy configuration request, the proxy server outputs the information configuration page for the user to input the information of each consumer node on the information configuration page. Configuration information such as subscription topic, subscription time, and consumer node ID.

步骤S03,获取基于所述信息配置页面输入的配置信息,将所述配置信息保存至配置中心。Step S03: Acquire configuration information input based on the information configuration page, and save the configuration information to a configuration center.

代理服务器获取基于信息配置页面输入的配置信息,其中,配置信息包括具有映射关系(映射关系可以是一一映射,还可以是一对多映射,优选一对多映射,这样可以防止消息中间件接入的长链接较多)的代理配置信息和消费配置信息,代理配置信息是指与代理服务器之间具有通信连接的代理集群信息,消费配置信息是指每个消费节点的订阅主题、订阅时间和消费节点标识等等,代理服务器然后按照不同的维度将代理配置信息和消费配置信息保存至配置中心。The proxy server obtains the configuration information input based on the information configuration page, wherein the configuration information includes a mapping relationship (the mapping relationship can be a one-to-one mapping, or a one-to-many mapping, preferably a one-to-many mapping, which can prevent the message middleware from connecting. The proxy configuration information and consumption configuration information of the incoming long links), the proxy configuration information refers to the proxy cluster information that has a communication connection with the proxy server, and the consumption configuration information refers to the subscription topic, subscription time and Consumer node identification, etc., the proxy server then saves the proxy configuration information and the consumption configuration information to the configuration center according to different dimensions.

可以理解的是,本实施例中配置信息可以实时更新,即,本实施例中代理配置请求触发的时间不作限定,例如,在执行消费代理的过程中可以触发代理配置请求;在消费节点更新时可以触发代理配置请求;代理配置请求的触发方式不作具体限定,代理配置请求可以是代理服务器自动触发的,例如,在检测到新的消费节点访问消息中间件时,代理服务器自动触发代理配置请求,以获取该消费节点的配置信息,并将配置信息与该消费节点进行关联保存;或者代理配置请求可以是人工主动触发的,例如,在用户在代理服务器的显示界面点击“配置”虚拟按键触发代理配置请求。It can be understood that the configuration information in this embodiment can be updated in real time, that is, the time when the proxy configuration request is triggered in this embodiment is not limited, for example, the proxy configuration request can be triggered during the process of executing the consumption proxy; The proxy configuration request can be triggered; the triggering method of the proxy configuration request is not specifically limited. The proxy configuration request can be automatically triggered by the proxy server. For example, when a new consumer node is detected to access the message middleware, the proxy server automatically triggers the proxy configuration request. To obtain the configuration information of the consuming node, and store the configuration information in association with the consuming node; or the proxy configuration request can be triggered manually, for example, when the user clicks the "Configure" virtual button on the display interface of the proxy server to trigger the proxy Configure the request.

本实施例中通过代理服务器执行消息中间件消费代理操作,这样消费节点不需要与消息中间件提供的数据接口直接对接,在消息中间件升级时,只需要更新配置中心中的配置信息,代理服务器就可以按照最新的配置信息进行消费代理操作,不需要对各个消费节点进行升级,消费节点维护比较方便,且消息中间件接入的长链接来源于代理服务器控制的代理节点,一个代理节点可以代理多个消费节点,这样消息中间件中接入的长链接数量较少,不会出现消息中间件中接入数据过载的现象,提高了消息中间件的稳定性和可靠性,与此同时,由于代理服务器控制的各个代理节点预先进行验证,这样消息中间件的安全性得到了更好的保证。In this embodiment, the proxy server is used to perform the consumption proxy operation of the message middleware, so that the consuming node does not need to directly connect with the data interface provided by the message middleware. When the message middleware is upgraded, only the configuration information in the configuration center needs to be updated, and the proxy server The consumption agent operation can be carried out according to the latest configuration information, and there is no need to upgrade each consumption node. The maintenance of the consumption node is relatively convenient, and the long link accessed by the message middleware comes from the proxy node controlled by the proxy server. A proxy node can proxy Multiple consumer nodes, so that the number of long links connected in the message middleware is small, and the phenomenon of data overload in the message middleware will not occur, which improves the stability and reliability of the message middleware. Each proxy node controlled by the proxy server is verified in advance, so that the security of the message middleware is better guaranteed.

参照图3,图3为本发明消息中间件消费代理方法第一实施例的流程示意图,所述方法包括:Referring to FIG. 3, FIG. 3 is a schematic flowchart of a first embodiment of a message middleware consumption proxy method according to the present invention, and the method includes:

步骤S10,在检测到代理服务器启动时,访问所述代理服务器对应的配置中心获取配置信息。In step S10, when it is detected that the proxy server starts, the configuration center corresponding to the proxy server is accessed to obtain configuration information.

代理服务器设置有监听器,在代理服务器启动时,代理服务器访问预设设置的配置中心,获取配置中心中的配置信息,以使得代理服务器根据配置信息启动代理集群中的各个代理节点执行消费代理操作,即,代理服务器判断配置信息中是否包括具有映射关系的代理配置信息和消费配置信息;若配置信息中包括具有映射关系的代理配置信息和消费配置信息,代理服务器根据配置信息中的映射关系,启动代理集群中的各代理节点,本实施例中根据映射关系启动代理集群中的各代理节点,代理服务器可以根据网络地址等信息建立映射关系,使得消息代理更加便捷;若配置信息中不包括具有映射关系的代理配置信息和消费配置信息,代理服务器随机启动代理集群中的各代理节点,本实施例中随机启动代理集群中的各代理节点,这样的方式各个代理节点之间互为热设备,在一个代理节点出现故障时,可以通过其他代理节点进行替代,避免出现代理异常的问题;可以理解的是代理服务器与代理集群中的代理节点是分布式架构,代理集群中具有访问配置中心的代理节点均可以作为代理服务器。The proxy server is provided with a listener. When the proxy server starts, the proxy server accesses the configuration center set by default, and obtains the configuration information in the configuration center, so that the proxy server starts each proxy node in the proxy cluster according to the configuration information to execute the consumption proxy operation. , that is, the proxy server determines whether the configuration information includes proxy configuration information and consumption configuration information with a mapping relationship; if the configuration information includes proxy configuration information and consumption configuration information with a mapping relationship, the proxy server according to the mapping relationship in the configuration information, Start each proxy node in the proxy cluster. In this embodiment, start each proxy node in the proxy cluster according to the mapping relationship. The proxy server can establish a mapping relationship according to information such as network addresses, so that the message proxy is more convenient; The proxy configuration information and consumption configuration information of the mapping relationship. The proxy server randomly starts each proxy node in the proxy cluster. In this embodiment, each proxy node in the proxy cluster is randomly activated. In this way, each proxy node is a hot device for each other. When a proxy node fails, it can be replaced by other proxy nodes to avoid the problem of proxy exceptions; it is understandable that the proxy server and the proxy nodes in the proxy cluster are distributed architectures, and the proxy cluster has the proxy to access the configuration center Nodes can act as proxy servers.

步骤S20,根据所述配置信息确定消费群组,按照所述消费群组启动代理集群。Step S20: Determine a consumption group according to the configuration information, and start a proxy cluster according to the consumption group.

代理服务器根据配置信息确定消费群组,即,配置中心中包含预先配置的配置信息,代理服务器根据配置信息中各个消费节点的订阅主题、订阅时间和/或消费节点标识,将配置信息中各个消费节点标识对应的消费节点进行群组划分,形成多个消费群组,例如,代理服务器将订阅主题相同的各个消费节点标识对应的消费节点作为一个消费群组;或者,代理服务器将订阅时间相同的各个消费节点标识对应的消费节点作为一个消费群组;再或者代理服务器根据消费节点标识确定各个消费节点的网络地址信息等等,代理服务器根据网络地址信息,将各个消费节点标识对应的消费节点划分消费群组;代理服务器将每个消费群组与代理节点进行关联,代理服务器将关联的代理节点作为代理集群,然后控制启动代理集群。The proxy server determines the consumption group according to the configuration information, that is, the configuration center contains pre-configured configuration information, and the proxy server uses the The consumer nodes corresponding to the node identifiers are divided into groups to form multiple consumer groups. For example, the proxy server uses the consumer nodes corresponding to the consumer node identifiers with the same subscription topic as a consumer group; or the proxy server uses the same subscription time. The consumer node corresponding to each consumer node identifier is used as a consumer group; or the proxy server determines the network address information of each consumer node according to the consumer node identifier, etc., and the proxy server divides the consumer node corresponding to each consumer node identifier according to the network address information. Consumption group; the proxy server associates each consumption group with the proxy node, and the proxy server uses the associated proxy node as the proxy cluster, and then controls to start the proxy cluster.

本实施例中步骤S20,具体地包括:Step S20 in this embodiment specifically includes:

步骤a1,获取所述配置信息中的消费节点标识和所述消费节点标识对应的订阅主题,将订阅主题相同的消费节点标识组成消费群组;Step a1, acquiring the consumer node identifier in the configuration information and the subscription topic corresponding to the consumer node identifier, and forming a consumer group with the consumer node identifiers with the same subscription topic;

步骤a2,将每个消费群组单独与预设代理节点关联,将关联的预设代理节点组成代理集群,并启动所述代理集群。In step a2, each consumer group is individually associated with a preset proxy node, the associated preset proxy nodes are formed into a proxy cluster, and the proxy cluster is started.

代理服务器获取配置信息中的消费节点标识,和各个消费节点标识对应的订阅主题,代理服务器将订阅主题相同的消费节点标识组成消费群组,即,本实施例中代理服务器将配置信息中订阅主题相同的消费节点组成一个消费群组,将每个消费群组单独与预设代理节点(预设代理节点是指预先设置的具体消息订阅逻辑的客户端)关联,将关联的预设代理节点组成代理集群,并启动代理集群执行消息订阅操作。The proxy server obtains the consumer node identifier in the configuration information, and the subscription topic corresponding to each consumer node identifier, and the proxy server forms a consumer group with the consumer node identifier with the same subscription topic, that is, in this embodiment, the proxy server subscribes the topic in the configuration information The same consumer nodes form a consumer group, and each consumer group is individually associated with a preset proxy node (preset proxy node refers to a client with a preset specific message subscription logic), and the associated preset proxy nodes are formed. Agent cluster, and start the agent cluster to perform message subscription operation.

可以理解的是,本实施例中确定消费群组是以订阅主题为例进行划分的,在实际应用过程中,代理服务器还可以根据其他维度划分消费群组,这样使得消息订阅更加灵活。It can be understood that, in this embodiment, the consumption group is determined by taking the subscription topic as an example to divide. In the actual application process, the proxy server can also divide the consumption group according to other dimensions, which makes the message subscription more flexible.

例如,本实施例中代理服务器与代理集群通信连接,代理集群中的代理节点代替消费节点从消息中间件中获取订阅信息,并将订阅的信息反馈至消费节点,为了防止消息中间件接入的长链接较多,本实施例中代理集群中的每一个代理节点可以对应一个消费群组(一个消费群组中包含的消费节点数量不作限定,优选地,本实施例中的消费节点群组中包含多个消费节点),例如,实际有一百个消费节点,但这一百个消费节点具备一定的同质性,比如N0-N19这20个消费节点都是业务系统S1的节点,N20-N49这30个消费节点是业务系统S2的节点,另外的N50-N99这50个消费节点是业务系统S3的节点;代理服务器只需要构建分别针对S1、S2和S3三个同质的消费群组,每个消费群组与一个代理节点关联,即通过3个代理节点可以完成100个节点的消息分发。For example, in this embodiment, the proxy server is connected to the proxy cluster in communication, and the proxy node in the proxy cluster replaces the consumer node to obtain subscription information from the message middleware, and feeds back the subscription information to the consumer node. There are many long links. In this embodiment, each proxy node in the proxy cluster may correspond to a consumer group (the number of consumer nodes included in a consumer group is not limited. Including multiple consuming nodes), for example, there are actually 100 consuming nodes, but these 100 consuming nodes have certain homogeneity. The 30 consumer nodes N49 are the nodes of the business system S2, and the other 50 consumer nodes N50-N99 are the nodes of the business system S3; the proxy server only needs to construct three homogeneous consumer groups for S1, S2 and S3 respectively. , each consumer group is associated with a proxy node, that is, through 3 proxy nodes, the message distribution of 100 nodes can be completed.

但是需要面对组内数据分发的问题,因为在代理服务器上代理节点与消费节点是一对多的关系,举例,即消息到达S2,还需要按一定规则分发给N20-N49,比较适合消费节点数多的场景,本实施例中步骤S30到步骤S40,具体说明消费分发的步骤。However, it needs to face the problem of data distribution within the group, because on the proxy server there is a one-to-many relationship between the proxy node and the consumer node. For example, when the message arrives at S2, it needs to be distributed to N20-N49 according to certain rules, which is more suitable for consumer nodes. In many scenarios, steps S30 to S40 in this embodiment specifically describe the steps of consumption distribution.

步骤S30,通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池。Step S30: Obtain subscription information in the message middleware through the proxy cluster, and save the subscription information in a buffer pool.

代理服务器通过代理集群获取消息中间件中的订阅信息,即,代理服务器通过代理集群中的各个代理节点分别获取每个消费群组的订阅信息,此时由于一个代理节点对应一个消费群组,一个消费群组中包含一个或者多个消费节点,此时,代理节点不可以直接进行消息分发操作,因此,代理服务器将获取到的订阅信息保存至代理服务器的缓冲池。The proxy server obtains the subscription information in the message middleware through the proxy cluster, that is, the proxy server obtains the subscription information of each consumer group through each proxy node in the proxy cluster. A consumer group includes one or more consumer nodes. At this time, the proxy node cannot directly perform message distribution operations. Therefore, the proxy server saves the acquired subscription information to the buffer pool of the proxy server.

步骤S40,将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点。Step S40, sending the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information.

代理服务器将缓冲池中的订阅信息根据配置信息发送至消费群组对应的各消费节点,即,代理服务器确定缓冲池中的订阅信息对应的消费节点标识,代理服务器根据消费节点标识将订阅信息分发至消费节点。The proxy server sends the subscription information in the buffer pool to each consumer node corresponding to the consumer group according to the configuration information, that is, the proxy server determines the consumer node identifier corresponding to the subscription information in the buffer pool, and the proxy server distributes the subscription information according to the consumer node identifier. to the consumer node.

需要补充说明的是,本发明消息中间件消费代理方法第一实施例中代理服务器采用Push模型,代理服务器需要维护订阅信息,这样的方式代理服务器足够简洁且不引入资源不足的夯机风险。It should be added that the proxy server in the first embodiment of the message middleware consumption proxy method of the present invention adopts the Push model, and the proxy server needs to maintain subscription information. This method is simple enough and does not introduce the risk of insufficient resources.

本发明实施例中预设代理服务器,代理服务器启动时访问配置中心获取配置信息,代理服务器根据配置信息启动代理集群,通过代理集群访问消息中间件,这样消息中间件的协议变更时,只需要更新配置信息,代理服务器就可以根据新的配置信息启动对应的代理集群获取消息中间件中的订阅信息,而不需要针对每个消费节点进行升级操作,降低了消费节点的运维成本,与此同时根据配置信息代理集群中每个代理节点都可以代理多个消费节点,这样接入消费节点的连接较少,提高了消息中间件的稳定性,减少了消息中间件的性能占用;此外,由于代理集群中的代理节点是预先认证过的,这样消息中间件不可以避免受到攻击,提高了消息中间件的安全性。In the embodiment of the present invention, a proxy server is preset. When the proxy server is started, it accesses the configuration center to obtain configuration information. The proxy server starts the proxy cluster according to the configuration information, and accesses the message middleware through the proxy cluster. In this way, when the protocol of the message middleware is changed, it only needs to update Configuration information, the proxy server can start the corresponding proxy cluster according to the new configuration information to obtain the subscription information in the message middleware, without the need to upgrade each consumer node, reduce the operation and maintenance cost of the consumer node, and at the same time According to the configuration information, each proxy node in the proxy cluster can proxy multiple consumer nodes, so that there are fewer connections to the consumer nodes, which improves the stability of the message middleware and reduces the performance occupation of the message middleware; in addition, because the proxy The proxy nodes in the cluster are pre-authenticated, so the message middleware is unavoidably attacked, which improves the security of the message middleware.

在第一实施例的步骤S40之后,为了避免消费节点没有接收到订阅消息,本实施例中设置确定步骤,具体地包括:After step S40 of the first embodiment, in order to prevent the consuming node from not receiving the subscription message, a determination step is set in this embodiment, which specifically includes:

若预设时间段没有接收到所述消费节点反馈的确认字符信息时,执行所述将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点的步骤,直至接收到所述消费节点反馈的确认字符信息。If the confirmation character information fed back by the consuming node is not received within a preset time period, execute the sending of the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information until the confirmation character information fed back by the consuming node is received.

代理服务器预设时间段(预设时间段可以根据具体场景灵活设置)没有接收到消费节点反馈的确认字符信息时,代理服务器执行将缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点的步骤,直至接收到所述消费节点反馈的确认字符信息。When the proxy server does not receive the confirmation character information fed back by the consuming node during the preset time period (the preset time period can be flexibly set according to the specific scenario), the proxy server executes sending the subscription information in the buffer pool to all users according to the configuration information. The steps of each consuming node corresponding to the consuming group are performed until the confirmation character information fed back by the consuming node is received.

即,本实施例代理服务器向消费节点Push消息时,出现了网络闪断,主机掉电,故障,或者业务方在处理消息时出现了程序故障之类的问题,这将会导致在途消息投递失败,代理服务器认为已经投递成功,而消息实际未到消费节点的情况。引入ACK机制,当消费节点收到消息后,向代理服务器应答ACK确认信息,对于代理服务器而言,已投递但未收到ACK应答的消息,则会被重试,向该消费组内同质的实例再Push N次,这里可以采用阻塞同步ACK的方式,或者非阻塞异步ACK的方式,为了提高代理服务器的Push性能,采用了非阻塞异步ACK的方式。That is, in this embodiment, when the proxy server pushes the message to the consumer node, the network is disconnected, the host is powered off, faulty, or the business party has a program failure when processing the message, which will cause the in-transit message delivery to fail. , the proxy server believes that the delivery has been successful, but the message has not actually reached the consumer node. The ACK mechanism is introduced. When the consumer node receives the message, it responds to the proxy server with ACK confirmation information. For the proxy server, the message that has been delivered but has not received the ACK response will be retried and sent to the same consumer group. The instance of , and then Push N times, the blocking synchronous ACK method or the non-blocking asynchronous ACK method can be used here. In order to improve the Push performance of the proxy server, the non-blocking asynchronous ACK method is adopted.

进一步地,基于本发明消息中间件消费代理方法第一实施例,提出了本发明消息中间件消费代理方法第二实施例。Further, based on the first embodiment of the message middleware consumption proxy method of the present invention, a second embodiment of the message middleware consumption proxy method of the present invention is proposed.

本实施例是第一实施例中步骤S30的细化,本实施例与上述实施例的区别在于:This embodiment is a refinement of step S30 in the first embodiment, and the difference between this embodiment and the above-mentioned embodiment is:

获取所述配置信息中的订阅主题,通过所述代理集群获取消息中间件中所述订阅主题对应的订阅信息;Obtain the subscription topic in the configuration information, and obtain the subscription information corresponding to the subscription topic in the message middleware through the proxy cluster;

获取所述消费群组中消费节点的节点数量;Obtain the number of nodes of the consumer node in the consumer group;

在所述消费节点的节点数量为至少为两个时,将所述订阅信息保存至缓冲池。When the number of the consuming nodes is at least two, the subscription information is saved to the buffer pool.

代理服务器获取配置信息中的订阅主题,通过代理集群获取消息中间件中订阅主题对应的订阅信息;获取消费群组中消费节点的节点数量;在消费节点的节点数量为一个时,即,代理服务器判定订阅消息不需要进行缓存,代理服务器将订阅信息推送至消费节点;在消费节点的节点数量为至少为两个时,代理服务器判定订阅消息需要进行分发,代理服务器将订阅信息保存至缓冲池。本实施例中在消费群组中的消费节点数量为一的时候,则不加入缓存池,直接进行消息发送,减少了消费节点的操作,同时加快了消息传递效率。The proxy server obtains the subscription topic in the configuration information, and obtains the subscription information corresponding to the subscription topic in the message middleware through the proxy cluster; obtains the number of nodes of the consumer node in the consumer group; when the number of nodes of the consumer node is one, that is, the proxy server It is determined that the subscription message does not need to be cached, and the proxy server pushes the subscription information to the consuming node; when the number of consuming nodes is at least two, the proxy server determines that the subscription message needs to be distributed, and the proxy server saves the subscription information to the buffer pool. In this embodiment, when the number of consuming nodes in the consuming group is one, messages are sent directly without joining the buffer pool, which reduces the operations of consuming nodes and speeds up the efficiency of message delivery.

进一步地,基于本发明消息中间件消费代理方法上述实施例,提出了本发明消息中间件消费代理方法第三实施例。Further, based on the above embodiments of the message middleware consumption proxy method of the present invention, a third embodiment of the message middleware consumption proxy method of the present invention is proposed.

本实施例是第一实施例中步骤S20之后的步骤,本实施例与上述实施例的区别在于:This embodiment is a step after step S20 in the first embodiment. The difference between this embodiment and the above-mentioned embodiment is:

检测所述代理集群中的代理节点是否全部启动成功;Detecting whether all the proxy nodes in the proxy cluster are successfully started;

在所述代理集群中的代理节点没有全部启动成功时,确定启动失败的目标代理节点,启动所述目标代理节点对应的热设备节点,并通过所述热设备节点获取消息中间件中的订阅信息,并将所述订阅信息保存至缓冲池;When all the proxy nodes in the proxy cluster are not successfully started, determine the target proxy node that fails to start, start the hot device node corresponding to the target proxy node, and obtain the subscription information in the message middleware through the hot device node , and save the subscription information to the buffer pool;

在所述代理集群中的代理节点全部启动成功时,执行所述通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池的步骤。When all the proxy nodes in the proxy cluster are successfully started, the steps of acquiring the subscription information in the message middleware through the proxy cluster and saving the subscription information in the buffer pool are performed.

代理服务器检测代理集群中的代理节点是否全部启动成功;在代理集群中的代理节点没有全部启动成功时,代理服务器确定启动失败的目标代理节点,启动所述目标代理节点对应的热设备节点,代理服务器并通过热设备节点获取消息中间件中的订阅信息,并将所述订阅信息保存至缓冲池;代理服务器在代理集群中的代理节点全部启动成功时,执行所述通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池的步骤。The proxy server detects whether all the proxy nodes in the proxy cluster have been successfully started; when all the proxy nodes in the proxy cluster are not successfully started, the proxy server determines the target proxy node that fails to start, and starts the hot device node corresponding to the target proxy node. The server also obtains the subscription information in the message middleware through the hot device node, and saves the subscription information in the buffer pool; when all the proxy nodes in the proxy cluster are successfully started, the proxy server executes the described obtaining message through the proxy cluster The subscription information in the middleware, the step of saving the subscription information to the buffer pool.

本实施例中代理服务器确定代理集群中的各个代理节点互为热设备,在一个代理节点故障时,通过另外的热设备节点进行替代,即,同代理集群内的不同代理节点维护的订阅信息是统一的,同质的,集群内各代理节点互为热设备节点,使的消费代理具备高可靠性。In this embodiment, the proxy server determines that each proxy node in the proxy cluster is each other's hot devices, and when one proxy node fails, it is replaced by another hot device node, that is, the subscription information maintained by different proxy nodes in the same proxy cluster is Unified and homogeneous, each agent node in the cluster is a hot device node for each other, so that the consumer agent has high reliability.

进一步地,基于本发明消息中间件消费代理方法上述实施例,提出了本发明消息中间件消费代理方法第四实施例。Further, based on the above embodiments of the message middleware consumption proxy method of the present invention, a fourth embodiment of the message middleware consumption proxy method of the present invention is proposed.

本实施例与上述实施例的区别在于:The difference between this embodiment and the above-mentioned embodiment is:

在检测到消费节点对应消息队列中新增消息订阅请求时,获取所述消息订阅请求对应的消费节点标识;When detecting that a new message subscription request is added to the message queue corresponding to the consumer node, obtain the consumer node identifier corresponding to the message subscription request;

访问配置中心,获取配置信息中所述消费节点标识所属的消费群组,按照所述消费群组启动代理集群;Access the configuration center, obtain the consumer group to which the consumer node identifier in the configuration information belongs, and start the proxy cluster according to the consumer group;

通过所述代理集群获取消息中间件中的订阅信息,并将所述订阅信息发送至所述消费节点。Obtain subscription information in the message middleware through the proxy cluster, and send the subscription information to the consuming node.

本实施例中代理服务器在检测到消费节点对应消息队列中新增消息订阅请求时,代理服务器获取消息订阅请求对应的消费节点标识;代理服务器访问配置中心,获取配置信息中消费节点标识所属的消费群组,代理服务器按照消费群组启动代理集群;代理服务器通过代理集群获取消息中间件中的订阅信息,并将所述订阅信息发送至消费节点。In this embodiment, when the proxy server detects a new message subscription request in the message queue corresponding to the consumer node, the proxy server obtains the consumer node identifier corresponding to the message subscription request; the proxy server accesses the configuration center to obtain the consumer node identifier to which the consumer node identifier in the configuration information belongs. group, the proxy server starts the proxy cluster according to the consumer group; the proxy server obtains the subscription information in the message middleware through the proxy cluster, and sends the subscription information to the consumer node.

本实施例与第一实施例的区别在于:The difference between this embodiment and the first embodiment is that:

第一实施例中代理服务器可采用Push模型,代理服务器启动时,访问代理服务器对应的配置中心获取配置信息;根据配置信息确定消费群组,按照消费群组启动代理集群;通过代理集群获取消息中间件中的订阅信息,将订阅信息保存至缓冲池,代理服务器需要维护订阅信息,采用Push模型这样的方式代理服务器足够简洁且不引入资源不足的夯机风险。In the first embodiment, the proxy server can adopt the Push model. When the proxy server starts, the configuration center corresponding to the proxy server is accessed to obtain configuration information; the consumption group is determined according to the configuration information, and the proxy cluster is started according to the consumption group; the message intermediate is obtained through the proxy cluster. The subscription information in the file is stored in the buffer pool, and the proxy server needs to maintain the subscription information. The push model is used for the proxy server to be concise enough and does not introduce the risk of insufficient resources.

本实施例中采用Pull模型,消费节点设置消息队列,代理服务器在检测到消费节点对应消息队列中新增消息订阅请求时,获取消息订阅请求对应的消费节点标识;代理服务器访问配置中心,获取配置信息中消费节点标识所属的消费群组,按照消费群组启动代理集群获取消息中间件中的订阅信息,并将订阅信息发送至所述消费节点,这样代理服务器仅需要承担拉取消息的状态维护(比如拉取节奏,本地消息缓存,启停拉取等),且需要维护消费节点中的消息队列,由于每一个消费节点都对应设置一个消息队列,这样代理服务器不需要设置缓冲池,代理服务器不需要进行消息维护的信息,只需要被动接受请求从消费节点对应的消息队列中池获取消息返回即可,可以避免资源不足引起的夯机风险。In this embodiment, the Pull model is adopted, the consumer node sets up a message queue, and the proxy server obtains the identifier of the consumer node corresponding to the message subscription request when detecting a new message subscription request in the message queue corresponding to the consumer node; the proxy server accesses the configuration center to obtain the configuration In the information, the consumer node identifies the consumer group to which it belongs, starts the proxy cluster according to the consumer group to obtain the subscription information in the message middleware, and sends the subscription information to the consumer node, so that the proxy server only needs to undertake the state maintenance of the pull message (such as pull rhythm, local message cache, start and stop pull, etc.), and need to maintain the message queue in the consumer node, because each consumer node has a corresponding message queue, so the proxy server does not need to set a buffer pool, the proxy server No need for message maintenance information, just passively accept the request to get the message from the message queue corresponding to the consuming node and return the message, which can avoid the risk of ramming machine caused by insufficient resources.

可以理解的是,在消息中间件与消费节点直接连接的时候,消费节点可以直接查询消息中间件,快速地获取订阅消息,或者消息中间件自动将消费节点订阅的消息快速地推送到消费节点,而本申请实施例中消息中间件消费代理方法,通过代理服务器间接连接消息中间件和消费节点,可能导致消息延时,为了避免消息延时,本发明实施例中可以采取一些运维流程手段去维护,引入配置中心(ConfigCenter)集中管理存储与分发订阅信息,由代理服务器主动以轮询的方式访问配置中心获取订阅信息,假如轮询周期为T(T可以根据具有场景设置,例如设置为1s),即0<t<T内,代理服务器对应的代理集群中所有代理节点均可以与消息中间件保持一致,然后发送至被代理的消费节点,从而达到一致性。It is understandable that when the message middleware is directly connected to the consuming node, the consuming node can directly query the message middleware to quickly obtain subscription messages, or the message middleware can automatically push the messages subscribed by the consuming node to the consuming node quickly. However, in the message middleware consumption proxy method in the embodiment of the present application, the message middleware and the consuming node are indirectly connected through a proxy server, which may cause message delay. Maintenance, the configuration center (ConfigCenter) is introduced to centrally manage, store and distribute subscription information, and the proxy server actively accesses the configuration center to obtain subscription information in a polling manner. If the polling period is T (T can be set according to the scene, for example, it is set to 1s ), that is, within 0<t<T, all proxy nodes in the proxy cluster corresponding to the proxy server can be consistent with the message middleware, and then sent to the proxied consumer node to achieve consistency.

参照图4,本发明还提供一种消息中间件消费代理装置,所述消息中间件消费代理装置包括:4, the present invention also provides a message middleware consumption proxy device, the message middleware consumption proxy device includes:

访问获取模块10,用于在检测到代理服务器启动时,访问所述代理服务器对应的配置中心获取配置信息;The access acquisition module 10 is configured to access the configuration center corresponding to the proxy server to acquire configuration information when detecting that the proxy server is started;

节点启动模块20,用于根据所述配置信息确定消费群组,按照所述消费群组启动代理集群;a node startup module 20, configured to determine a consumption group according to the configuration information, and start an agent cluster according to the consumption group;

获取保存模块30,用于通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池;an acquiring and saving module 30, configured to acquire subscription information in the message middleware through the proxy cluster, and save the subscription information to a buffer pool;

信息发送模块40,用于将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点。The information sending module 40 is configured to send the subscription information in the buffer pool to each consuming node corresponding to the consuming group according to the configuration information.

在一实施例中,所述消息中间件消费代理装置,包括:In one embodiment, the message middleware consumption proxy device includes:

创建设置模块,用于创建代理服务器对应的配置中心;Create a setting module to create a configuration center corresponding to the proxy server;

接收输出模块,用于在接收到代理配置请求时,输出信息配置页面;The receiving and outputting module is used to output the information configuration page when receiving the proxy configuration request;

获取保存模块,用于获取基于所述信息配置页面输入的配置信息,将所述配置信息保存至所述配置中心;an obtaining and saving module, configured to obtain configuration information input based on the information configuration page, and save the configuration information to the configuration center;

在一实施例中,所述节点启动模块20,包括:In one embodiment, the node startup module 20 includes:

群组确定单元,用于获取所述配置信息中的消费节点标识和所述消费节点标识对应的订阅主题,将订阅主题相同的消费节点标识组成消费群组;a group determination unit, configured to obtain the consumer node identifier in the configuration information and the subscription topic corresponding to the consumer node identifier, and form a consumer group with the consumer node identifiers with the same subscription topic;

代理启动单元,用于将每个消费群组单独与预设代理节点关联,将关联的预设代理节点组成代理集群,并启动所述代理集群。The agent starting unit is used for associating each consumer group with a preset agent node individually, forming an agent cluster with the associated preset agent nodes, and starting the agent cluster.

在一实施例中,所述获取保存模块30,包括:In one embodiment, the obtaining and saving module 30 includes:

信息获取单元,用于获取所述配置信息中的订阅主题,通过所述代理集群获取消息中间件中所述订阅主题对应的订阅信息;an information acquisition unit, configured to acquire a subscription topic in the configuration information, and acquire subscription information corresponding to the subscription topic in the message middleware through the proxy cluster;

数量获取单元,用于获取所述消费群组中消费节点的节点数量;a quantity obtaining unit, used to obtain the node quantity of the consuming nodes in the consuming group;

信息缓存单元,用于在所述消费节点的节点数量为至少为两个时,将所述订阅信息保存至缓冲池。An information caching unit, configured to save the subscription information to a buffer pool when the number of the consuming nodes is at least two.

在一实施例中,所述消息中间件消费代理装置,包括:In one embodiment, the message middleware consumption proxy device includes:

启动检测单元,用于检测所述代理集群中的代理节点是否全部启动成功;A startup detection unit for detecting whether all the agent nodes in the agent cluster are successfully started;

节点启动单元,用于在所述代理集群中的代理节点没有全部启动成功时,确定启动失败的目标代理节点,启动所述目标代理节点对应的热设备节点,并通过所述热设备节点获取消息中间件中的订阅信息,并将所述订阅信息保存至缓冲池;A node startup unit, configured to determine a target proxy node that fails to start when all the proxy nodes in the proxy cluster are not successfully started, start a hot device node corresponding to the target proxy node, and obtain a message through the hot device node Subscription information in the middleware, and save the subscription information to the buffer pool;

信息缓存单元,用于在所述代理集群中的代理节点全部启动成功时,执行所述通过所述代理集群获取消息中间件中的订阅信息,将所述订阅信息保存至缓冲池的步骤。The information caching unit is configured to execute the steps of acquiring subscription information in the message middleware through the proxy cluster and saving the subscription information to a buffer pool when all the proxy nodes in the proxy cluster are successfully started.

在一实施例中,所述消息中间件消费代理装置,包括:In one embodiment, the message middleware consumption proxy device includes:

第二发送模块,用于若预设时间段没有接收到所述消费节点反馈的确认字符信息时,执行所述将所述缓冲池中的所述订阅信息根据所述配置信息发送至所述消费群组对应的各消费节点的步骤,直至接收到所述消费节点反馈的确认字符信息。A second sending module, configured to execute the sending of the subscription information in the buffer pool to the consumer according to the configuration information if the confirmation character information fed back by the consumer node is not received within a preset time period The steps of each consuming node corresponding to the group until the confirmation character information fed back by the consuming node is received.

在一实施例中,所述消息中间件消费代理装置,包括:In one embodiment, the message middleware consumption proxy device includes:

检测获取模块,用于在检测到消费节点对应消息队列中新增消息订阅请求时,获取所述消息订阅请求对应的消费节点标识;A detection and acquisition module, configured to acquire a consumer node identifier corresponding to the message subscription request when a new message subscription request is detected in the message queue corresponding to the consumer node;

访问启动模块,用于访问配置中心,获取配置信息中所述消费节点标识所属的消费群组,按照所述消费群组启动代理集群;an access startup module, configured to access a configuration center, obtain a consumer group to which the consumer node identifier in the configuration information belongs, and start an agent cluster according to the consumer group;

信息发送模块,用于通过所述代理集群获取消息中间件中的订阅信息,并将所述订阅信息发送至所述消费节点。an information sending module, configured to obtain subscription information in the message middleware through the proxy cluster, and send the subscription information to the consuming node.

本发明实施例中预设代理服务器,代理服务器启动时访问配置中心获取配置信息,代理服务器根据配置信息启动代理集群,通过代理集群访问消息中间件,这样消息中间件的协议变更时,只需要更新配置信息,代理服务器就可以根据新的配置信息启动对应的代理集群获取消息中间件中的订阅信息,而不需要针对每个消费节点进行升级操作,降低了消费节点的运维成本,与此同时根据配置信息代理集群中每个代理节点都可以代理多个消费节点,这样接入消费节点的连接较少,提高了消息中间件的稳定性,减少了消息中间件的性能占用;此外,由于代理集群中的代理节点是预先认证过的,这样消息中间件不可以避免受到攻击,提高了消息中间件的安全性。In the embodiment of the present invention, a proxy server is preset. When the proxy server is started, it accesses the configuration center to obtain configuration information. The proxy server starts the proxy cluster according to the configuration information, and accesses the message middleware through the proxy cluster. In this way, when the protocol of the message middleware is changed, it only needs to update Configuration information, the proxy server can start the corresponding proxy cluster according to the new configuration information to obtain the subscription information in the message middleware, without the need to upgrade each consumer node, reduce the operation and maintenance cost of the consumer node, and at the same time According to the configuration information, each proxy node in the proxy cluster can proxy multiple consumer nodes, so that there are fewer connections to the consumer nodes, which improves the stability of the message middleware and reduces the performance occupation of the message middleware; in addition, because the proxy The proxy nodes in the cluster are pre-authenticated, so the message middleware is unavoidably attacked, which improves the security of the message middleware.

上述各程序模块所执行的方法可参照本发明消息中间件消费代理方法各个实施例,此处不再赘述。For the methods executed by the above program modules, reference may be made to the various embodiments of the message middleware consumption proxy method of the present invention, which will not be repeated here.

本发明还提供一种计算机存储介质。The present invention also provides a computer storage medium.

本发明计算机存储介质上存储有消息中间件消费代理程序,所述消息中间件消费代理程序被处理器执行时实现如上所述的消息中间件消费代理方法的步骤。The computer storage medium of the present invention stores a message middleware consumption agent program, and when the message middleware consumption agent program is executed by the processor, implements the steps of the above message middleware consumption agent method.

其中,在所述处理器上运行的消息中间件消费代理程序被执行时所实现的方法可参照本发明消息中间件消费代理方法各个实施例,此处不再赘述。The method implemented when the message middleware consumption proxy program running on the processor is executed may refer to the various embodiments of the message middleware consumption proxy method of the present invention, which will not be repeated here.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or system comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or system. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article or system that includes the element.

上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on such understanding, the technical solutions of the present invention can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM) as described above. , magnetic disk, optical disk), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present invention.

以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the description and drawings of the present invention, or directly or indirectly applied in other related technical fields , are similarly included in the scope of patent protection of the present invention.

Claims (10)

1. A message middleware consumption agent method, characterized in that the message middleware consumption agent method comprises:
when detecting that the proxy server is started, accessing a configuration center corresponding to the proxy server to acquire configuration information;
determining a consumption group according to the configuration information, and starting an agent cluster according to the consumption group;
obtaining subscription information in the message middleware through the agent cluster, and storing the subscription information to a buffer pool;
and sending the subscription information in the buffer pool to each consumption node corresponding to the consumption group according to the configuration information.
2. The message middleware consumption proxy method according to claim 1, wherein before the step of accessing the configuration center corresponding to the proxy server to obtain the configuration information when the proxy server is detected to be started, the method comprises:
establishing a configuration center corresponding to the proxy server;
when an agent configuration request is received, outputting an information configuration page;
and acquiring configuration information input based on the information configuration page, and storing the configuration information to the configuration center.
3. The message middleware consumption agent method of claim 1, wherein the step of determining a consumption group according to the configuration information, and starting an agent cluster according to the consumption group, comprises:
acquiring consumption node identifiers in the configuration information and subscription topics corresponding to the consumption node identifiers, and forming consumption groups by the consumption node identifiers with the same subscription topics;
and associating each consumption group with a preset agent node independently, forming the associated preset agent nodes into an agent cluster, and starting the agent cluster.
4. The message middleware consumption proxy method of claim 1, wherein the step of obtaining subscription information in message middleware through the proxy cluster, saving the subscription information to a buffer pool, comprises:
obtaining a subscription theme in the configuration information, and obtaining subscription information corresponding to the subscription theme in a message middleware through the agent cluster;
acquiring the number of nodes of the consumption nodes in the consumption group;
and when the number of the consumption nodes is at least two, storing the subscription information into a buffer pool.
5. The message middleware consumption proxy method of claim 1, wherein after the step of obtaining subscription information in message middleware by the proxy cluster, saving the subscription information to a buffer pool, the method comprises:
detecting whether all the proxy nodes in the proxy cluster are successfully started;
when all the proxy nodes in the proxy cluster are not successfully started, determining a target proxy node which is failed to start, starting a hot equipment node corresponding to the target proxy node, acquiring subscription information in message middleware through the hot equipment node, and storing the subscription information to a buffer pool;
and when all the proxy nodes in the proxy cluster are successfully started, executing the step of obtaining the subscription information in the message middleware through the proxy cluster and storing the subscription information into a buffer pool.
6. The message middleware consumption agent method according to claim 1, wherein after the step of sending the subscription information in the buffer pool to each consumption node corresponding to the consumption group according to the configuration information, the method comprises:
and if the confirmation character information fed back by the consumption node is not received within a preset time period, the step of sending the subscription information in the buffer pool to each consumption node corresponding to the consumption group according to the configuration information is executed until the confirmation character information fed back by the consumption node is received.
7. The message middleware consumption proxy method of any one of claims 1 to 6 wherein the message middleware consumption proxy method comprises:
when detecting that a new message subscription request is added in a message queue corresponding to a consumption node, acquiring a consumption node identifier corresponding to the message subscription request;
accessing a configuration center, acquiring a consumption group to which the consumption node identification belongs in configuration information, and starting an agent cluster according to the consumption group;
and obtaining subscription information in the message middleware through the agent cluster, and sending the subscription information to the consumption node.
8. A message-middleware consumption agent apparatus, characterized in that the message-middleware consumption agent apparatus comprises:
the access acquisition module is used for accessing a configuration center corresponding to the proxy server to acquire configuration information when the proxy server is detected to be started;
the node starting module is used for determining a consumption group according to the configuration information and starting the agent cluster according to the consumption group;
the acquisition and storage module is used for acquiring subscription information in the message middleware through the agent cluster and storing the subscription information to a buffer pool;
and the information sending module is used for sending the subscription information in the buffer pool to each consumption node corresponding to the consumption group according to the configuration information.
9. A proxy server, characterized in that the proxy server comprises: memory, a processor and a message middleware consumption agent stored on the memory and executable on the processor, the message middleware consumption agent when executed by the processor implementing the steps of the message middleware consumption agent method according to any one of claims 1 to 7.
10. A computer storage medium having stored thereon a message middleware consumption agent program which, when executed by a processor, implements the steps of the message middleware consumption agent method according to any one of claims 1 to 7.
CN202010603686.9A 2020-06-29 2020-06-29 Message middleware consumption proxy method, device, proxy server and storage medium Active CN111770172B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010603686.9A CN111770172B (en) 2020-06-29 2020-06-29 Message middleware consumption proxy method, device, proxy server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010603686.9A CN111770172B (en) 2020-06-29 2020-06-29 Message middleware consumption proxy method, device, proxy server and storage medium

Publications (2)

Publication Number Publication Date
CN111770172A true CN111770172A (en) 2020-10-13
CN111770172B CN111770172B (en) 2024-08-23

Family

ID=72722872

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010603686.9A Active CN111770172B (en) 2020-06-29 2020-06-29 Message middleware consumption proxy method, device, proxy server and storage medium

Country Status (1)

Country Link
CN (1) CN111770172B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328404A (en) * 2020-11-26 2021-02-05 北京百度网讯科技有限公司 Load balancing method and device, electronic equipment and computer readable medium
CN113014672A (en) * 2021-04-07 2021-06-22 广州趣丸网络科技有限公司 Message pushing method and device, electronic equipment and storage medium
CN113342552A (en) * 2021-07-05 2021-09-03 湖南快乐阳光互动娱乐传媒有限公司 Data processing method and device, storage medium and electronic equipment
CN114064311A (en) * 2021-11-05 2022-02-18 广州朱雀信息科技有限公司 Message broker delivery control method and its device, equipment, medium and product
CN114125057A (en) * 2022-01-26 2022-03-01 中科边缘智慧信息科技(苏州)有限公司 Distributed data interaction method and device for multi-service center
CN114513501A (en) * 2022-02-15 2022-05-17 银联商务股份有限公司 Target distribution method and system
CN114710557A (en) * 2022-04-12 2022-07-05 树根互联股份有限公司 Data transmission method and device and data release equipment
CN114844948A (en) * 2021-12-14 2022-08-02 合肥哈工轩辕智能科技有限公司 Client cache optimization method and device of real-time distribution system
CN115118590A (en) * 2022-06-22 2022-09-27 平安科技(深圳)有限公司 Method, device, system, equipment and storage medium for managing configuration data
CN116405556A (en) * 2023-04-14 2023-07-07 广州华多网络科技有限公司 Message consumption control method and device, equipment and medium thereof
CN117527880A (en) * 2024-01-05 2024-02-06 南京研利科技有限公司 Message management method, device, electronic equipment and computer readable storage medium
CN119211339A (en) * 2024-11-27 2024-12-27 杭州玳数科技有限公司 A consumer management system
CN119342098A (en) * 2024-12-24 2025-01-21 成方金融科技有限公司 Message matching method, device and equipment for point-to-point conditional subscription between client and message middleware

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100322236A1 (en) * 2009-06-18 2010-12-23 Nokia Corporation Method and apparatus for message routing between clusters using proxy channels
CN102904746A (en) * 2012-09-13 2013-01-30 曙光信息产业(北京)有限公司 Cluster task self-dispatching system and method based on information mechanism
US20140195622A1 (en) * 2001-11-30 2014-07-10 Aurea Software, Inc. Dynamic subscription and message routing on a topic between publishing nodes and subscribing nodes
CN106131175A (en) * 2016-07-01 2016-11-16 微梦创科网络科技(中国)有限公司 A kind of acquisition of information, information-pushing method and equipment
CN107026917A (en) * 2017-06-16 2017-08-08 智者四海(北京)技术有限公司 The method and system pushed for message
CN107395729A (en) * 2017-07-27 2017-11-24 深圳乐信软件技术有限公司 A kind of consumption system of message queue, method and device
CN110300067A (en) * 2019-06-26 2019-10-01 深圳前海微众银行股份有限公司 Queue regulation method, device, equipment and computer readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195622A1 (en) * 2001-11-30 2014-07-10 Aurea Software, Inc. Dynamic subscription and message routing on a topic between publishing nodes and subscribing nodes
US20100322236A1 (en) * 2009-06-18 2010-12-23 Nokia Corporation Method and apparatus for message routing between clusters using proxy channels
CN102904746A (en) * 2012-09-13 2013-01-30 曙光信息产业(北京)有限公司 Cluster task self-dispatching system and method based on information mechanism
CN106131175A (en) * 2016-07-01 2016-11-16 微梦创科网络科技(中国)有限公司 A kind of acquisition of information, information-pushing method and equipment
CN107026917A (en) * 2017-06-16 2017-08-08 智者四海(北京)技术有限公司 The method and system pushed for message
CN107395729A (en) * 2017-07-27 2017-11-24 深圳乐信软件技术有限公司 A kind of consumption system of message queue, method and device
CN110300067A (en) * 2019-06-26 2019-10-01 深圳前海微众银行股份有限公司 Queue regulation method, device, equipment and computer readable storage medium

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328404B (en) * 2020-11-26 2023-08-08 北京百度网讯科技有限公司 Load balancing method and device, electronic equipment and computer readable medium
CN112328404A (en) * 2020-11-26 2021-02-05 北京百度网讯科技有限公司 Load balancing method and device, electronic equipment and computer readable medium
CN113014672B (en) * 2021-04-07 2022-05-17 广州趣丸网络科技有限公司 Message pushing method and device, electronic equipment and storage medium
CN113014672A (en) * 2021-04-07 2021-06-22 广州趣丸网络科技有限公司 Message pushing method and device, electronic equipment and storage medium
CN113342552A (en) * 2021-07-05 2021-09-03 湖南快乐阳光互动娱乐传媒有限公司 Data processing method and device, storage medium and electronic equipment
CN114064311A (en) * 2021-11-05 2022-02-18 广州朱雀信息科技有限公司 Message broker delivery control method and its device, equipment, medium and product
CN114844948A (en) * 2021-12-14 2022-08-02 合肥哈工轩辕智能科技有限公司 Client cache optimization method and device of real-time distribution system
CN114844948B (en) * 2021-12-14 2024-05-31 合肥哈工轩辕智能科技有限公司 Client cache optimization method and device of real-time distribution system
CN114125057B (en) * 2022-01-26 2022-04-26 中科边缘智慧信息科技(苏州)有限公司 Distributed data interaction method and device for multi-service center
CN114125057A (en) * 2022-01-26 2022-03-01 中科边缘智慧信息科技(苏州)有限公司 Distributed data interaction method and device for multi-service center
CN114513501A (en) * 2022-02-15 2022-05-17 银联商务股份有限公司 Target distribution method and system
CN114513501B (en) * 2022-02-15 2024-03-22 银联商务股份有限公司 Target distribution method and system
CN114710557A (en) * 2022-04-12 2022-07-05 树根互联股份有限公司 Data transmission method and device and data release equipment
CN115118590A (en) * 2022-06-22 2022-09-27 平安科技(深圳)有限公司 Method, device, system, equipment and storage medium for managing configuration data
CN115118590B (en) * 2022-06-22 2024-05-10 平安科技(深圳)有限公司 Method, device, system, equipment and storage medium for managing configuration data
CN116405556A (en) * 2023-04-14 2023-07-07 广州华多网络科技有限公司 Message consumption control method and device, equipment and medium thereof
CN117527880A (en) * 2024-01-05 2024-02-06 南京研利科技有限公司 Message management method, device, electronic equipment and computer readable storage medium
CN117527880B (en) * 2024-01-05 2024-04-09 南京研利科技有限公司 Message management method, device, electronic equipment and computer readable storage medium
CN119211339A (en) * 2024-11-27 2024-12-27 杭州玳数科技有限公司 A consumer management system
CN119342098A (en) * 2024-12-24 2025-01-21 成方金融科技有限公司 Message matching method, device and equipment for point-to-point conditional subscription between client and message middleware
CN119342098B (en) * 2024-12-24 2025-05-13 成方金融科技有限公司 Message matching method, device and equipment for point-to-point condition subscription of client and message middleware

Also Published As

Publication number Publication date
CN111770172B (en) 2024-08-23

Similar Documents

Publication Publication Date Title
CN111770172A (en) Messaging middleware consumption proxy method, device, proxy server and storage medium
US6868544B2 (en) Method and system for general-purpose interactive notifications
CN103024052B (en) Realize the system and method that browser data synchronizes
US20030217096A1 (en) Agent based application using data synchronization
CN112187903B (en) Message pushing method and device and message service system
CN102984278B (en) Realize the system and method that browser data synchronizes
CN111064771B (en) Network request processing method and system
CN102035893A (en) Method and system for pushing data actively by server
CN107528891B (en) Websocket-based automatic clustering method and system
CN115023919B (en) Firewall rule updating method and device, server and storage medium
WO2009097776A1 (en) System, device and method for achieving service upgrade
US11658870B2 (en) Method and apparatus for restoring network device to factory defaults, and network device
CN102984277B (en) Prevent the system and method that malice connects
CN114338063A (en) Message queue system, service processing method, and computer-readable storage medium
CN112511595B (en) Message pushing method and message service system
CN116088901A (en) Firmware upgrading method and device, electronic equipment and computer storage medium
CN111274047A (en) Information processing method, terminal, system, computer device and storage medium
CN103036989B (en) Socket server and socket service methods
CN103024049A (en) System capable of achieving browser data synchronization
CN102984276B (en) For the distributor distributed multiple socket server and distribution method
WO2024103943A1 (en) Service processing method and apparatus, storage medium, and device
CN118075278A (en) Data transmission method, device, equipment and medium
CN103064899B (en) A kind of distribution information database system
CN114143730B (en) Signaling processing method, communication system, electronic device and storage medium
CN116389454A (en) Data downloading system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant