CN110865891A - Asynchronous message arranging method and device - Google Patents

Asynchronous message arranging method and device Download PDF

Info

Publication number
CN110865891A
CN110865891A CN201910930942.2A CN201910930942A CN110865891A CN 110865891 A CN110865891 A CN 110865891A CN 201910930942 A CN201910930942 A CN 201910930942A CN 110865891 A CN110865891 A CN 110865891A
Authority
CN
China
Prior art keywords
asynchronous
group
messages
counter
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910930942.2A
Other languages
Chinese (zh)
Other versions
CN110865891B (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.)
FARAD ELECTRIC Co Ltd
Original Assignee
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 FARAD ELECTRIC Co Ltd filed Critical 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

Images

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention discloses an asynchronous message arranging method and a 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 a group to which the any asynchronous message belongs, and subtracting 1 from a counter of the corresponding group; the counter of one group is 0 and asynchronous messages corresponding to the group are arranged. The apparatus is for performing a method. The embodiment of the invention can clarify the connection relation between asynchronous messages by dividing the asynchronous messages to be arranged into groups; through the counter, the total number of the asynchronous messages can be made clear to serve as a basis for judging whether the asynchronous messages are completely received or not; the method can reasonably judge the asynchronous message transmission condition and execute the arrangement, and is beneficial to solving the arrangement problem of the asynchronous parallel messages.

Description

Asynchronous message arranging method and device
Technical Field
The invention relates to the technology of information transmission of the Internet of things, in particular to an asynchronous message arranging method and device.
Background
The Internet of Things (IOT) refers to various devices and technologies such as various information sensors, radio frequency identification technologies, global positioning systems, infrared sensors, and laser scanners.
Terminals of the internet of things do not have complex data transmission capability due to the limitation of functions, and generally adopt a message queue technology to transmit data. However, the message queue has the asynchronous unordered delivery message characteristic, so that the data can be combined and calculated after all the messages for collecting data arrive, a receiver does not know the sequence of the messages and the time when the concerned messages arrive, and the asynchronous parallel messages need to be edited.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the first aspect of the embodiments of the present invention provides an asynchronous message arrangement method, which can reasonably arrange the arrangement of asynchronous messages; a second aspect provides an asynchronous message orchestration device to perform a corresponding method.
The asynchronous message editing method according to the embodiment of the first aspect of the invention comprises 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 a group to which the any asynchronous message belongs, and subtracting 1 from a counter of the corresponding group; the counter of one group is 0 and asynchronous messages corresponding to the 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 among the asynchronous messages can be clarified; through the counter, the total number of the asynchronous messages can be made clear to serve as a basis for judging whether the asynchronous messages are completely received or not; the method can reasonably judge the asynchronous message transmission condition and execute the arrangement, and is beneficial to solving the arrangement problem of the asynchronous parallel messages.
According to some embodiments of the invention, the asynchronous message editing method specifically comprises: the counter of one group is 0, all the cached asynchronous messages of the corresponding group are transferred, and the transferred asynchronous messages are arranged. Specific judging steps and subsequent execution schemes are added, so that the method is beneficial to adapting to various running exceptions.
According to the asynchronous message arranging method of some embodiments of the present invention, when the counter of one group is not 0, the asynchronous message continues to be received until the counter of one group is 0. Specific judging steps and subsequent execution schemes are added, so that the method is beneficial to adapting to various running exceptions.
The asynchronous message orchestration method according to some embodiments of the invention, further comprises flushing the corresponding cache to wait for the next set of asynchronous messages. By cleaning up the cache, the circulation efficiency is increased.
An asynchronous message orchestration device according to an embodiment of a second aspect of the present invention, comprises: the device comprises a preprocessing module, a data processing module and a data processing module, wherein 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 receiving module is used for receiving any asynchronous message, caching any asynchronous message, determining a group to which any asynchronous message belongs, and subtracting 1 from a counter of the corresponding group; and the arranging module is used for arranging the asynchronous messages of the corresponding group, and 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 among the asynchronous messages can be clarified; through the counter, the total number of the asynchronous messages can be made clear to serve as a basis for judging whether the asynchronous messages are completely received or not; the method can reasonably judge the asynchronous message transmission condition and execute the arrangement, and is beneficial to solving the arrangement problem of the asynchronous parallel messages.
According to some embodiments of the asynchronous message arranging apparatus and the arranging module of the present invention, the counter of one group is 0, all the cached asynchronous messages of the corresponding group are transferred, and the transferred asynchronous messages are arranged. Specific judging steps and subsequent execution schemes are added, so that the method is beneficial to adapting to various running exceptions.
According to some embodiments of 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 asynchronous message orchestration device of the present invention, the receiving module is configured to flush the corresponding buffer for waiting for the asynchronous message of the next group. By cleaning up the cache, the circulation efficiency is increased.
Drawings
FIG. 1 is a flow diagram of an asynchronous message orchestration method according to an embodiment of the invention;
FIG. 2 is a framework diagram of asynchronous message orchestration according to an embodiment of the invention;
fig. 3 is a connection diagram of an asynchronous message orchestration device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present solution and are not to be construed as limiting the present solution.
The related technical names are as follows:
message queue: a "message queue" is a container that holds messages during their transmission. A "message" is a unit of data that is transferred between two computers. The message may be very simple, e.g. containing only text strings; or may be more complex, possibly containing embedded objects.
Asynchronization: a communication mode is simple in equipment requirement. The standard communication interfaces provided by common PCs are asynchronous. The asynchronous parties do not need a common clock, i.e. the receiver does not know when the sender is sending, so there is a message in the message sent to prompt the receiver to start receiving, such as a start bit, and there is a stop bit at the end.
In parallel: parallel means "walking side by side" or "performing or implementing simultaneously". In an operating system, a group of programs execute at independent asynchronous speeds, and are not equal to overlap in time (occur at the same time).
The following steps can be programmed: the programmable information processing method refers to that unnecessary messages or data are processed by a certain computer algorithm, so that the messages or the data have a certain sequence and logic relationship.
Topic: the Topic refers to the Topic of a class of messages, the Topic is created for a class of messages in a message queue, a producer of the messages delivers the class of messages to the message queue according to the Topic, and a consumer receives the class of messages according to the Topic concerned by the consumer.
Example 1.
The asynchronous message editing method described with reference to fig. 1 includes:
s1, dividing the asynchronous messages to be arranged into groups, setting counters corresponding to the groups, and setting the counters as the total number of the asynchronous messages in the groups initially;
s2, receiving any asynchronous message, caching the asynchronous message, determining the group to which the asynchronous message belongs, and subtracting 1 from the counter of the corresponding group;
and S3, setting the counter of one group to be 0, and arranging the asynchronous message of the corresponding group.
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 among the asynchronous messages can be clarified; through the counter, the total number of the asynchronous messages can be made clear to serve as a basis for judging whether the asynchronous messages are completely received or not; the method can reasonably judge the asynchronous message transmission condition and execute the arrangement, and is beneficial to solving the arrangement problem of the asynchronous parallel messages.
The asynchronous messages to be arranged are divided into a plurality of groups according to a certain grouping rule, the groups are a data structure body, corresponding counters are set for the groups, and the counters are initially set to the total number of the asynchronous messages in the corresponding groups.
The receiving end receives any asynchronous message, caches the asynchronous message, analyzes the asynchronous message and determines the group to which the asynchronous message belongs. After the belonging 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 cached asynchronous messages are arranged according to a preset rule.
According to some embodiments of the invention, the asynchronous message editing method specifically comprises: the counter of one group is 0, all the cached asynchronous messages of the corresponding group are transferred, and the transferred asynchronous messages are arranged. Specific judging steps and subsequent execution schemes are added, so that the method is beneficial to adapting to various running exceptions.
On the basis of the above embodiment, a storage structure may be additionally provided for receiving the buffered asynchronous message, which aims to reduce the storage pressure of the buffer.
According to the asynchronous message arranging method of some embodiments of the present invention, when the counter of one group is not 0, the asynchronous message continues to be received until the counter of one group is 0. Specific judging steps and subsequent execution schemes are added, so that the method is beneficial to adapting to various running exceptions.
The asynchronous message orchestration method according to some embodiments of the invention, further comprises flushing the corresponding cache to wait for the next set of asynchronous messages. By cleaning up the cache, the circulation efficiency is increased.
Of course, there may be a possibility that an asynchronous message cannot be reasonably distributed by a single packet, and at this time, a plurality of packets may be attributed to one topoc, and correspondingly, it is required that all packets satisfy a counter of 0 to be arranged. That is, there are several groups associated with the same Topic, and correspondingly, step S3 specifically includes: the counter of one group is 0, and the counters of the other groups associated with the same Topic are all 0, and the cache asynchronous messages of all the groups associated with the same Topic are arranged.
The embodiment of the invention provides an asynchronous message (message for short) arrangement framework diagram as described in fig. 2:
【1】 An initialization stage: in order to ensure that a plurality of different topics (asynchronous messages are contents of topics) can be arranged, asynchronous messages required to be arranged into a group are merged in an initialization stage, and after the asynchronous messages are merged into a group, a reference counter is bound for the group of topics, and 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 to the initialization stage is found according to the Topic, the reference counter contained in the packet is reduced by 1, and the asynchronous message of one Topic in the packet is received.
After the 1 is reduced, whether the reference counter reaches 0 is checked, if 0 is reached, all asynchronous messages are proved to arrive, and if 0 is not reached, the flow continues to circulate to wait for the arrival of the rest asynchronous messages.
【3】 And a final message processing stage: when the reference counter in a packet reaches 0, that is, all messages in the packet are received, the scheduling calculation on the subsequent service can be performed. Before the scheduling calculation stage, all messages temporarily stored in the packets need to be emptied so as to facilitate the next round of Topic delivery scheduling, so that the message content needs to be copied (handed to the message scheduling calculation stage), and then the original temporarily stored messages need to be emptied.
【4】 And a message arrangement calculation stage: and the message editing and calculating stage takes the copied message content, performs service editing and combining and finally calculates. By this point, the whole single flow is finished, and the next round of asynchronous messages can be circularly received.
Example 2.
The asynchronous message editing apparatus according to the embodiment of the present invention described with reference to fig. 3 includes:
the system comprises a preprocessing module 1, a group setting module and a group editing module, wherein 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 receiving module 2 is used for receiving any asynchronous message, caching any asynchronous message, determining a group to which any asynchronous message belongs, and subtracting 1 from a counter of the corresponding group; and the arranging module 3 is used for arranging the asynchronous messages of the corresponding group, and 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 among the asynchronous messages can be clarified; through the counter, the total number of the asynchronous messages can be made clear to serve as a basis for judging whether the asynchronous messages are completely received or not; the method can reasonably judge the asynchronous message transmission condition and execute the arrangement, and is beneficial to solving the arrangement problem of the asynchronous parallel messages.
According to some embodiments of the asynchronous message arranging apparatus and the arranging module of the present invention, the counter of one group is 0, all the cached asynchronous messages of the corresponding group are transferred, and the transferred asynchronous messages are arranged. Specific judging steps and subsequent execution schemes are added, so that the method is beneficial to adapting to various running exceptions.
According to some embodiments of 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 asynchronous message orchestration device of the present invention, the receiving module is configured to flush the corresponding buffer for waiting for the asynchronous message of the next group. By cleaning up the cache, the circulation efficiency is increased.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an illustrative embodiment," "an example," "a specific example," or "some examples" or the like are intended to mean 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, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. 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 otherwise specifically limited, terms such as set, mounted, connected and the like should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific contents of the technical solutions.
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 those skilled in the art without departing from the gist 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: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims (8)

1. An asynchronous message orchestration method, comprising:
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 a group to which the any asynchronous message belongs, and subtracting 1 from a counter of the corresponding group;
the counter of one group is 0 and asynchronous messages corresponding to the group are arranged.
2. The asynchronous message orchestration method according to claim 1, comprising in particular:
the counter of one group is 0, all the cached asynchronous messages of the corresponding group are transferred, and the transferred asynchronous messages are arranged.
3. An asynchronous message orchestration method according to claim 1, wherein when the counter of a group is not 0, continuing to receive asynchronous messages until a counter of a group is 0.
4. The asynchronous message orchestration method according to claim 2, further comprising flushing the corresponding buffer for the next set of asynchronous messages.
5. An asynchronous message orchestration device, comprising:
the device comprises a preprocessing module, a data processing module and a data processing module, wherein 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 receiving module is used for receiving any asynchronous message, caching the asynchronous message, determining a group to which the asynchronous message belongs, and subtracting 1 from a counter of the corresponding group;
and the arranging module is used for arranging the asynchronous messages of the corresponding group, and the counter of one group is 0.
6. The asynchronous message orchestration device according to claim 5, wherein the orchestration module is further configured to set a counter of a group to 0, and to migrate all buffered asynchronous messages of the corresponding group to orchestrate the migrated asynchronous messages.
7. The asynchronous message orchestration device according to claim 6, wherein the orchestration module is further configured to, when the counter of a group is not 0, continue receiving asynchronous messages until a counter of a group is 0.
8. The asynchronous message orchestration device according to claim 7, wherein the receiving module is configured to flush the corresponding buffer for waiting for the next asynchronous message in the group.
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 true CN110865891A (en) 2020-03-06
CN110865891B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328545A (en) * 2020-11-03 2021-02-05 河北幸福消费金融股份有限公司 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

Cited By (2)

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

Also Published As

Publication number Publication date
CN110865891B (en) 2024-04-12

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)
US9258171B2 (en) Method and system for an OS virtualization-aware network interface card
CN104796337A (en) Method and device for forwarding message
CN101820361B (en) Method and device for managing multi-protocol communication components
CN101304389B (en) Method, apparatus and system for processing packet
CN105511954A (en) Method and device for message processing
AU2020213829B2 (en) Handling an input/output store instruction
AU2020214661B2 (en) Handling an input/output store instruction
US8935329B2 (en) Managing message transmission and reception
CN102790776A (en) Heartbeat connection normalizing processing method, terminal, server and communication system
US20090199208A1 (en) Queued message dispatch
CN104281493A (en) Method for improving performance of multiprocess programs of application delivery communication platforms
US11074203B2 (en) Handling an input/output store instruction
CN110865891A (en) Asynchronous message arranging method and device
CN101420341B (en) Processor performance test method and device for embedded system
CN110650546B (en) File transmission method, device, storage medium and terminal
CN103906011A (en) Data sending and receiving device and method
CN101909283B (en) M2M (Machine-to-Machine) platform and method for sharing load downloaded with in high capacity
CN1612566A (en) Network protocol engine
CN104158834A (en) Method and device for processing voice data
CN117640731A (en) Message cascade communication method, device, equipment and storage medium of edge weak network
CN116016349A (en) Message scheduling method, device and system
US7478137B1 (en) Lightweight messaging with and without hardware guarantees
CN115567459A (en) Flow control system and method based on buffer area
CN117692408A (en) CAN frame sending method, device and system, computing equipment and storage medium

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