CN107592364B - Distributed message exchange method and system - Google Patents

Distributed message exchange method and system Download PDF

Info

Publication number
CN107592364B
CN107592364B CN201710867141.7A CN201710867141A CN107592364B CN 107592364 B CN107592364 B CN 107592364B CN 201710867141 A CN201710867141 A CN 201710867141A CN 107592364 B CN107592364 B CN 107592364B
Authority
CN
China
Prior art keywords
message
service
multicast
channel
terminal
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.)
Active
Application number
CN201710867141.7A
Other languages
Chinese (zh)
Other versions
CN107592364A (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.)
Cfets Information Technology Shanghai Co ltd
Original Assignee
Cfets Information Technology Shanghai 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 Cfets Information Technology Shanghai Co ltd filed Critical Cfets Information Technology Shanghai Co ltd
Priority to CN201710867141.7A priority Critical patent/CN107592364B/en
Publication of CN107592364A publication Critical patent/CN107592364A/en
Application granted granted Critical
Publication of CN107592364B publication Critical patent/CN107592364B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a distributed message exchange method and a distributed message exchange system. The embodiment of the invention divides each function designed by the message exchange system into different functional entities in a way of micro-service, reduces the coupling among the functional entities, realizes the decentralization of message exchange and ensures that the development and maintenance are more convenient. And the information is exchanged in real time by adopting a UDP (user Datagram protocol) multicast mode, so that the efficiency and the performance are improved.

Description

Distributed message exchange method and system
Technical Field
The present invention relates to communication technologies, in particular to distributed communication technologies, and more particularly, to a distributed message exchange method and system.
Background
With the development of information technology and the wide application of distributed systems, the distributed software system is adopted. Message middleware plays a vital role in key applications in many industries, utilizes efficient and reliable messaging mechanisms for platform-independent data communication, and performs integration of distributed systems based on data communication. By providing a messaging and message queuing model, it can extend inter-process communication in a distributed environment.
Message middleware is suitable for distributed environments where reliable data transfer is required. In the system adopting the message middleware mechanism, different objects activate the event of the other side by transmitting messages, and the corresponding operation is completed. The message server stores the messages in a plurality of queues and forwards the messages to the message consumption end when appropriate.
The scheme needs a message server (browser) as a central node for data exchange, wherein the message server (browser) realizes most functions of service discovery, message persistence, message routing and the like. This makes the message server bulky, maintainable and less scalable. Moreover, the functions are concentrated in the message server, so that the correlation among the functions is high, if the message server fails, the whole data exchange has problems, the message issuing end cannot send messages again, and the message consuming end cannot receive messages again. This causes the reliability of the message exchange system to be reduced. Furthermore, each message consumption end and the message server adopt a TCP connection, when the number of message consumption ends is more, the number of messages communicated by the TCP that the message server needs to process is more, which causes the performance of the system in terms of efficiency of message exchange and the like to be reduced.
Disclosure of Invention
In view of this, the present invention discloses a distributed message exchange method and system, so as to decentralize the message exchange, further facilitate development and maintenance, and improve the efficiency and performance of the message exchange.
In a first aspect, a distributed message exchange method is provided, including:
the message issuing end sends a multicast address and a corresponding service identifier to the directory agent according to the pre-configured configuration information to register the service;
the message consumption end subscribes to the service from the directory agent according to the service identifier in the pre-configured configuration information to acquire a corresponding multicast address, and accesses a multicast channel according to the multicast address;
the message issuing end issues service messages through multicast channels corresponding to the registered multicast addresses;
the message consumption end receives service messages in a subscribed multicast channel;
the channel recording end receives the service messages of all the multicast channels and makes the received service messages persistent;
and the message consumption end sends a request to the channel recording end to acquire the historical service message of the subscribed service.
Further, before the message publisher registers the service, the method further includes:
the message issuing end carries out authentication and authorization to an authentication server to acquire the authority of sending the service message; and
the channel recording end carries out authentication and authorization to an authentication server to acquire the authority of receiving the service message;
the method further comprises the following steps before the message consumer subscribes to the service:
and the message consumption end and the channel recording end respectively carry out authentication and authorization to the authentication server so as to acquire the authority of receiving the service message.
Preferably, the method further comprises:
and the configuration management end respectively configures the corresponding configuration information to the message publishing end, the message consuming end and the channel recording end.
Preferably, the method further comprises:
the method comprises the steps that a monitoring management end monitors application health parameters in a system, wherein the application health parameters comprise a process state, message receiving and sending throughput, service registration and subscription success rate and message loss rate.
Further, the method further comprises:
and transmitting the service message from the first multicast subnet where the message publishing terminal is positioned to the second multicast subnet where the message consuming terminal is positioned by utilizing the message agent.
Further, the multicast channel is a UDP multicast channel.
In a second aspect, a distributed message exchange system is provided, including:
a directory agent configured to manage registered or subscribed multicast addresses and corresponding service identifications;
the message issuing end is configured to send the multicast address and the corresponding service identifier to the directory agent according to the pre-configured configuration information so as to register the service, and issue the service message through the multicast channel corresponding to the registered multicast address;
the message consumption end is configured to subscribe the service to the directory agent according to the service identifier in the pre-configured configuration information so as to acquire a corresponding multicast address, and access a multicast channel according to the multicast address to receive the service message; and
and the channel recording end is configured to receive the service messages of all the multicast channels and persist the received service messages.
Further, the message consumer is further configured to send a request to the channel recorder to obtain the historical service message of the subscribed service.
Further, the system further comprises:
and the authentication server is configured to authenticate and authenticate the message publishing terminal, the message consuming terminal and the channel recording terminal so as to grant the right of the message consuming terminal to send the service message and grant the right of the message consuming terminal and the channel recording terminal to receive the service message.
Preferably, the system further comprises:
and the configuration management end is configured to configure the corresponding configuration information to the message publishing end, the message consuming end and the channel recording end respectively.
Preferably, the system further comprises:
the monitoring management terminal is configured to monitor application health parameters in the system, wherein the application health parameters comprise a process state, a message transceiving throughput, a service registration and subscription success rate and a message loss rate.
Further, the system further comprises:
and the message agent is used for sending the service message from the first subnet where the message publishing terminal is positioned to the message agents positioned in other subnets.
In the embodiment of the invention, the distributed message exchange system adopts the idea of micro-service to modularize all functions into different functional entities. This enables decentralization of message exchange resulting in better flexibility and scalability of the system. And the coupling among all functional entities is reduced, so that the development and maintenance are more convenient, and the reliability of the system is further improved. The system adopts a UDP multicast communication mode to exchange messages in real time, thereby improving the message exchange efficiency and the system performance.
Drawings
The above and other objects, features and advantages of the present invention will become more apparent from the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
FIG. 1 is a schematic diagram of a distributed message exchange system of a first embodiment of the present invention;
FIG. 2 is a flow chart of a distributed message exchange method of a first embodiment of the present invention;
FIG. 3 is a schematic diagram of a distributed message exchange system of a second embodiment of the present invention;
FIG. 4 is a flow chart of a distributed message exchange method of a second embodiment of the present invention;
FIG. 5 is a schematic diagram of a distributed message exchange system of a third embodiment of the present invention;
FIG. 6 is a flow chart of a distributed message exchange method of a third embodiment of the present invention;
FIG. 7 is a schematic diagram of a distributed message exchange system of a fourth embodiment of the present invention;
fig. 8 is a flowchart of a distributed message exchange method according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described below based on examples, but the present invention is not limited to only these examples. In the following detailed description of the present invention, certain specific details are set forth. It will be apparent to one skilled in the art that the present invention may be practiced without these specific details. Well-known methods, procedures, components and circuits have not been described in detail so as not to obscure the present invention.
Further, those of ordinary skill in the art will appreciate that the drawings provided herein are for illustrative purposes and are not necessarily drawn to scale.
Unless the context clearly requires otherwise, throughout the description and the claims, the words "comprise", "comprising", and the like are to be construed in an inclusive sense as opposed to an exclusive or exhaustive sense; that is, what is meant is "including, but not limited to".
In the description of the present invention, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In addition, in the description of the present invention, "a plurality" means two or more unless otherwise specified.
Fig. 1 is a schematic diagram of a distributed message exchange system of a first embodiment of the present invention. As shown in fig. 1, the distributed message exchange system of the first embodiment includes a message publishing terminal 1, a message consuming terminal 2, an authentication server 3, a directory agent 4, and a channel recording terminal 5. The message issuing end 1, the message consuming end 2, the authentication server 3, the directory agent 4 and the channel recording end 5 are located in the same UDP multicast subnet, and can communicate with each other through UDP multicast. UDP (User Datagram Protocol) is a connectionless transport layer Protocol in an OSI (Open System Interconnection) reference model, and provides a transaction-oriented simple unreliable information transfer service, and IETF RFC 768 is a formal specification of UDP. The protocol number of UDP in IP packets is 17. In the network, the UDP protocol has no connection communication and does not guarantee the reliability of the transmitted data packet. Based on the UDP protocol, unicast, broadcast and multicast communication can be implemented.
In this embodiment, the message distribution end 1 is configured to send a multicast address and a corresponding service identifier to the directory agent 4 according to the pre-configured configuration information to register a service, and distribute a service message through a multicast channel corresponding to the registered multicast address. The message consumption end 2 is configured to subscribe to the service from the directory agent 4 according to the service identifier in the pre-configured configuration information to obtain the corresponding multicast address, and access a multicast channel to receive the service message according to the multicast address. It should be understood that within one subnet, there may be a plurality of message issuers 1 and message consumers 2. The authentication server 3 is configured to perform authentication on the message publishing terminal 1, the message consuming terminal 2 and the channel recording terminal 5 to grant the right of the message consuming terminal 1 to send service messages and grant the right of the message consuming terminal 2 and the channel recording terminal 5 to receive service messages. The directory agent 4 is configured to manage registered or subscribed multicast addresses and corresponding service identities. The channel recorder 5 is configured to receive service messages of all multicast channels and to persist the received service messages. Preferably, the channel recorder 5 may subscribe to all services from the directory agent 4 to enable reception of service messages for all multicast channels. Meanwhile, persistence is a mechanism to transition program data between a persistent state and a transient state. In particular, persistence stores data (e.g., objects in memory) in the form of files or databases in a storage device (e.g., disk) that can be permanently stored.
Fig. 2 is a flowchart of a distributed message exchange method according to a first embodiment of the present invention. As shown in fig. 2, in step S110, the message distributor 1 sends identity information to the authentication server 3 for authentication, and acquires the right to send service messages in the multicast subnet. The channel recording end 5 and the message consuming end 2 respectively send identity information to the authentication server 3 for authentication and authentication, and acquire the authority of receiving service messages in the multicast subnet.
Specifically, the message distribution end 1 may log in the authentication server 3 to perform authentication, and after the authentication is passed, the authentication server 3 sends an electronic signature or an electronic certificate to the corresponding message distribution end 1, so that the message distribution end 1 obtains the authority to send the service message in the multicast subnet. Similarly, the message consumption end 2 can log in the authentication server 3 for authentication, after the authentication is passed, the authentication server 3 sends an electronic signature or electronic certificate to the corresponding message consumption end 2 so that the message consumption end 2 obtains the authority to receive the service message in the multicast subnet. The channel recording end 5 can log in the authentication server 3 to perform authentication, and after the authentication is passed, the authentication server 3 sends an electronic signature or an electronic certificate to the corresponding channel recording end 5 so that the channel recording end 5 obtains the authority of receiving the service message in the multicast subnet. It is easy to understand that the electronic signatures or electronic certificates sent by the authentication server 3 to the message distributor 1, the message consumer 2 and the channel recorder 5 are different to distinguish different rights.
It should be understood that the authentication of the message issuing side 1, the message consuming side 2 and the channel recording side 5 are independent operations. The channel recording end 5 performs authentication at the system initialization. The message originator 1 and the message consumer 2 may authenticate when they need to issue or receive service messages.
In step S120, the message distributor 1 sends the multicast address and the corresponding service identifier to the directory agent 4 according to the pre-configured configuration information to register the service.
In this embodiment, the configuration information of the message distributor 1 includes a multicast address and a corresponding service identifier for the message distributor to distribute service messages.
The multicast address is an IP address of the multicast group. In the process of unicast data transmission, a data packet transmission path is routed from a source address to a destination address, and is transmitted in an IP network by using the principle of 'hop-by-hop'. However, in the IP multicast ring, the destination addresses of the packets are not one, but one group, forming a multicast group. A member wishing to receive a multicast needs to join a multicast group and, after joining, data streaming to the multicast address starts to be transmitted to the joining member immediately, and all members in the multicast group can receive the data packet. The membership in a multicast group is dynamic, hosts can join and leave the multicast group at any time, and hosts can join multiple multicast groups simultaneously.
Different service marks are different in message type, the service marks correspond to multicast addresses one by one, and the multicast channels at the bottom layer correspond to services which can be used by the message issuing end 1 and the message consuming end 2. Thus, through the publishing service and the subscription service, decentralized message exchange can be realized.
In step S130, the message consumer 2 subscribes to the service from the directory agent 4 according to the service identifier in the preconfigured configuration information to obtain the corresponding multicast address, and accesses the corresponding multicast channel according to the multicast address. The channel recording end 5 subscribes all services to the directory agent 4 according to the pre-configured configuration information to acquire all corresponding multicast addresses, and respectively accesses the corresponding multicast channels according to the multicast addresses.
Specifically, the message consumer 2 may obtain a corresponding multicast address after subscribing to the service. The message server 2 may add a message to the multicast group corresponding to the multicast address by sending the message to the router as the hardware facility, thereby accessing the multicast channel.
The configuration information of the message recording terminal 5 includes all service identifiers, so that all services in the directory agent 4 can be subscribed to. The message recording terminal 5 cyclically sends subscription information to the directory agent 4 to subscribe to all services in real time.
It should be understood that the message publisher 1 and the channel recorder 5 subscribe to the service independently and do not restrict each other. The message publishing terminal 1 subscribes to the service according to the configured service identifier when it needs the corresponding service message. While the channel recording side 5 needs to scan the directory agent 4 in real time to subscribe to all services.
In step S140, the message distributor 1 distributes a service message to the multicast channel corresponding to the registered multicast address.
In step S150, the message consumer 2 receives the service message in the multicast channel to which it is subscribed. The channel recording end 5 receives the service messages in all multicast channels in the multicast subnet and persists the received service messages.
In an alternative embodiment, the message consumer 2 may obtain a history message of the service subscribed by the message consumer 2 by sending a request to the channel logger 5.
The channel recorder 5 may subscribe all service messages to the multicast channel to receive all service messages, or all message issuers 1 may send messages to the channel recorder 5 by using TCP communication. After the message consumer 2 joins the multicast channel, the message sender 1 has already issued the message, and at this time, the message consumer 2 may request the channel recorder 5 for the history message. In addition, since UDP communication is unreliable, there is a possibility that the service message is lost during transmission, and thus the message consumption end 2 may miss the subscribed service message. At this time, the message consumer terminal 2 may request the history message from the channel recording terminal 5.
Specifically, the message consumption side 2 transmits information requesting a history message to the channel recording side 5 at step S160.
In step S170, the message recorder 5 sends the history service message requested by the message consumer 2.
The message consuming side 2 may send the request for the history message to the channel recording side through multicast communication after subscribing to the service through the configuration information and joining the corresponding multicast channel, or may send the request for the history message through other communication methods (such as TCP communication). It should be appreciated that in a multicast group, the multicast members may shield information that is not needed.
It should be understood that the above step numbers do not indicate the order between the steps, and the steps related to different execution subjects described above may be changed according to actual situations. For example, a message consumer 2 may join a subnet when there are already multiple message consumers 2, and perform the steps of authentication, service subscription, and message reception. Meanwhile, after authentication and registration service, one message publishing terminal 1 may join in multicast of a plurality of existing message consuming terminals 2, and then publish messages. The embodiment adopts the idea of micro-service, and integrates functions of authentication, service release, service subscription, service management, message persistence and the like into different micro-functional entities, so that the coupling among the functional entities is reduced, the decentralization of message exchange is realized, and the development and maintenance are more convenient. And the information is exchanged in real time by adopting a UDP (user Datagram protocol) multicast mode, so that the efficiency and the performance of the system are improved.
Fig. 3 is a schematic diagram of a distributed message exchange system of a second embodiment of the present invention. As shown in fig. 3, the distributed message exchange system of the second embodiment includes a message publishing terminal 1, a message consuming terminal 2, an authentication server 3, a configuration management terminal 4, a directory agent 5, a channel recording terminal 6, and a monitoring management terminal 7. The message issuing end 1, the message consuming end 2, the authentication server 3, the configuration management end 4, the directory agent 5, the channel recording end 6 and the monitoring management end 7 are located in the same UDP multicast subnet, and can communicate with each other through UDP multicast.
In this embodiment, the message distribution end 1 is configured to send the multicast address and the corresponding service identifier to the directory agent 5 according to the configured configuration information to register the service, and distribute the service message to the multicast channel corresponding to the registered multicast address. The message consuming end 2 is configured to subscribe to the service from the directory agent 5 according to the service identifier in the configured configuration information to obtain the corresponding multicast address, and to access the multicast channel according to the multicast address to receive the service message. The authenticated server 3 is configured to perform authentication on the message publishing terminal 1, the message consuming terminal 2 and the channel recording terminal 6 to grant the message consuming terminal 1 the right to send the service message, and to grant the message consuming terminal 2 and the channel recording terminal 6 the right to receive the service message. The configuration management terminal 4 is configured to configure corresponding configuration information to the message publishing terminal 1, the message consuming terminal 2 and the channel recording terminal 6 respectively. The configuration information of the message distributor 1 includes a multicast address and a corresponding service identifier. The configuration information of the message consumer 2 comprises the service identification of the service to be acquired. The configuration information of the channel record side 6 includes service identifications of all services. The directory agent 5 is configured to manage registered or subscribed multicast addresses and corresponding service identities. The channel recorder 6 is configured to receive service messages of all multicast channels and to persist the received service messages. The channel logger 6 is further configured to send the corresponding history message to the message consumer 2 requesting the history message. The monitoring management terminal 7 is configured to monitor application health parameters in the system, the application health parameters including process status, throughput of messaging, success rate of service registration and subscription, and loss rate of messages. Fig. 4 is a flowchart of a distributed message exchange method according to a second embodiment of the present invention. As shown in fig. 4, in step S210, the message distributor 1 sends identity information to the authentication server 3 for authentication, and acquires the right to send service messages in the multicast subnet. The channel recording end 6 and the message consuming end 2 respectively send identity information to the authentication server 3 for authentication and authentication, and acquire the authority of receiving service messages in the multicast subnet.
Specifically, the message distribution end 1 may log in the authentication server 3 to perform authentication, and after the authentication is passed, the authentication server 3 sends an electronic signature or an electronic certificate to the corresponding message distribution end 1, so that the message distribution end 1 obtains the authority to send the service message in the multicast subnet. Similarly, the message consumption end 2 can log in the authentication server 3 for authentication, after the authentication is passed, the authentication server 3 sends an electronic signature or electronic certificate to the corresponding message consumption end 2 so that the message consumption end 2 obtains the authority to receive the service message in the multicast subnet. The channel recording end 5 can log in the authentication server 3 to perform authentication, and after the authentication is passed, the authentication server 3 sends an electronic signature or an electronic certificate to the corresponding channel recording end 5 so that the channel recording end 5 obtains the authority of receiving the service message in the multicast subnet. It is easy to understand that the electronic signatures or electronic certificates sent by the authentication server 3 to the message distributor 1, the message consumer 2 and the channel recorder 5 are different to distinguish different rights.
It should be understood that the authentication of the message issuing side 1, the message consuming side 2 and the channel recording side 5 are independent operations. The channel recording end 5 performs authentication at the system initialization. The message originator 1 and the message consumer 2 may authenticate when they need to issue or receive service messages.
In step S220, the configuration management end 4 configures corresponding configuration information to the message publishing end 1, the message consuming end 2, and the channel recording end 6, respectively.
Specifically, the message distribution end 1 that has passed the authentication and the authentication sends a request for obtaining the configuration information of the service type to be distributed to the configuration management end 4, and the configuration management end 4 responds the request to the message distribution end 1 to distribute the configuration information. The configuration information of the message publisher 1 includes the service identifier of the type of the service to be published and the corresponding multicast address. Similarly, the message consumption end 2 that has passed the authentication sends a request for obtaining the configuration information of the service type to be received to the configuration management end, and the configuration management end 4 responds the request to the message consumption end 2 for configuring the information. The configuration information of the message consumer 2 comprises a service identification of the type of service that needs to be received. The message recording end 6 which passes the authentication and the authentication sends a request for acquiring the configuration information which can receive all service types to the configuration management end 4, and the configuration management end 4 responds the request to the channel recording end 6 for configuration information. The configuration information of the channel record end 6 includes service identifiers corresponding to all service types. The configuration management terminal 4 is adopted to manage all the configuration information, so that the unified management and upgrade of the configuration information are facilitated, and the performance of the system is improved.
It should be understood that the operations of the message issuing side 1, the message consuming side 2 and the channel recording side 6 for requesting the configuration information are performed independently, and are not synchronized and interfere with each other. The channel recording side 6 needs to request configuration information at system initialization. The message distributor 1 and the message consumer 2 may request to configure corresponding configuration information when necessary.
In step S230, the message distributor 1 sends the multicast address and the corresponding service identifier to the directory agent 5 according to the configuration information to register the service.
The service identification is corresponding to the multicast address one by one, and the multicast channel at the bottom layer is corresponding to the service which can be used by the message issuing end 1 and the message consuming end 2. Thus, through the publishing service and the subscription service, decentralized message exchange can be realized.
In step S240, the message consumer 2 subscribes to the service from the directory agent 5 according to the service identifier in the configuration information to obtain a corresponding multicast address, and accesses a corresponding multicast channel according to the multicast address. The channel recording end 5 subscribes all services to the directory agent 4 according to the pre-configured configuration information to acquire all corresponding multicast addresses, and respectively accesses the corresponding multicast channels according to the multicast addresses.
Specifically, the message consumer 2 may obtain a corresponding multicast address after subscribing to the service. The message server 2 may add a message to the multicast group corresponding to the multicast address by sending the message to the router as the hardware facility, thereby accessing the multicast channel. The message recorder 6 sends a request for subscribing all services to the directory agent 5 in a loop so as to subscribe all services in real time.
It should be understood that the subscription service of the message distributor 1 and the channel recorder 6 are independent operations, and are not simultaneous and not restricted to each other. The message publishing terminal 1 subscribes to the service according to the configured service identifier when it needs the corresponding service message. While the channel recording side 6 needs to scan the directory agent 5 in real time to subscribe to all services.
In step S250, the message distributor 1 distributes a service message to the multicast channel corresponding to the registered multicast address.
In step S260, the message consumer 2 receives the service message in the multicast channel to which it is subscribed. The channel recording end 6 receives service messages in all multicast channels in the multicast subnet and persists the received messages. The persistence is a mechanism that transitions program data between a persistent state and a transient state. In particular, persistence stores data (e.g., objects in memory) in the form of files or databases in a storage device (e.g., disk) that can be permanently stored. The channel recording end 6 persists the service messages in all multicast channels, so that the message consuming end 2 that does not receive the multicast message in time (for example, when the message consuming end 2 joins in the multicast, the message is already published, etc.) can obtain the required history message by sending a request to the recording end 6.
In step S270, the message publishing terminal 1, the message consuming terminal 2, and the channel recording terminal 6 send information such as application health parameters to the monitoring management terminal 7. The application health parameters include a process state, a throughput of message transceiving, a success rate of service registration and subscription, a loss rate of messages, and the like. By monitoring the application health parameters in the system through the monitoring management terminal 7, the problems encountered during message exchange can be conveniently and quickly found so as to be solved in time, and the reliability of the message exchange system is improved. It should be understood that the above step numbers do not indicate the order between the steps, and the steps related to different execution subjects described above may be changed according to actual situations. For example, a message consumer 2 may join a subnet when there are already multiple message consumers 2, and perform the steps of authentication, service subscription, and message reception. Meanwhile, after authentication and registration service, one message publishing terminal 1 may join in multicast of a plurality of existing message consuming terminals 2, and then publish messages.
In an alternative embodiment, when the message consumer 2 misses or loses the subscribed history message, the history message may be requested from the channel logger 6.
Specifically, the message consumer 2 requests the specified history service message from the channel logger 6 at step S280.
In step S290, the channel recording side 6 sends the history service message requested by itself to the message consumption side 2.
Compared with the first embodiment, the second embodiment of the invention has the advantages that the distributed message exchange system of the second embodiment is added with the configuration management end 4 and the monitoring management end 7, except that the micro-service and UDP multicast technology is adopted, the message exchange is decentralized, the development and maintenance are more convenient, the information is exchanged in real time, the efficiency and the performance are improved, and the like. The configuration management terminal 4 manages the configuration information corresponding to each functional component uniformly, so that the system upgrade can be completed more conveniently. The monitoring management terminal 7 collects the application health parameters of each functional component, can know the running condition of the system in real time, and can find and solve the problem in time when the system breaks down.
Fig. 5 is a schematic diagram of a distributed message exchange system of a third embodiment of the present invention. As shown in fig. 5, the distributed message switching system of the fourth embodiment includes a first multicast subnet 1 and a second multicast subnet 2. The first multicast subnetwork 1 comprises a message distribution end 11, a first authentication server 12, a first directory agent 13, a first message agent 14 and a first channel recording end 15. The second multicast subnetwork 2 comprises a second message broker 21, a second authentication server 22, a second message consumer 23, a second directory broker 24 and a second channel logger 25. The functional components within the first multicast subnetwork 1 and the second multicast subnetwork 2 can communicate with each other via UDP multicast. The first multicast subnetwork 1 and said second multicast subnetwork 2 communicate via the TCP protocol. It should be appreciated that multicast communication cannot occur across subnets. In the first multicast subnet 1, the message distribution end 11 is configured to send a multicast address and a corresponding service identifier to all directory proxies (the first directory proxy 13 and the second directory proxy 24) according to the pre-configured configuration information to register a service, and distribute a service message through a multicast channel corresponding to the registered multicast address. The first message broker 14 is configured to subscribe to a service from the first directory broker 13 according to the service identifier in the preconfigured configuration information to obtain a corresponding multicast address, access a multicast channel according to the multicast address to receive a service message, and send the received service message and the corresponding multicast address to the second message broker 21. The first authentication server 12 is configured to authenticate the message distributor 11 and the first channel recorder 15 to grant the message consumer 11 the right to send the service message, and to grant the first message broker 14 and the first channel recorder 15 the right to receive the service message. The first directory agent 13 is configured to manage registered or subscribed multicast addresses and corresponding service identities. The first channel recorder 15 is configured to receive service messages of all multicast channels and to persist the received service messages. The first channel logger 15 is further configured to send the corresponding history messages to the message consumer or message broker 14 requesting the history messages. It should be understood that the message consumers are not shown in the illustrated first multicast subnet, but are not representative of the absence of message consumers in the multicast subnet.
In the second multicast subnet, the second message broker 21 is configured to publish messages received from the first message broker 14 in the second multicast subnet. The second authentication server 22 is configured to perform authentication on the message consuming side 23 and the second channel recording side 25 to grant the second message broker 21 the right to send the service message, and to grant the message consuming side 23 and the second channel recording side 25 the right to receive the service message. The message consumer 23 is configured to subscribe to the service from the second directory agent 24 according to the service identifier in the preconfigured configuration information to obtain the corresponding multicast address, and access the multicast channel to receive the service message according to the multicast address. The second directory agent 24 is configured to manage registered or subscribed multicast addresses and corresponding service identifications. The second channel record peer 25 is configured to receive service messages of all multicast channels and to persist the received service messages. The first channel recording end 25 is further configured to send a corresponding history message to the message consuming end 23 requesting the history message.
It should be understood that only one authentication server may be set for all multicast subnets, and all message consumers and message issuers authenticate with this authentication server.
In different multicast subnets, the service identifier of the same message service type is the same as the corresponding multicast address, so that the publish/subscribe message service between different multicast subnets can be realized through the message broker.
Fig. 6 is a flowchart of a distributed message exchange method according to a third embodiment of the present invention. As shown in fig. 6, in step S310, the message distributor 11 sends identity information to the first authentication server 12 for authentication. The message consumption end 23 sends the identity information to the second authentication server 22 for authentication. The message distributor 11 obtains the right to send service messages in the first and second multicast subnets. The message consumer 23 obtains the right to receive service messages within the second multicast subnet.
It should be understood that the authentication and authorization operations are independent operations, and do not represent simultaneous operations or restrict each other.
In step S320, the message distributor 11 sends the multicast address and the corresponding service identifier to all directory agents (the first directory agent 13 and the second directory agent 24) according to the pre-configured configuration information to register the service.
In this embodiment, the configuration information of the message publisher 11 includes a multicast address and a corresponding service identifier for the message publisher to publish a service message.
In step S330, the first message broker 14 subscribes to the service from the first directory broker 13 according to the service identifier in the pre-configured configuration information to obtain the corresponding multicast address, and accesses the multicast channel according to the multicast address. The message consuming end 23 subscribes to the service from the second directory agent 24 according to the service identifier in the pre-configured configuration information to obtain the corresponding multicast address, and accesses the multicast channel according to the multicast address.
In particular, the first message broker 13 and the message consumer 23 may obtain a corresponding multicast address after subscribing to the service. The first message broker 13 and the message consumer 23 may join the multicast group corresponding to the multicast address by sending a message to a router as a hardware facility, thereby accessing the multicast channel.
It should be understood that the authentication and authorization operations are independent operations, and do not represent simultaneous operations or restrict each other.
In step S340, the message distributor 11 distributes a service message to the multicast channel corresponding to the registered multicast address.
At step S350, the first message broker 14 receives the service message in the multicast channel to which it is subscribed.
At step S360, the first message broker 14 transmits the received service message and the corresponding multicast address to the second message broker 21 in TCP communication.
At step S370, the second message broker 21 enters the multicast channel according to the multicast address obtained from the first message broker 14 and issues the message received from the first message broker 14 into the multicast channel.
At step S380, the message consumer 23 receives the service message in the multicast channel to which it subscribes.
In an alternative embodiment, when the message consumer 23 misses or loses a subscribed service message, a history message may be requested from the message recorder 25. The message recorder 25 sends the history service message it requested to the message consumer 23. The above step numbers do not indicate the order between the steps, and the steps relating to different execution subjects described above may be changed according to actual situations. For example, one message consumer 23 may be added to the subnet when there are already multiple message consumers 23, and perform the steps of authentication, service subscription, and message reception. Meanwhile, after performing authentication and registration service, one message distributor 11 may join a multicast of a plurality of existing message consumers 23, and then distribute messages.
The fourth embodiment of the invention describes that when the message issuing end and the message consuming end are in different multicast subnets, the efficient and convenient message exchange is realized through the mutual cooperation of TCP communication and UDP multicast communication.
Fig. 7 is a schematic diagram of a distributed message exchange system of a fourth embodiment of the present invention. As shown in fig. 7, the distributed message exchange system of the fourth embodiment includes a message distribution end 1, a message consumption end 2, a channel recording end 3, and a directory agent 4. The message issuing end 1, the message consuming end 2, the channel recording end 3 and the directory agent 4 are located in the same UDP multicast subnet, and can communicate with each other through UDP multicast.
In the embodiment of the present invention, the message distribution end 1 is configured to send a multicast address and a corresponding service identifier to the directory agent according to the pre-configured configuration information to register a service, and distribute a service message through a multicast channel corresponding to the registered multicast address. The message consumption end 2 is configured to subscribe to the service from the directory agent 4 according to the service identifier in the pre-configured configuration information to obtain the corresponding multicast address, and access a multicast channel to receive the service message according to the multicast address. The channel recorder 3 is configured to receive service messages of all multicast channels and to persist the received service messages. The first channel recording end 5 is further configured to send a corresponding history message to the message consuming end 2 requesting the history message. Preferably, the channel recorder 5 may subscribe to all services from the directory agent 4 to enable reception of service messages for all multicast channels. Meanwhile, persistence is a mechanism to transition program data between a persistent state and a transient state. In particular, persistence stores data (e.g., objects in memory) in the form of files or databases in a storage device (e.g., disk) that can be permanently stored. The directory agent 4 is configured to perform authentication and authorization on the message publishing terminal 1, the message consuming terminal 2 and the channel recording terminal 5 to grant the right of the message consuming terminal 1 to send service messages and grant the right of the message consuming terminal 2 and the channel recording terminal 5 to receive service messages. The directory agent 4 is also configured to manage registered or subscribed multicast addresses and corresponding service identities. Compared with the first embodiment of the invention, the invention integrates the functions of the directory agent and the authentication server into the directory agent, and one functional component is reduced, so that the system deployment is simpler and easier to realize.
Fig. 8 is a flowchart of a distributed message exchange method according to a fourth embodiment of the present invention. As shown in fig. 8, in step S410, the message distributor 1 sends identity information to the directory agent 4 for authentication to obtain the right to send service messages in the multicast subnet. The message consumption end 2 and the channel recording end 3 respectively send identity information to the authentication server 3 for authentication and authentication, and the authority of receiving service messages in the multicast subnet is obtained.
Specifically, the message distribution end 1 may log in the directory agent 4 for authentication, and after the authentication passes, the directory agent 4 stores the identity information of the message distribution end 1 and marks the identity information as authenticated. Similarly, the message consumption end 2 can log in the directory agent 4 for authentication, and after the authentication is passed, the directory agent 4 stores the identity information of the message consumption end 2 and marks the identity information as authenticated. The channel recording terminal 3 can log in the directory agent 4 for authentication, and after the authentication is passed, the directory agent 4 stores the identity information of the channel recording terminal 3 and marks the identity information as authenticated. It is easy to understand that the directory agent 4 has different authentication marks for the message distributor 1, the message consumer 2 and the channel recorder 3 to distinguish different rights.
It should be understood that the authentication of the message issuing side 1, the message consuming side 2 and the channel recording side 3 is an independent operation which is not limited and also not restricted to each other. The channel recording end 5 performs authentication at the system initialization. The message publishing terminal 1 and the message consuming terminal 2 can perform authentication and authentication when a service message needs to be published or received.
In step 420, the message distributor 1 sends the multicast address and the corresponding service identifier to the directory agent 4 according to the pre-configured configuration information to register the service.
In this embodiment, the configuration information of the message distributor 1 includes a multicast address and a corresponding service identifier for the message distributor to distribute service messages.
In step S430, the message consumer 2 subscribes to the service from the directory agent 4 according to the service identifier in the preconfigured configuration information to obtain the corresponding multicast address, and accesses the corresponding multicast channel according to the multicast address. The channel recording end 3 subscribes all services to the directory agent 4 according to the pre-configured configuration information to acquire all corresponding multicast addresses, and respectively accesses the corresponding multicast channels according to the multicast addresses.
Specifically, the message consumer 2 may obtain a corresponding multicast address after subscribing to the service. The message server 2 may add a message to the multicast group corresponding to the multicast address by sending the message to the router as the hardware facility, thereby accessing the multicast channel.
The configuration information of the message recording side 3 includes all service identifications, so that all services in the directory agent 4 can be subscribed. The message recording end 3 circularly sends subscription information to the directory agent 4 to subscribe all services in real time.
It should be understood that the subscription service of the message distributor 1 and the channel recorder 3 are independent operations, and do not restrict each other. The message publishing terminal 1 subscribes to the service according to the configured service identifier when it needs the corresponding service message. And the channel recording side 3 needs to scan the directory agent 4 in real time to subscribe to all services.
In step S440, the message distributor 1 distributes a service message to the multicast channel corresponding to the registered multicast address.
At step S450, the message consumer 2 receives the service message in the multicast channel to which it is subscribed. The channel recording end 3 receives the service messages in all multicast channels in the multicast subnet and persists the received service messages.
In an alternative embodiment, when the message consumer 2 misses or loses a subscribed service message, a history message may be requested from the message recorder 3. The message recorder 3 sends the history service message requested by the message consumer 2.
The directory agent in this embodiment is used to implement two functions of authentication and service management. One functional component is reduced, so that the system is more convenient to deploy. Moreover, the directory agent can directly store and mark the authentication information after authentication, and does not need to send identifications such as electronic certificates to the authentication end, thereby being easy to realize.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method of distributed message exchange, comprising:
the message issuing end sends a multicast address and a corresponding service identifier to the directory agent according to the pre-configured configuration information to register the service;
the message consumption end subscribes to the service from the directory agent according to the service identifier in the pre-configured configuration information to acquire a corresponding multicast address, and accesses a multicast channel according to the multicast address;
the message issuing end issues service messages through multicast channels corresponding to the registered multicast addresses;
the message consumption end receives service messages in a subscribed multicast channel;
the channel recording end receives the service messages of all the multicast channels and makes the received service messages persistent;
the message consumption end sends a request to the channel recording end to acquire the historical service message of the subscribed service;
the message issuing end, the message consuming end, the directory agent and the channel recording end are located in the same multicast subnet.
2. The distributed message exchange method of claim 1, wherein the method further comprises, prior to the message publisher registering for service:
the message issuing end carries out authentication and authorization to an authentication server to acquire the authority of sending the service message; and
the channel recording end carries out authentication and authorization to an authentication server to acquire the authority of receiving the service message;
the method further comprises the following steps before the message consumer subscribes to the service:
and the message consumption end carries out authentication and authorization to the authentication server to acquire the authority of receiving the service message.
3. The distributed message exchange method of claim 1, wherein the method further comprises:
and the configuration management end respectively configures the corresponding configuration information to the message publishing end, the message consuming end and the channel recording end.
4. The distributed message exchange method of claim 1, wherein the method further comprises:
the method comprises the steps that a monitoring management end monitors application health parameters in a system, wherein the application health parameters comprise a process state, message receiving and sending throughput, service registration and subscription success rate and message loss rate.
5. The distributed message exchange method of claim 1, wherein the method further comprises:
and transmitting the service message from the first multicast subnet where the message publishing terminal is positioned to the second multicast subnet where the message consuming terminal is positioned by utilizing the message agent.
6. The distributed message exchange method of claim 1, wherein the multicast channel is a UDP multicast channel.
7. A distributed message exchange system, comprising:
a directory agent configured to manage registered or subscribed multicast addresses and corresponding service identifications;
the message issuing end is configured to send the multicast address and the corresponding service identifier to the directory agent according to the pre-configured configuration information so as to register the service, and issue the service message through the multicast channel corresponding to the registered multicast address;
the message consumption end is configured to subscribe the service to the directory agent according to the service identifier in the pre-configured configuration information so as to acquire a corresponding multicast address, and access a multicast channel according to the multicast address to receive the service message; and
the channel recording end is configured to receive the service messages of all the multicast channels and persist the received service messages;
the message issuing end, the message consuming end, the directory agent and the channel recording end are located in the same multicast subnet.
8. The distributed message exchange system of claim 7 wherein the message consumer is further configured to send a request to the channel logger to obtain historical service messages for the subscribed services.
9. The distributed message exchange system of claim 7, wherein the system further comprises:
and the authentication server is configured to authenticate and authenticate the message publishing terminal, the message consuming terminal and the channel recording terminal so as to grant the right of the message consuming terminal to send the service message and grant the right of the message consuming terminal and the channel recording terminal to receive the service message.
10. The distributed message exchange system of claim 7, wherein the system further comprises:
and the configuration management end is configured to configure the corresponding configuration information to the message publishing end, the message consuming end and the channel recording end respectively.
11. The distributed message exchange system of claim 7, wherein the system further comprises:
the monitoring management terminal is configured to monitor application health parameters in the system, wherein the application health parameters comprise a process state, a message transceiving throughput, a service registration and subscription success rate and a message loss rate.
12. The distributed message exchange system of claim 7, wherein the system further comprises:
and the message agent is used for sending the service message from the first subnet where the message publishing terminal is positioned to the message agents positioned in other subnets.
CN201710867141.7A 2017-09-22 2017-09-22 Distributed message exchange method and system Active CN107592364B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710867141.7A CN107592364B (en) 2017-09-22 2017-09-22 Distributed message exchange method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710867141.7A CN107592364B (en) 2017-09-22 2017-09-22 Distributed message exchange method and system

Publications (2)

Publication Number Publication Date
CN107592364A CN107592364A (en) 2018-01-16
CN107592364B true CN107592364B (en) 2020-08-11

Family

ID=61048422

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710867141.7A Active CN107592364B (en) 2017-09-22 2017-09-22 Distributed message exchange method and system

Country Status (1)

Country Link
CN (1) CN107592364B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109992432A (en) * 2019-03-15 2019-07-09 青岛海信移动通信技术股份有限公司 A kind of data processing system and method based on message queue
CN110730116B (en) * 2019-10-21 2021-10-29 杭州鸿雁智能科技有限公司 Operation method of communication equipment in local area network, communication equipment and gateway equipment
CN111245925B (en) * 2020-01-09 2021-08-24 北京理工大学 Communication method and system for modern distributed micro-service architecture
CN111399787B (en) * 2020-03-25 2023-04-21 中孚安全技术有限公司 Distributed printing auditing system and auditing method
CN113301091B (en) * 2020-07-31 2022-10-28 阿里巴巴集团控股有限公司 Message processing method and device for distributed system, electronic equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102457906A (en) * 2010-10-26 2012-05-16 中国移动通信集团河南有限公司 Load balancing control method and system of message queues
CN103856393A (en) * 2013-07-09 2014-06-11 携程计算机技术(上海)有限公司 Distributed message-oriented middleware system based on database and operating method thereof
CN104618221A (en) * 2015-01-06 2015-05-13 厦门雅迅网络股份有限公司 Decentralized message service system
CN104980441A (en) * 2015-06-26 2015-10-14 浪潮软件股份有限公司 Tenant authentication mechanism realizing method
CN105306559A (en) * 2015-10-12 2016-02-03 国电南瑞科技股份有限公司 Multi-partition message control system without central partition for regional power grid regulation and control system
CN106302817A (en) * 2016-09-29 2017-01-04 南京中新赛克科技有限责任公司 A kind of data/address bus implementation method based on Distributed Message Queue and device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101136741A (en) * 2006-08-30 2008-03-05 西安电子科技大学 Multicast key management method and central node used for the same
US9356907B2 (en) * 2008-08-05 2016-05-31 HeyWire, Inc. Messaging system having multiple number, dual mode phone support
CN101567905B (en) * 2009-06-03 2011-12-21 杭州华三通信技术有限公司 Method, sending terminal and receiving terminal for data synchronization
US9100202B2 (en) * 2010-11-18 2015-08-04 Business Objects Software Limited Message routing based on modeled semantic relationships
CN105610926B (en) * 2015-12-22 2019-01-11 广州品唯软件有限公司 Message delivery method, system and message-oriented middleware system
CN105677494A (en) * 2016-02-01 2016-06-15 北京京东尚科信息技术有限公司 Message distribution method and device
CN105933384B (en) * 2016-04-06 2021-05-25 腾讯科技(深圳)有限公司 File sharing method, terminal and file sharing system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102457906A (en) * 2010-10-26 2012-05-16 中国移动通信集团河南有限公司 Load balancing control method and system of message queues
CN103856393A (en) * 2013-07-09 2014-06-11 携程计算机技术(上海)有限公司 Distributed message-oriented middleware system based on database and operating method thereof
CN104618221A (en) * 2015-01-06 2015-05-13 厦门雅迅网络股份有限公司 Decentralized message service system
CN104980441A (en) * 2015-06-26 2015-10-14 浪潮软件股份有限公司 Tenant authentication mechanism realizing method
CN105306559A (en) * 2015-10-12 2016-02-03 国电南瑞科技股份有限公司 Multi-partition message control system without central partition for regional power grid regulation and control system
CN106302817A (en) * 2016-09-29 2017-01-04 南京中新赛克科技有限责任公司 A kind of data/address bus implementation method based on Distributed Message Queue and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
PaaS云基础架构中消息中间件的设计与实现;夏千林;《中国优秀硕士学位论文全文数据库》;20150415;I139-329 *

Also Published As

Publication number Publication date
CN107592364A (en) 2018-01-16

Similar Documents

Publication Publication Date Title
CN107592364B (en) Distributed message exchange method and system
US11218488B2 (en) Access enforcement at a wireless access point
US10863422B2 (en) Mechanisms for ad hoc service discovery
CN104350724B (en) Client is by means of methods of the OPC UA to the access of service
EP2145450B1 (en) A node and method to provide and keep real-time up-to-date data in a distributed hash table
US8924509B2 (en) Automated service discovery and dynamic connection management
JP5590580B2 (en) Method and system for supporting communication peer selection in an overlay network
US11770707B2 (en) Lattice mesh
CN108833591B (en) method, electronic equipment, device and network architecture for data transmission in P2P network
CN107404512B (en) Resource subscription method, resource subscription device and resource subscription system
EP2248038A1 (en) Method and system for transmitting data in a computer network
JP2008527841A (en) Configuration for providing peer-to-peer communication in public land mobile networks
Li et al. IoT middleware architecture over information-centric network
US7325072B2 (en) Inter-subnet multicast relaying service-a network infrastructure independent solution to cross subnet multicasting
KR20110095948A (en) Multicast quality of service module and method
Diefenbach et al. Realizing overlay Xcast in a tactical service infrastructure: An approach based on a service-oriented architecture
DK2355403T3 (en) PROCEDURE FOR DISTRIBUTION OF DATA ON A MOBILE AD-HOC REMOVAL DATA
WO2017198088A1 (en) Resource subscription method, resource subscription device, and resource subscription system
US11089059B2 (en) Cloned device detection
Angius et al. Prefix hopping: Efficient many-to-many communication support in information centric networks
Dulal NDNSD: Service publishing and discovery in NDN
KR20070072498A (en) Method for configuring billing processes in network elements
Fuhrmann et al. A Node Evaluation Mechanism for Service Setup in AMnet.
KR20200065888A (en) Method for caching content based on provider and apparatus for the same
Kuladinithi et al. CoRE M. Becker, Ed. Internet-Draft ComNets, TZI, University Bremen Intended status: Standards Track K. Li Expires: August 9, 2013 Huawei Technologies

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