A system based on message collection and multi-dimensional distribution
By introducing microservice architecture and message middleware into the message collection and distribution system, combined with the public key decryption verification and compensation mechanism, the consistency problem of high concurrency and multi-dimensional data distribution is solved, and high performance and data security are achieved. Ensures the integrity and consistency of data after distribution.
Patent Information
- Application Number
- CN202110564578.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-24
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-05-24
AI Technical Summary
Existing message collection and message distribution systems have problems such as decryption verification, data filling, idempotent processing, and abnormal alarms in scenarios with high concurrency and high data security and accuracy requirements, and it is difficult to ensure that data is stored in multiple dimensions. Post-distribution consistency.
A system based on microservice architecture is designed, including message collection service cluster, message distribution service cluster and data verification service cluster. Through message middleware and public key decryption verification mechanism, high concurrency processing and multi-dimensional distribution of data are realized. , and ensure data consistency through compensation mechanisms.
It achieves high concurrency and secure collection and distribution of device data, supports custom keys, enhances system performance and data security, ensures the integrity and consistency of data after multi-dimensional distribution, and handles it in a timely manner through an early warning mechanism. Abnormal circumstances.
Smart Images

Figure CN113190571B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of Internet, and in particular relates to a system based on message collection and multi-dimensional distribution. Background Art
[0002] With the development of the Internet of Things, the communication requirements between devices and background servers are getting higher and higher. At the same time, devices will send data to the server irregularly or all the time. Some data may be very important, so the security, stability of communication and accuracy of data are very high. At the same time, the concurrency required for the server to receive data is also very large. After the background service receives the message, it is necessary to first verify, idempotent, and fill in the data. If there is a problem, an early warning needs to be issued to notify the relevant personnel. If there is no problem, the data will be distributed according to multiple dimensions, and the dimensions can be customized. After the data is distributed, it is also necessary to check whether the data is correctly received in other business services. Based on the existing problems of message collection and message distribution, there is an urgent need for a system based on message collection and multi-dimensional distribution to solve the above problems. Summary of the invention
[0003] The present invention provides a system based on message collection and multi-dimensional distribution to solve the above-mentioned problems.
[0004] To solve the above problems, the technical solutions provided by the present invention are as follows: To solve the above problems, the technical solutions provided by the present invention are as follows: A system based on message collection and multi-dimensional distribution, comprising a message collection service cluster, a message distribution service cluster, a business service cluster and a data verification service cluster; the message collection service cluster receives data uploaded by the device and decrypts and verifies the data, and sends the decrypted and verified data to the message distribution service cluster; the message distribution service cluster obtains the decrypted and verified data and performs filling processing, and sends the filled data to the business service cluster through the message distributor, the business service cluster obtains the pulled business message through the message distribution service cluster, and the message distribution service cluster obtains the corresponding compensation message through the data verification service cluster.
[0005] Preferably, the message collection service cluster is provided with a data receiving unit, a decryption verification unit, an early warning unit and a message middleware; the data receiving unit receives data on the device; the decryption verification unit performs decryption verification on the data in the data receiving unit: if the verification fails, the data is directly returned, and a verification failure message is sent to the early warning unit, and the early warning unit issues an early warning notification message and performs problem troubleshooting; if the verification succeeds, the data is first sent to the message middleware according to the subject, and at the same time, an inventory change message is sent again to the designated partition of the message middleware according to the dimension of the device number, and the message middleware uploads the message to the server to ensure the message order in the device dimension. The message collection service can withstand high concurrency and support cluster deployment.
[0006] Furthermore, decryption verification: the message collection service defaults to a public key (composed of a 32-bit string), which will be given to Android developers to embed into the machine program. When the machine uploads data, it will upload the public key together. At the same time, the uploaded data is encrypted with the public key. The decryption verification background first verifies whether the public keys are equal. If they are equal, the decryption verification background will use the public key to decrypt and receive the decrypted data through the message middleware.
[0007] Preferably, the topic includes topics of different business dimensions, which is a topic formed according to any combination of a company number dimension, a machine number dimension, a machine type number dimension, and a time and date dimension.
[0008] Preferably, the inventory change sequence means that the transaction messages requested to be uploaded by the same device are in order, so that the inventory change records obtained by the background service can be guaranteed to be in order.
[0009] For example: after receiving data through the message middleware in the message collection service cluster, the data is sent to the Kafka queue in the server according to the number of the current machine. The key will get a unique value after hashing, which ensures that messages from the same device will be sent to the same partition of Kafka.
[0010] Preferably, the message distribution service cluster is provided with an original data unit, an idempotent unit, a filling unit, a full data unit and a message distributor; before the data enters the original data unit, it needs to be judged by the idempotent unit: if the idempotent unit fails, an idempotent failure message is sent, and the idempotent failure message will be sent back to the delayed message queue in the server, and the delay time can be customized; when the idempotent unit succeeds, the data will be saved in the original data unit; the filling unit will fill the data in the original data unit, and send the filled data to the full data unit and the data screen respectively; the message distributor sends the business data of multiple dimensions in the full data unit to the business service cluster through the distribution server.
[0011] Preferably, the message distribution service cluster is further provided with a compensation retransmission unit. When the compensation message in the data verification service cluster is transmitted to the compensation retransmission unit through the distribution server, the compensation retransmission unit sends the compensated information to the business service cluster through the distribution server.
[0012] Preferably, the data verification service cluster is provided with a comparison unit, a compensation unit and an alarm unit; the comparison unit will distribute verification information regularly, and compare and verify it with the business data received by the verification business service cluster: if there is an inconsistent comparison, the information will be sent to the compensation unit and the alarm unit, and both the compensation message issued by the compensation unit and the alarm message issued by the alarm unit will be sent to relevant personnel.
[0013] The compensation information is because the downstream business system fails to process a message, which is detected by the data verification service. The data verification service then sends a data redistribution message notification to the data distribution service cluster. After receiving the notification, the distribution service cluster parses the message and redistributes the message that failed to be queried from the current distribution service database to the downstream service.
[0014] Compared with the prior art, the beneficial effects are that, by adopting the above scheme, the present invention 1. uses a microservice architecture mode to solve the problems of message collection, decryption, access to a third-party message queue, original data storage, data filling, data distribution, data consistency verification, abnormal alarm, data compensation, etc. in one stop;
[0015] 2. Independent message collection service is used for device data collection, decryption and third-party message middleware access. The service supports clustering, early warning and high concurrency.
[0016] 3. Data distribution service is used for original data storage, data filling, microservice internal data access, data dimension distribution, data compensation sending, abnormal data alarm, etc., and supports cluster deployment;
[0017] 4. Data consistency verification service, regularly check whether the distribution messages received by other business services are consistent. If they are inconsistent, compensation messages can be sent.
[0018] Through the microservice architecture model, services are built based on multiple domain models; it provides a message collection service that can carry high concurrency, high performance and cluster deployment, supports custom keys, and can be connected to third-party message middleware, which greatly increases service performance and data security. The distribution service can store metadata, and can fill in various business data according to business needs. Custom distribution dimensions can distribute messages to other business services, and support microservice internal message reception, compensation message sending, message redistribution, etc., and can issue warnings for abnormal messages. The consistency check service can ensure the integrity of business service messages. In case of inconsistency, a compensation message will be sent and a warning will be issued to notify relevant personnel to investigate. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 It is one of the schematic diagrams of the process of the present invention;
[0021] Figure 2 This is the second schematic diagram of the process of the present invention;
[0022] Figure 3 This is the third schematic diagram of the process of the present invention;
[0023] Figure 4 This is the fourth schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0024] In order to facilitate the understanding of the present invention, the present invention is described in more detail below in conjunction with the accompanying drawings and specific embodiments. Preferred embodiments of the present invention are provided in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0025] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "fixed", "integrally formed", "left", "right" and similar expressions used in this specification are for illustrative purposes only. In the drawings, units with similar structures are marked with the same reference numerals.
[0026] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0027] like Figure 1-4 As shown, one embodiment of the present invention is: a system based on message collection and multi-dimensional distribution, comprising a message collection service cluster, a message distribution service cluster, a business service cluster and a data verification service cluster; the message collection service cluster receives data uploaded by a device and decrypts and verifies the data, and sends the decrypted and verified data to the message distribution service cluster; the message distribution service cluster obtains the decrypted and verified data and performs filling processing, and sends the filled data to the business service cluster through a message distributor, the business service cluster obtains the pulled business message through the message distribution service cluster, and the message distribution service cluster obtains the corresponding compensation message through the data verification service cluster.
[0028] Preferably, the message collection service cluster is provided with a data receiving unit, a decryption verification unit, an early warning unit and a message middleware; the data receiving unit receives data on the device; the decryption verification unit performs decryption verification on the data in the data receiving unit: if the verification fails, the data is directly returned, and a verification failure message is sent to the early warning unit, and the early warning unit issues an early warning notification message and performs problem troubleshooting; if the verification succeeds, the data is first sent to the message middleware according to the subject, and at the same time, an inventory change message is sent again to the designated partition of the message middleware according to the dimension of the device number, and the message middleware uploads the message to the server to ensure the message order in the device dimension. The message collection service can withstand high concurrency and support cluster deployment.
[0029] Furthermore, decryption verification: the message collection service defaults to a public key (composed of a 32-bit string), which will be given to Android developers to embed into the machine program. When the machine uploads data, it will upload the public key together. At the same time, the uploaded data is encrypted with the public key. The decryption verification background first verifies whether the public keys are equal. If they are equal, the decryption verification background will use the public key to decrypt and receive the decrypted data through the message middleware.
[0030] Preferably, the topic includes topics of different business dimensions, which is a topic formed according to any combination of a company number dimension, a machine number dimension, a machine type number dimension, and a time and date dimension.
[0031] Preferably, the inventory change sequence means that the transaction messages requested to be uploaded by the same device are in order, so that the inventory change records obtained by the background service can be guaranteed to be in order.
[0032] For example: after receiving data through the message middleware in the message collection service cluster, the data is sent to the Kafka queue in the server according to the number of the current machine. The key will get a unique value after hashing, which ensures that messages from the same device will be sent to the same partition of Kafka.
[0033] Preferably, the message distribution service cluster is provided with an original data unit, an idempotent unit, a filling unit, a full data unit and a message distributor; before the data enters the original data unit, it needs to be judged by the idempotent unit: if the idempotent unit fails, an idempotent failure message is sent, and the idempotent failure message will be sent back to the delayed message queue in the server, and the delay time can be customized; when the idempotent unit succeeds, the data will be saved in the original data unit; the filling unit will fill the data in the original data unit, and send the filled data to the full data unit and the data screen respectively; the message distributor sends the business data of multiple dimensions in the full data unit to the business service cluster through the distribution server.
[0034] Preferably, the message distribution service cluster is further provided with a compensation retransmission unit. When the compensation message in the data verification service cluster is transmitted to the compensation retransmission unit through the distribution server, the compensation retransmission unit sends the compensated information to the business service cluster through the distribution server.
[0035] Preferably, the data verification service cluster is provided with a comparison unit, a compensation unit and an alarm unit; the comparison unit will distribute verification information regularly, and compare and verify it with the business data received by the verification business service cluster: if there is an inconsistent comparison, the information will be sent to the compensation unit and the alarm unit, and both the compensation message issued by the compensation unit and the alarm message issued by the alarm unit will be sent to relevant personnel.
[0036] The compensation information is because the downstream business system fails to process a message, which is detected by the data verification service. The data verification service then sends a data redistribution message notification to the data distribution service cluster. After receiving the notification, the distribution service cluster parses the message and redistributes the message that failed to be queried from the current distribution service database to the downstream service.
[0037] Example 2: Taking a supermarket as an example:
[0038] There are 3 devices in total, numbered SY1, SY2, and SY3; one server;
[0039] The data of the three devices numbered SY1, SY2, and SY3 are transmitted to the data receiving unit in the message collection service cluster. The decryption verification unit decrypts and verifies the data in the data receiving unit, first verifying and then decrypting (a public key (composed of a 32-bit string), which will be given to the Android developer to be embedded in the machine program. When the machine uploads a message, it will upload the public key together. At the same time, the uploaded message is encrypted with the public key. The background first verifies whether the public keys are equal. If the decryption fails, the data is directly returned and the decryption failure message is sent to the early warning unit. The early warning unit then issues an early warning notification message, and a staff member conducts problem troubleshooting; if they are equal, the message is received and decrypted using the public key. After the decryption verification is successful, the data will be sent to the message middleware according to the theme of the SY1, SY2, and SY3 machine codes. The message middleware then sends the content of the theme data to the server according to different business dimensions such as the major and minor categories of the product, and the message middleware also sends the data of the inventory change order to the server;
[0040] The message distributor reads the topic data of different business dimensions associated with the server. During the reading process, it is first necessary to perform an idempotency judgment on the data. When the judgment result of the idempotency unit is success, the topic data is uploaded to the original data unit. The filling unit fills the data in the original data unit with various business fields to form new filled data and stores it in the full data unit. The message distributor sends the filled data to the server; when the judgment result of the idempotency unit is failure, the message of idempotency failure will be sent back to the delayed message queue in the server, and the delay time can be customized.
[0041] The business service cluster will read the information about pulling business from the server;
[0042] The comparison unit in the data verification service cluster will periodically send verification information, which will be compared with the business data in the database. When the two are consistent, the comparison unit will continue to send verification information within the specified time; when the two are inconsistent, the comparison information will be sent to the compensation unit and the alarm unit. The alarm unit will display a warning (alarm or flashing light), and the compensation unit will send a correct compensation data to the server. The message distributor obtains the compensation message from the server, and the compensation retransmission unit in the message distributor resends the compensation information to the server according to the corresponding distribution algorithm. After receiving the notification, the distribution service parses the message and redistributes the message that failed to be queried from the current distribution service database to the downstream service (for example: business service cluster);
[0043] The compensation information is because the downstream business service cluster fails to process a message, which is detected by the data verification service cluster. The data verification service sends a message to notify the data distribution service of data redistribution. After receiving the notification, the distribution service parses the message and redistributes the failed message from the current distribution service database to the downstream service (for example: business service cluster).
[0044] Compared with the prior art, the beneficial effects are that, by adopting the above scheme, the present invention 1. uses a microservice architecture mode to solve the problems of message collection, decryption, access to a third-party message queue, original data storage, data filling, data distribution, data consistency verification, abnormal alarm, data compensation, etc. in one stop;
[0045] 2. Independent message collection service is used for device data collection, decryption and third-party message middleware access. The service supports clustering, early warning and high concurrency.
[0046] 3. Data distribution service is used for original data storage, data filling, microservice internal data access, data dimension distribution, data compensation sending, abnormal data alarm, etc., and supports cluster deployment;
[0047] 4. Data consistency verification service, regularly check whether the distribution messages received by other business services are consistent. If they are inconsistent, compensation messages can be sent.
[0048] Through the microservice architecture model, services are built based on multiple domain models; it provides a message collection service that can carry high concurrency, high performance and cluster deployment, supports custom keys, and can be connected to third-party message middleware, which greatly increases service performance and data security. The distribution service can store metadata, and can fill in various business data according to business needs. Custom distribution dimensions can distribute messages to other business services, and support microservice internal message reception, compensation message sending, message redistribution, etc., and can issue warnings for abnormal messages. The consistency check service can ensure the integrity of business service messages. In case of inconsistency, a compensation message will be sent and a warning will be issued to notify relevant personnel to investigate.
[0049] It should be noted that the above-mentioned technical features are further combined with each other to form various embodiments not listed above, which are all deemed to be within the scope of the present invention; and, for ordinary technicians in this field, they can be improved or transformed according to the above description, and all these improvements and transformations should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A system based on message collection and multi-dimensional distribution, characterized in that: A message collection service cluster, a message distribution service cluster, a business service cluster and a data verification service cluster are provided; the message collection service cluster receives the data uploaded by the device and decrypts and verifies the data, and sends the decrypted and verified data to the message distribution service cluster; the message distribution service cluster obtains the decrypted and verified data and performs filling processing, and sends the filled data to the business service cluster through the message distributor, the business service cluster obtains the pulled business message through the message distribution service cluster, and the message distribution service cluster obtains the corresponding compensation message through the data verification service cluster; the message collection service cluster is provided with a data receiving unit, a decryption and verification unit, an early warning unit and a message middleware; the data receiving unit receives the data on the device; the decryption and verification unit performs decryption and verification on the data in the data receiving unit: if the verification fails, the data is directly returned, and the verification failure message is sent to the early warning unit, the early warning unit sends an early warning notification message and performs problem troubleshooting; If the verification is successful, the data will be sent to the message middleware according to the topic. At the same time, an inventory change message will be sent to the specified partition of the message middleware according to the device number dimension. The message middleware will upload the message to the server to ensure the message order in the device dimension. The message collection service can withstand high concurrency and support cluster deployment. A topic is formed by any combination of company number dimension, machine number dimension, machine type number dimension and time date dimension. The order of inventory change means that the transaction messages requested to be uploaded by the same device are in order. After the data is received by the message middleware in the message collection service cluster, the data is sent to the kafka queue in the server according to the number of the current machine. After the key is hashed, a unique value will be obtained, which can ensure that the inventory change records obtained by the background service are in order. The message distribution service cluster is equipped with original data unit, idempotent unit, filling unit, full data unit and message distributor. When the data enters the original Before the data unit is processed, it needs to be judged by the idempotent unit: if the idempotent unit fails, it sends the idempotent failure information. When the idempotent unit succeeds, the data will be saved in the original data unit; the filling unit will fill the data in the original data unit and send the filled data to the full data unit and the data screen respectively; the message distributor sends the business data of various dimensions in the full data unit to the business service cluster through the distribution server; the message distribution service cluster is also equipped with a compensation retransmission unit. When the compensation message in the data verification service cluster is transmitted to the compensation retransmission unit through the server, the compensation retransmission unit sends the compensated information to the business service cluster through the server; The data verification service cluster is equipped with a comparison unit, a compensation unit and an alarm unit; the comparison unit will distribute verification information regularly and compare and verify it with the business data in the service: if there is any inconsistency, the information will be sent to the compensation unit and the alarm unit, and both the compensation message issued by the compensation unit and the alarm message issued by the alarm unit will be sent to relevant personnel.
