CN110865891B - Asynchronous message arrangement method and device - Google Patents

Asynchronous message arrangement method and device Download PDF

Info

Publication number
CN110865891B
CN110865891B CN201910930942.2A CN201910930942A CN110865891B CN 110865891 B CN110865891 B CN 110865891B CN 201910930942 A CN201910930942 A CN 201910930942A CN 110865891 B CN110865891 B CN 110865891B
Authority
CN
China
Prior art keywords
asynchronous
group
messages
counter
groups
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
CN201910930942.2A
Other languages
Chinese (zh)
Other versions
CN110865891A (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.)
Shenzhen Farad Electric Co ltd
Original Assignee
Shenzhen Farad Electric 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 Shenzhen Farad Electric Co ltd filed Critical Shenzhen Farad Electric Co ltd
Priority to CN201910930942.2A priority Critical patent/CN110865891B/en
Publication of CN110865891A publication Critical patent/CN110865891A/en
Application granted granted Critical
Publication of CN110865891B publication Critical patent/CN110865891B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Abstract

The embodiment of the invention discloses an asynchronous message arranging method and device, comprising the following steps: dividing asynchronous messages to be arranged into groups, setting counters corresponding to the groups, and initially setting the counters as the total number of the asynchronous messages in the groups; receiving any asynchronous message, caching the any asynchronous message, determining the group to which the any asynchronous message belongs, and reducing the counter of the corresponding group by 1; the counter of one group is 0 and asynchronous messages of the corresponding group are arranged. The apparatus is for performing the method. According to the embodiment of the invention, the asynchronous messages to be arranged are divided into the groups, so that the connection relation between the asynchronous messages can be clarified; the total number of the asynchronous messages can be definitely used as a basis for judging whether the asynchronous messages are received completely or not through the counter; the method and the device can reasonably judge the asynchronous message transmission condition and execute arrangement, and help to solve the arrangement problem of asynchronous parallel messages.

Description

Asynchronous message arrangement method and device
Technical Field
The invention relates to an information transmission technology of the Internet of things, in particular to an asynchronous message arrangement method and device.
Background
The internet of things (The Internet of Things, IOT) refers to various devices and technologies such as various information sensors, radio frequency identification technology, global positioning system, infrared sensors, laser scanners, and the like.
Terminals of the internet of things generally adopt a message queue technology to transmit data because the terminals have no complex data transmission capability due to the limitation of functions. However, the message queue has the characteristic of asynchronous unordered delivery, so that the data can be combined and calculated after waiting for all the messages for collecting the data to arrive, the receiver does not know the sequence of the messages or the time when the messages focused by the receiver arrive, and the asynchronous parallel messages are required to be arranged.
Disclosure of Invention
The present invention aims to solve at least one of the technical problems existing in the prior art. Therefore, the first aspect of the embodiment of the invention provides an asynchronous message arranging method, which can reasonably arrange the arrangement of asynchronous messages; a second aspect provides an asynchronous message orchestration device to perform a corresponding method.
An asynchronous message orchestration method according to an embodiment of the first aspect of the present invention comprises: dividing asynchronous messages to be arranged into groups, setting counters corresponding to the groups, and initially setting the counters as the total number of the asynchronous messages in the groups; receiving any asynchronous message, caching the any asynchronous message, determining the group to which the any asynchronous message belongs, and reducing the counter of the corresponding group by 1; the counter of one group is 0 and asynchronous messages of the corresponding group are arranged.
The technical effects of the embodiment of the invention at least comprise: the asynchronous messages to be arranged are divided into groups, so that the connection relation between the asynchronous messages can be clarified; the total number of the asynchronous messages can be definitely used as a basis for judging whether the asynchronous messages are received completely or not through the counter; the method and the device can reasonably judge the asynchronous message transmission condition and execute arrangement, and help to solve the arrangement problem of asynchronous parallel messages.
An asynchronous message arrangement method according to some embodiments of the present invention specifically includes: and a counter of one group is 0, all cached asynchronous messages of the corresponding group are transferred, and the transferred asynchronous messages are organized. Specific judging steps and subsequent executing schemes are added, so that the method is beneficial to adapting to various operation anomalies.
According to some embodiments of the invention, when the counter of a group is not 0, the asynchronous message is continuously received until the counter of a group is 0. Specific judging steps and subsequent executing schemes are added, so that the method is beneficial to adapting to various operation anomalies.
The asynchronous message orchestration method according to some embodiments of the present invention further includes flushing the corresponding cache to wait for the next group of asynchronous messages. By cleaning the cache, the transfer efficiency is increased.
An asynchronous message orchestration device according to an embodiment of the second aspect of the present invention comprises: the preprocessing module is used for dividing asynchronous messages to be arranged into groups, setting counters corresponding to the groups, and initially setting the counters as the total number of the asynchronous messages in the groups; the receiving module is used for receiving any asynchronous message, caching any asynchronous message, determining the group to which any asynchronous message belongs, and reducing the counter of the corresponding group by 1; and the arranging module is used for arranging asynchronous messages of a corresponding group, wherein the counter of one group is 0.
The technical effects of the embodiment of the invention at least comprise: the asynchronous messages to be arranged are divided into groups, so that the connection relation between the asynchronous messages can be clarified; the total number of the asynchronous messages can be definitely used as a basis for judging whether the asynchronous messages are received completely or not through the counter; the method and the device can reasonably judge the asynchronous message transmission condition and execute arrangement, and help to solve the arrangement problem of asynchronous parallel messages.
According to some embodiments of the invention, the arrangement module is further configured to, when a counter of a group is 0, transfer all buffered asynchronous messages of the corresponding group, and arrange the transferred asynchronous messages. Specific judging steps and subsequent executing schemes are added, so that the method is beneficial to adapting to various operation anomalies.
According to some embodiments of the invention, the asynchronous message orchestration device, the orchestration module is further configured to, when the counter of a group is not 0, continue to receive asynchronous messages until the counter of a group is 0. And the receiving module is used for emptying the corresponding cache to wait for the asynchronous message of the next group.
According to some embodiments of the invention, the receiving module is configured to empty the corresponding buffer to wait for the next group of asynchronous messages. By cleaning the cache, the transfer efficiency is increased.
Drawings
FIG. 1 is a flow chart of an asynchronous message orchestration method according to an embodiment of the present invention;
FIG. 2 is a frame diagram of asynchronous messaging arrangement according to an embodiment of the present invention;
fig. 3 is a connection diagram of an asynchronous message orchestration device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for explaining the present scheme and are not to be construed as limiting the present scheme.
The technical names involved are as follows:
message queues: a "message queue" is a container that holds messages during their transmission. A "message" is a unit of data transferred between two computers. The message may be very simple, e.g. only contain text strings; or may be more complex and may contain embedded objects.
Asynchronous: a communication method has simple equipment requirement. The standard communication interfaces provided by a typical PC are asynchronous. The asynchronous two parties do not need a common clock, that is, the receiving party does not know when the sending party sends, so that the sent information needs to have information for prompting the receiving party to start receiving, such as a start bit, and meanwhile, stop bits are arranged at the end.
Parallel: parallel refers to "walking side by side" or "simultaneously effecting or implementing". In an operating system, a set of programs execute at an independently asynchronous rate, not equal to a temporal overlap (occurring at the same time).
The method can be characterized by comprising the following steps: orchestration refers to passing unnecessary messages or data through a certain computer algorithm, such that the messages or data have a certain order and logical relationship.
Topic: topic refers to the theme of a type of message, the theme is created for the type of message in the message queue, the producer of the message delivers the type of message to the message queue according to the theme, and the consumer receives the type of message according to the theme concerned by the consumer.
Example 1.
An asynchronous message orchestration method according to an embodiment of the present invention described with reference to fig. 1, comprises:
s1, dividing asynchronous messages to be arranged into groups, setting counters corresponding to the groups, and initially setting the counters as the total number of the asynchronous messages in the groups;
s2, receiving any asynchronous message, caching the any asynchronous message, determining a group to which the any asynchronous message belongs, and reducing a counter of a corresponding group by 1;
s3, a counter of one group is 0, and asynchronous messages of the corresponding group are organized.
The technical effects of the embodiment of the invention at least comprise: the asynchronous messages to be arranged are divided into groups, so that the connection relation between the asynchronous messages can be clarified; the total number of the asynchronous messages can be definitely used as a basis for judging whether the asynchronous messages are received completely or not through the counter; the method and the device can reasonably judge the asynchronous message transmission condition and execute arrangement, and help to solve the arrangement problem of asynchronous parallel messages.
The method comprises the steps of dividing asynchronous messages to be arranged into a plurality of groups according to a certain grouping rule, grouping the groups into a data structure body, setting corresponding counters for the groups, and setting the initial counters to be the total number of the asynchronous messages in the corresponding groups.
The receiving end receives any asynchronous message, caches the any asynchronous message, analyzes the asynchronous message, and determines the group to which the any asynchronous message belongs. After the group is determined, the counter of the corresponding group is decremented by 1.
When the counter of one group is 0, it indicates that all asynchronous messages of the corresponding group have been completely received, and the buffered asynchronous messages are arranged according to a preset rule.
An asynchronous message arrangement method according to some embodiments of the present invention specifically includes: and a counter of one group is 0, all cached asynchronous messages of the corresponding group are transferred, and the transferred asynchronous messages are organized. Specific judging steps and subsequent executing schemes are added, so that the method is beneficial to adapting to various operation anomalies.
On the basis of the above embodiment, a storage structure may be additionally provided for receiving the buffered asynchronous message, so as to reduce the storage pressure of the buffer.
According to some embodiments of the invention, when the counter of a group is not 0, the asynchronous message is continuously received until the counter of a group is 0. Specific judging steps and subsequent executing schemes are added, so that the method is beneficial to adapting to various operation anomalies.
The asynchronous message orchestration method according to some embodiments of the present invention further includes flushing the corresponding cache to wait for the next group of asynchronous messages. By cleaning the cache, the transfer efficiency is increased.
Of course, there may be a possibility that an asynchronous message cannot be reasonably allocated to a single packet, and at this time, a plurality of packets may be assigned as one Topic, and all packets are required to satisfy the counter of 0 to be arranged. I.e. there are several groups associated with the same Topic, and the corresponding step S3 is specifically: the counter of one group is 0, and the counters of other groups associated with the same Topic are all 0, and the cache asynchronous messages of all groups associated with the same Topic are organized.
The embodiment of the invention provides an asynchronous message (called message for short) orchestration framework diagram as described in fig. 2:
【1】 An initialization stage: in order to ensure that a plurality of different topics (asynchronous messages are content of topics) can be arranged, it is necessary to combine the asynchronous messages to be arranged into a group in an initialization stage, and after combining into a group, binding a reference counter for the group of topics, where the reference counter is initialized to the total number of the group of asynchronous messages.
【2】 A message receiving stage: after receiving a Topic, the asynchronous message content is temporarily stored according to the Topic, then the packet in the initialization stage is found according to the Topic, the reference counter contained in the packet is decremented by 1, which represents that the asynchronous message of a Topic in the packet has been received.
After the 1 reduction is completed, checking whether the reference counter is 0, if 0 is reached, proving that all asynchronous messages arrive, and if 0 is not reached, continuing to circulate the flow to wait for the rest asynchronous messages to arrive.
【3】 Final processing message phase: when the reference counter in a packet reaches 0, i.e. all messages within the packet are received, the orchestration calculation on the subsequent traffic can be performed. But before the programming calculation stage, all the buffered messages in the packets need to be emptied to facilitate the next round of Topic delivery programming, so the content of the messages needs to be copied (handed to the message programming calculation stage) and then the originally buffered messages need to be emptied.
【4】 Message arrangement calculation phase: the message arrangement calculation stage takes the copied message content, performs service arrangement combination and final calculation. So far, the whole single flow is finished, and the asynchronous message of the next round can be received circularly.
Example 2.
An asynchronous message orchestration device according to an embodiment of the present invention described with reference to fig. 3, comprises:
the preprocessing module 1 is used for dividing asynchronous messages to be arranged into groups, setting counters corresponding to the groups, and initially setting the counters as the total number of the asynchronous messages in the groups; the receiving module 2 is used for receiving any asynchronous message, caching any asynchronous message, determining the group to which any asynchronous message belongs, and reducing the counter of the corresponding group by 1; an arrangement module 3 for arranging asynchronous messages of a corresponding group with a counter of 0.
The technical effects of the embodiment of the invention at least comprise: the asynchronous messages to be arranged are divided into groups, so that the connection relation between the asynchronous messages can be clarified; the total number of the asynchronous messages can be definitely used as a basis for judging whether the asynchronous messages are received completely or not through the counter; the method and the device can reasonably judge the asynchronous message transmission condition and execute arrangement, and help to solve the arrangement problem of asynchronous parallel messages.
According to some embodiments of the invention, the arrangement module is further configured to, when a counter of a group is 0, transfer all buffered asynchronous messages of the corresponding group, and arrange the transferred asynchronous messages. Specific judging steps and subsequent executing schemes are added, so that the method is beneficial to adapting to various operation anomalies.
According to some embodiments of the invention, the asynchronous message orchestration device, the orchestration module is further configured to, when the counter of a group is not 0, continue to receive asynchronous messages until the counter of a group is 0. And the receiving module is used for emptying the corresponding cache to wait for the asynchronous message of the next group.
According to some embodiments of the invention, the receiving module is configured to empty the corresponding buffer to wait for the next group of asynchronous messages. By cleaning the cache, the transfer efficiency is increased.
In the description of the present specification, reference to the terms "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
In the description of the present specification, unless clearly defined otherwise, terms such as arrangement, installation, connection, etc. should be construed broadly, and the specific meaning of the terms in the present invention can be reasonably determined by those skilled in the art in combination with the specific contents of the technical scheme.
The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of one of ordinary skill in the art without departing from the spirit of the present invention.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit thereof, the scope of which is defined by the claims and their equivalents.

Claims (4)

1. An asynchronous message orchestration method, comprising:
dividing asynchronous messages to be arranged into groups, setting a counter corresponding to the groups, and initially setting the counter as the total number of the asynchronous messages in the groups; the set is a data structure; the asynchronous message includes a tag of the group to which it belongs;
receiving any asynchronous message, caching the any asynchronous message, determining the group to which the any asynchronous message belongs, and reducing the counter of the corresponding group by 1;
additionally setting a storage structure for receiving the cached asynchronous messages, transferring all the cached asynchronous messages of the corresponding group when the counter of one group is 0, arranging the transferred asynchronous messages, and continuously receiving the asynchronous messages until the counter of one group is 0 when the counter of one group is not 0; or the counters of all groups of the same theme are all 0, asynchronous messages of all groups are arranged, and when the counter of one group is not 0, the asynchronous messages are continuously received until the counters of all groups are all 0.
2. An asynchronous message orchestration method according to claim 1 further comprising flushing the corresponding cache to wait for the next group of asynchronous messages.
3. An asynchronous message orchestration device, comprising:
the preprocessing module is used for dividing asynchronous messages to be arranged into groups, setting a counter corresponding to the groups, and initially setting the counter as the total number of the asynchronous messages in the groups; the set is a data structure; the asynchronous message includes a tag of the group to which it belongs;
the receiving module is used for receiving any asynchronous message, caching the any asynchronous message, determining the group to which the any asynchronous message belongs, and reducing the counter of the corresponding group by 1;
the arranging module is used for additionally setting a storage structure and receiving the cached asynchronous messages, when the counter of one group is 0, transferring all the cached asynchronous messages of the corresponding group, arranging the transferred asynchronous messages, and when the counter of one group is not 0, continuing to receive the asynchronous messages until the counter of one group is 0; or the counters of all groups of the same theme are all 0, asynchronous messages of all groups are arranged, and when the counter of one group is not 0, the asynchronous messages are continuously received until the counters of all groups are all 0.
4. An asynchronous message orchestration device according to claim 3 wherein the receiving module is arranged to empty the corresponding cache to wait for the next group of asynchronous messages.
CN201910930942.2A 2019-09-29 2019-09-29 Asynchronous message arrangement method and device Active CN110865891B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910930942.2A CN110865891B (en) 2019-09-29 2019-09-29 Asynchronous message arrangement method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910930942.2A CN110865891B (en) 2019-09-29 2019-09-29 Asynchronous message arrangement method and device

Publications (2)

Publication Number Publication Date
CN110865891A CN110865891A (en) 2020-03-06
CN110865891B true CN110865891B (en) 2024-04-12

Family

ID=69652487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910930942.2A Active CN110865891B (en) 2019-09-29 2019-09-29 Asynchronous message arrangement method and device

Country Status (1)

Country Link
CN (1) CN110865891B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328545B (en) * 2020-11-03 2022-11-22 河北幸福消费金融股份有限公司 Account checking file generation method, system, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5587997A (en) * 1995-02-24 1996-12-24 Hewlett-Packard Company Method and apparatus for determining when all packets of a message have arrived
CN104428754A (en) * 2012-08-02 2015-03-18 艾玛迪斯简易股份公司 Method, system and computer program product for sequencing asynchronous messages in a distributed and parallel environment
CN107231294A (en) * 2017-05-24 2017-10-03 北京潘达互娱科技有限公司 Message treatment method and device
CN110221927A (en) * 2019-06-03 2019-09-10 中国工商银行股份有限公司 Asynchronous message processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5587997A (en) * 1995-02-24 1996-12-24 Hewlett-Packard Company Method and apparatus for determining when all packets of a message have arrived
CN104428754A (en) * 2012-08-02 2015-03-18 艾玛迪斯简易股份公司 Method, system and computer program product for sequencing asynchronous messages in a distributed and parallel environment
CN107231294A (en) * 2017-05-24 2017-10-03 北京潘达互娱科技有限公司 Message treatment method and device
CN110221927A (en) * 2019-06-03 2019-09-10 中国工商银行股份有限公司 Asynchronous message processing method and device

Also Published As

Publication number Publication date
CN110865891A (en) 2020-03-06

Similar Documents

Publication Publication Date Title
US11916781B2 (en) System and method for facilitating efficient utilization of an output buffer in a network interface controller (NIC)
US7505410B2 (en) Method and apparatus to support efficient check-point and role-back operations for flow-controlled queues in network devices
US8310934B2 (en) Method and device for controlling information channel flow
US20030200363A1 (en) Adaptive messaging
CN102790776A (en) Heartbeat connection normalizing processing method, terminal, server and communication system
CN104796337A (en) Method and device for forwarding message
CN101179393A (en) Method and system for implementing document breakpoint transmission
US9774651B2 (en) Method and apparatus for rapid data distribution
US8935329B2 (en) Managing message transmission and reception
CN101894092B (en) Multi-core CPU and inter-core communication method thereof
CN101621833A (en) Message flux control method and base station controller
CN101136870A (en) Symbol based message transferring method and system
CN113992654A (en) High-speed file transmission method, system, equipment and medium
CN101911612B (en) Network offloading with reduced packet loss
CN110865891B (en) Asynchronous message arrangement method and device
CN103037000A (en) Publish-subscribe system and notification message processing method thereof
CN116204487A (en) Remote data access method and device
CN102148743B (en) Data flow control method, device and mobile terminal
CN103906011A (en) Data sending and receiving device and method
CN101494569B (en) Method and apparatus for processing message
CN1980131B (en) Mail interception method and module for realizing said method
EP1971923B1 (en) Method for managing under-runs and a device having under-run management capabilities
CN108833301A (en) A kind of message processing method and device
US9912604B2 (en) Reduction of silicon area for ethernet PFC protocol implementation in queue based network processors
CN110928828B (en) Inter-processor service processing system

Legal Events

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