CN117149450A - Message processing method, device, equipment and computer readable storage medium - Google Patents

Message processing method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN117149450A
CN117149450A CN202210561725.2A CN202210561725A CN117149450A CN 117149450 A CN117149450 A CN 117149450A CN 202210561725 A CN202210561725 A CN 202210561725A CN 117149450 A CN117149450 A CN 117149450A
Authority
CN
China
Prior art keywords
message
target
receiver
target message
storage space
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.)
Pending
Application number
CN202210561725.2A
Other languages
Chinese (zh)
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.)
Beijing Rockwell Technology Co Ltd
Original Assignee
Beijing Rockwell Technology 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 Beijing Rockwell Technology Co Ltd filed Critical Beijing Rockwell Technology Co Ltd
Priority to CN202210561725.2A priority Critical patent/CN117149450A/en
Publication of CN117149450A publication Critical patent/CN117149450A/en
Pending legal-status Critical Current

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/544Buffers; Shared memory; Pipes
    • 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
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The present disclosure relates to a message processing method, apparatus, device, and computer storage medium. After the target message sent by the message sender is obtained and the message receiver of the target message is determined, when the target message cannot be sent to the message receiver, the target message is stored in the storage space corresponding to the message receiver, and the message processing object corresponding to the message receiver is further awakened, so that the target message is stored in the storage space independent of the operating systems of the message sender and the message receiver, and is processed by the message processing object according to the message processing strategy corresponding to the target message, and the message communication between the message sender and the message receiver is ensured.

Description

Message processing method, device, equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for processing a message.
Background
Typically, when a message receiver and a message sender communicate, the communication is performed based on the same message communication mechanism.
With the continued development of the computer industry, more and more operating systems are now presented, and the messaging mechanisms supported by different operating systems may vary. When a message receiver and a message sender are migrated to an operating system that does not support a message communication mechanism between the message receiver and the message sender, the message receiver and the message sender are rendered incapable of message communication.
Disclosure of Invention
In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, an apparatus, a device, and a computer readable storage medium for processing a message, so that a target message is stored in a storage space independently of an operating system where a message sender and a message receiver are located, and a message processing object processes the target message according to a message processing policy corresponding to the target message, thereby ensuring message communication between the message sender and the message receiver.
In a first aspect, an embodiment of the present disclosure provides a message processing method, including:
acquiring a target message sent by a message sender, and determining a message receiver of the target message;
judging whether the target message can be sent to a message receiver, if not, storing the target message into a storage space corresponding to the message receiver;
Waking up a message processing object corresponding to a message receiver, wherein the message processing object acquires a target message from a storage space, and acquires a message processing strategy corresponding to the target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
In a second aspect, an embodiment of the present disclosure provides a message processing apparatus, including:
the acquisition module is used for acquiring the target message sent by the message sender and determining a message receiver of the target message;
the judging module is used for judging whether the target message can be sent to the message receiver, if not, the target message is stored in a storage space corresponding to the message receiver;
the wake-up module is used for waking up a message processing object corresponding to a message receiver, and the message processing object acquires a target message from a storage space and acquires a message processing strategy corresponding to the target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
In a third aspect, an embodiment of the present disclosure provides a message processing apparatus, including:
a memory;
a processor; and
a computer program;
wherein the computer program is stored in a memory and configured to be executed by a processor to implement the method as in the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a computer-readable storage medium having stored thereon a computer program for execution by a processor to perform the method of the first aspect.
In a fifth aspect, the disclosed embodiments also provide a computer program product comprising a computer program or instructions which, when executed by a processor, implement a message processing method as above.
The message processing method, the device, the equipment and the computer readable storage medium provided by the embodiment of the disclosure determine a message receiver of the target message according to the information contained in the target message after the target message sent by the message sender is acquired, store the target message into a storage space corresponding to the message receiver when the target message cannot be sent to the message receiver, further wake up a message processing object corresponding to the message receiver, and the message processing object can acquire the target message and acquire a processing strategy aiming at the target message, so that the message receiver can process the target message according to the processing strategy corresponding to the target message.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments of the present disclosure or the solutions in the prior art, the drawings that are required for the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a flow chart of a message processing method according to an embodiment of the disclosure;
fig. 2 is a schematic diagram of an implementation principle of a message processing method according to an embodiment of the disclosure;
FIG. 3 is a flow chart of another message processing method according to an embodiment of the present disclosure;
FIG. 4 is a flow chart of yet another message processing method according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, a further description of aspects of the present disclosure will be provided below. It should be noted that, without conflict, the embodiments of the present disclosure and features in the embodiments may be combined with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced otherwise than as described herein; it will be apparent that the embodiments in the specification are only some, but not all, embodiments of the disclosure.
As above, the messaging mechanisms supported by different operating systems may vary. When a message receiver and a message sender are migrated to an operating system that does not support a message communication mechanism between the message receiver and the message sender, the message receiver and the message sender are rendered incapable of message communication.
For example, the LINUX operating system supports messaging mechanisms based on the POSIX standard. The message communication mechanism of the POSIX standard comprises the processes of registration of a message, blocking of the message and distribution of the message.
For the seL microkernel operating system, the seL microkernel only supports a Notification standard-based message Notification mechanism and cannot be compatible with a POSIX standard message communication mechanism.
Therefore, after the application program based on the communication mechanism of the POSIX standard is transplanted to the operating system of the sel4 microkernel, the operating system cannot process the communication mechanism based on the POSIX standard, so that the partial functions related to message processing of the application program transplanted to the operating system of the sel4 microkernel are greatly affected, and even the application program is not available.
In view of the foregoing, embodiments of the present disclosure provide a message method, apparatus, device, and computer-readable storage medium. The message processing method will be described first with reference to specific embodiments.
Fig. 1 is a flow chart of a message processing method according to an embodiment of the disclosure.
In an embodiment of the present disclosure, the message processing method may be performed by a message processing device, where the message processing device may be an electronic device or a server. Electronic devices include, but are not limited to, smart phones, palm top computers, tablet computers, wearable devices with display screens, desktop computers, notebook computers, all-in-one computers, smart home devices, and the like. The server can be an independent server or a cluster of a plurality of servers, and can comprise a local server and a server erected at a cloud.
As shown in fig. 1, the message processing method mainly includes the following steps:
s110, obtaining the target message sent by the message sender, and determining a message receiver of the target message.
In the disclosed example, after the message processing device obtains the target message sent by the message sender, the message processing device determines the receiver of the target message according to the information included in the target message when the target message is sent and/or the information when the message sender sends the target message.
In general, the communication between the message sender and the message receiver may be a communication between a process corresponding to the message sender and a process corresponding to the message receiver.
In some embodiments, the communication between the process corresponding to the message sender and the process corresponding to the message receiver is: the message sender sends the target message, the process corresponding to the message sender determines a target sending thread, and the target message is sent out through the target sending thread.
After receiving the target message sent by the target sending thread, the message receiver determines a target processing thread for receiving and processing the target message according to the information included in the target message, thereby realizing the communication between the message sender and the message receiver.
In general, a target message sent by a message sender includes information such as a message header and a message body, and the message header includes information such as a target message identifier, a process corresponding to the message sender, a process corresponding to a message receiver, and a target sending thread.
Further, the message processing apparatus may determine a message recipient of the target message based on information included in a message header in the target message.
In other embodiments, the communication between the process corresponding to the message sender and the process corresponding to the message receiver is: the process corresponding to the message sender calls a message sending method, and the message sending method at least needs parameters such as a target message identifier, a process corresponding to the message sender, a process corresponding to the message receiver, a target sending thread, a target processing thread and the like. When a message sender calls a message sending method to send a target message, assigning a parameter required by the message sending method, and the message sending method assembles the parameter into the target message and sends the target message.
After receiving the target message, the message receiver determines a target processing thread for receiving and processing the target message, thereby realizing the communication between the message sender and the message receiver.
Because the message sender assigns the parameters of the message sending method when calling the message sending method, the message processing device can determine the message receiver of the target message according to the parameters in the message sending method.
S120, judging whether the target message can be sent to the message receiver, if not, storing the target message in a storage space corresponding to the message receiver.
In the embodiment of the disclosure, determining whether the target message can be sent to the message receiver may be determining whether the operating systems where the message sender and the message receiver are located support a message communication mechanism between the message sender and the message receiver.
When the operating systems of the message sender and the message receiver support a message communication mechanism between the message sender and the message receiver, the message sender and the message receiver directly communicate.
When the operating systems of the message sender and the message receiver do not support the message communication mechanism between the message sender and the message receiver, the target message cannot be sent to the message receiver, and the target message is stored in the storage space corresponding to the message receiver.
In some embodiments, the message processing apparatus may determine a message communication mechanism between the message sender and the message receiver, and then determine whether an operating system in which the message sender and the message receiver are located supports the message communication mechanism between the message sender and the message receiver.
The determining the message communication mechanism between the message sender and the message receiver may be that the message processing device scans whether the executable linkable format file (Executable and Linkable Format, ELF) of the message receiver has a code script of a related method of the communication mechanism according to the communication mechanism included in the target message sent by the message sender. When the executable file of the message receiver includes a code script for a related method of the communication mechanism included in the target message, it is determined that the message receiver can process the target message, and then a message communication mechanism between the message sender and the message receiver is determined.
For example, when the communication mechanism included in the target message is a message communication mechanism of the POSIX standard, the message processing device scans an ELF file of the message receiver, and when the message processing device scans that the ELF file includes a code script related to the signaling () method, it is determined that communication can be performed between the message sender and the message receiver through the message communication mechanism of the POSIX standard.
When the executable file of the message receiver does not include the code script of the related method for the communication mechanism included in the target message, it is determined that the message receiver cannot process the target message, and the message sender and the message receiver cannot substantially communicate, which is not processed in any way according to the embodiment of the disclosure.
After determining the message communication mechanism between the message sender and the message receiver, the message processing device further determines whether the operating systems of the message sender and the message receiver support the message communication mechanism between the message sender and the message receiver.
Typically, the messaging mechanisms that an operating system is capable of supporting are known.
Alternatively, the operating system may be pre-established with the message communication mechanism it supports. After the message communication mechanism between the message sender and the message receiver is determined, judging whether the operating systems of the message sender and the message receiver support the message communication mechanism between the message sender and the message receiver according to the established corresponding relation.
When the operating systems of the message sender and the message receiver support a message communication mechanism between the message sender and the message receiver, the corresponding process of the message sender directly sends the target message to the corresponding process of the message receiver.
When the operating systems of the message sender and the message receiver do not support the message communication mechanism between the message sender and the message receiver, the message processing equipment assembles the target message sent by the message sender and stores the target message into the storage space corresponding to the message receiver.
The storage space may be a storage for storing the target message, and both the message processing device and the message receiver may access the storage. For example, the storage space may be a memory, a data table, or a storage file.
S130, waking up a message processing object corresponding to a message receiver, wherein the message processing object acquires a target message from a storage space, and acquires a message processing strategy corresponding to the target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
In the embodiment of the present disclosure, a message processing policy that a message receiver can process or is a target message to be processed needs to be preset on a message processing apparatus.
In some embodiments, the message processing policy corresponding to the target message that the message receiver can process or wants to process is preset to be: target messages and corresponding message processing strategies are preset by calling a registration method.
Specifically, the message processing device provides a registration method, where the registration method at least includes two parameters, namely a message identifier and a message processing policy.
When the message receiver calls the registration method, the message processing strategy which can process or want to process the target message and corresponds to the target message is taken as a parameter value, the registration method assembles registration information, and the message processing strategy which can process or want to process the target message and corresponds to the target message is registered to the message processing equipment.
In other embodiments, the message processing policy preset for the target message that the message receiver can process may also be: the message processing policy corresponding to the target message that the message recipient is able to process or wants to process is manually configured to the message processing device.
After the setting is completed, after the message sender sends out the target message, the message processing object can process the target message according to the message processing strategy corresponding to the target message.
In particular, in embodiments of the present disclosure, the message processing object may be a particular processing thread that is used to process the target message in place of the target processing thread.
After the message processing apparatus stores the target message in the storage space through step S120, first, the target processing thread for processing the target message in step S110 is suspended and wakes up the message processing object.
And then, the message processing object acquires the target message from the storage space, acquires the message processing strategy corresponding to the preset target message, finds the message processing strategy set by the message receiver and aiming at the target message, and processes the target message based on the message processing strategy.
Specifically, the processing of the target message based on the message processing policy may be: the message processing device injects the message processing object into an executable file of the message receiver, finds a code script corresponding to the message processing strategy in the executable file of the message receiver, and processes the target message according to processing logic of the code script.
In some embodiments, when the message processing object does not acquire the message processing policy corresponding to the target message, the target message may be processed according to a default processing manner or a custom processing manner of the message communication mechanism between the message sender and the message receiver, which is not limited in the embodiments of the present disclosure.
After the message processing object finishes processing the target message, the message processing device enables the target message processing object to enter the dormant state again, and enables the target processing thread to be in a normal state. When the message sender sends the target message again, the message processing apparatus continues to perform the above-described steps S110-S130.
Fig. 2 is a schematic implementation diagram of a message processing method provided by an embodiment of the present disclosure, and in the following, in conjunction with fig. 2, a message communication mechanism between a message sending party and a message receiving party is a message communication mechanism of POSIX standard, and an operating system where the message sending party and the message receiving party are located is a sel4 microkernel operating system, which is an example, and the message processing method provided by the embodiment of the present disclosure is described.
The process corresponding to the message sender calls a message sending method in a message communication mechanism of the POSIX standard to send out a target message, wherein the target message at least comprises information of a message identifier, a message sender identifier, a message receiver identifier and other message communication mechanisms conforming to the POSIX standard. The message processing device obtains the target message, and can determine the message receiver of the target message according to the information in the target message.
Further, the message processing device scans the ELF file of the message receiver, and when the message processing device scans that the ELF file contains code scripts related to methods such as signaling (), the message communication mechanism between the message sender and the message receiver is determined to be a POSIX standard message communication mechanism.
Further, the message processing device judges that the operating system sel4 microkernel operating system where the message sending and receiving party is located does not support the message communication mechanism of the POSIX standard according to the corresponding relation between the pre-established operating system and the message communication mechanism supported by the pre-established operating system.
Further, the message processing device stores the target message into the shared memory corresponding to the message receiver.
Further, the message processing device suspends a target processing thread of the message receiver for processing the target message, wakes up the message processing object, so that the message processing object obtains the target message from the shared memory and obtains a message processing strategy corresponding to the preset target message in the message processing device. The message processing device links the message processing object to the ELF file corresponding to the message receiver through the linker, finds the code script corresponding to the message processing strategy in the ELF file, and processes the target message according to the processing logic of the code script corresponding to the message processing strategy.
The POSIX standard message communication mechanism comprises a standard message registration interface, and the interface at least comprises a message identifier and a message processing strategy. When the message communication mechanism is a POSIX standard message communication mechanism, the message processing device can implement the message registration interface, and the implementation logic is as follows: when the message receiver calls the message registration interface of the POSIX standard, the message identification and the message processing strategy of the message receiver are registered to the message processing equipment.
Further, after the message processing object is processed, the message processing device makes the target message object enter a dormant state, and makes the target processing thread resume a normal state.
It can be seen that, in the embodiment of the present disclosure, after the target message sent by the message sender is obtained and the message receiver of the target message is determined, when the target message cannot be sent to the message receiver, the target message is stored in the storage space corresponding to the message receiver, and the message processing object corresponding to the message receiver is further awakened, so that the target message is stored in the storage space independently of the operating systems where the message sender and the message receiver are located, and is processed by the message processing object according to the message processing policy corresponding to the target message, thereby ensuring the message communication between the message sender and the message receiver.
Before storing the target message in the storage space corresponding to the message receiver in the step S120, the message processing apparatus creates the storage space corresponding to the message receiver of the target message in advance.
Specifically, after the message processing device determines that the target message cannot be sent to the message receiver, it further determines whether the message receiver has a corresponding storage space, and when the message receiver does not have a corresponding storage space, the message processing device creates a storage space corresponding to the message receiver.
Further, the message processing device may store the target message in a storage space corresponding to the message recipient.
It can be understood that when the message processing device determines that the message receiving party has a corresponding storage space, the message processing device directly stores the target message into the storage space corresponding to the message receiving party.
Before waking up the message processing object corresponding to the message receiver in the step S130, the message processing device may create in advance the message processing object corresponding to the message receiver of the target message, and make the message processing object enter the dormant state.
Specifically, after the message processing device determines that the target message cannot be sent to the message receiver, it further determines whether the message receiver has a corresponding message processing object, when the message receiver does not have a corresponding message processing object, the message processing device creates a message processing object corresponding to the message receiver, and after creating the message processing object, makes the message processing object enter a dormant state.
Further, the message processing apparatus may wake up the message processing object corresponding to the message receiver after storing the target message in the storage space corresponding to the message receiver.
It will be appreciated that when the message processing apparatus determines that the message receiver has a corresponding message processing object, the message processing apparatus wakes up the target message processing object directly.
In some embodiments, the message processing object corresponding to the wakeup message receiver may be: based on the wake-up notification, waking up a message processing object corresponding to the message receiver.
Specifically, after the message processing device stores the target message in the storage space, a message notification mechanism supported by the operating system where the message receiver is located is used to send a wakeup notification to the message processing object corresponding to the message receiver, so as to wake up the message processing object.
Fig. 3 is a flow chart of another message processing method according to an embodiment of the disclosure, as shown in fig. 3, the message processing method includes the following steps:
s310, obtaining the target message sent by the message sender and determining the message receiver of the target message.
In the implementation of the present disclosure, this step is the same as the step S110 described above, and will not be described herein.
S320, judging whether the target message can be sent to the message receiver, if not, judging whether the message receiver of the target message sets a blocking identifier corresponding to the target message based on the target message.
In the embodiment of the disclosure, when the operating system where the message sender is located and the operating system where the message receiver is located do not support a message communication mechanism between the message sender and the message receiver, the message processing device determines whether a thread included in a process corresponding to the message receiver is provided with a blocking identifier corresponding to the target message.
In particular, the blocking identifier may be identification information that does not process the target message.
In general, the message sender sends the target message, which may be a process corresponding to the message receiver, or may be a specified thread included in a process corresponding to the message receiver directly, and takes the execution thread as a target processing thread.
When the message sender sends the target message to the process corresponding to the message receiver, the target processing thread for processing the target message is determined according to the running conditions of all threads in the process corresponding to the message receiver.
Based on the above description, the communication between the message sender and the message receiver is finally the processing of the target information by the threads of the message receiver, so in the embodiment of the disclosure, the message processing module manages the blocking of the messages by the threads according to the thread granularity, i.e. each thread can set whether to block a certain message or certain messages.
In some embodiments, whether each thread sets blocking a message or messages may be to invoke a blocking method that sends blocking information for each thread invoking the blocking method to the message processing device, the blocking information including at least a message identification, a thread identification, a blocking identification.
S330, if the message receiver does not set the blocking identifier corresponding to the target message, storing the target message into the storage space corresponding to the message receiver.
The message processing device receives the blocking information sent by the blocking interface, when the message sender sends the target message to the process corresponding to the message receiver, the message processing device judges whether threads which are not provided with the blocking identification corresponding to the target message exist in the threads which are included in the process corresponding to the message receiver according to the message identification, the thread identification and the blocking identification information in the blocking information, when any one of the threads which are included in the process corresponding to the message receiver and are not provided with the blocking identification corresponding to the target message exists, the target message is stored in the storage space corresponding to the message receiver, and meanwhile the threads are used as target processing threads
Optionally, when the threads included in the process corresponding to the message receiver have a plurality of threads not provided with the blocking identifier corresponding to the target message, specifically selecting which thread to use as the target processing thread can be set by itself according to the requirement, and implementation of the present disclosure is not limited.
When the message sender sends a target message to a thread directly sent to the message receiver, the thread is taken as a target processing thread. And the message processing equipment judges whether the target processing thread sets the blocking identifier corresponding to the target message according to the message identifier, the thread identifier and the blocking identifier information in the blocking information. And when judging that the target processing thread does not set the blocking identifier corresponding to the target message, storing the target message into the storage space corresponding to the message receiver.
S340, waking up a message processing object corresponding to a message receiver, wherein the message processing object acquires a target message from a storage space, and acquires a message processing strategy corresponding to the target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
In the embodiment of the present disclosure, this step is the same as step S130, and will not be described here again.
It can be seen that, in the embodiment of the present disclosure, after the target message sent by the message sender is obtained and the message receiver is determined, under the condition that the message receiver and the operating system where the message sender is located do not support the message communication mechanism between the message sender and the message receiver is not provided with the blocking identifier, the target message is stored in the storage space, and the message processing object corresponding to the message receiver is awakened, and the message processing object processes the target message according to the message processing policy corresponding to the target message, so that message communication between the message sender and the message receiver is implemented.
Fig. 4 is a flow chart of another message processing method according to an embodiment of the disclosure, as shown in fig. 4, the message processing method includes the following steps:
S410, obtaining the target message sent by the message sender, and determining the message receiver of the target message.
In the embodiment of the present disclosure, this step is the same as step S110, and will not be described here again.
S420, judging whether the message can be sent to a message receiver, if not, judging whether the message receiver of the target message sets a blocking identifier corresponding to the target message based on the target message.
In the embodiment of the present disclosure, this step is the same as step S320, and will not be described here again.
S430, if the message receiver sets the blocking identifier corresponding to the target message, the target message is added into the blocking storage.
In the embodiment of the disclosure, the congestion storage may be a storage structure for storing the target message when the message receiver sets a congestion identifier corresponding to the target message and cannot process the target message temporarily.
Alternatively, the blocking store may be a blocking queue, a blocking set, or the like.
The following description will take the example of storing the blocking as a blocking queue.
It can be appreciated that, because the message sender sends the target message to the process corresponding to the message receiver, and also can be the thread included in the process corresponding to the message receiver, the blocking queue can be a process-level blocking queue or a thread-level blocking queue.
Specifically, when the message sender sends the target message to the process corresponding to the message receiver, the message processing device judges whether threads which are not provided with the blocking identification corresponding to the target message exist in the threads which are included in the process corresponding to the message receiver according to the message identification, the thread identification and the blocking identification information in the blocking information, and when threads which are not provided with the blocking identification corresponding to the target message exist in the threads which are included in the process corresponding to the message receiver, the target message is added into the blocking queue.
When the target message sent by the message sender is a thread directly sent to the message receiver, the thread is used as a target processing thread. And the message processing equipment judges whether the target processing thread sets the blocking identifier corresponding to the target message according to the message identifier, the thread identifier and the blocking identifier information in the blocking information. And when the target processing thread is judged to set the identification information corresponding to the target message, adding the target message into the blocking queue.
S440, after the message receiver receiving the target message releases the blocking identification corresponding to the target message, the target message is stored in the storage space corresponding to the message receiver.
Normally, when a thread in a process corresponding to a message receiver can process a message, the blocking identification of the thread is released.
In some embodiments, it may be that a thread unblocks an identity of the thread by calling a unblocking method. The blocking removing method sends blocking removing information of a thread calling the blocking removing method to the message processing module, wherein the blocking removing information at least comprises a message identifier, a thread identifier and a blocking removing identifier.
When the thread releases the blocking identification, the message processing device acquires the target message from the blocking storage and stores the target message into the storage space corresponding to the message receiver.
S450, waking up a message processing object corresponding to a message receiver, wherein the message processing object acquires a target message from a storage space, and acquires a message processing strategy corresponding to the target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
In the embodiment of the present disclosure, this step is the same as step S130, and will not be described here again.
It can be seen that, in the embodiment of the present disclosure, after a target message sent by a message sender is obtained and a message receiver is determined, under the condition that the message receiver and an operating system where the message sender is located do not support a message communication mechanism between the message sender and the message receiver sets a blocking identifier, the target message is added to a blocking storage, and after the message receiver releases the blocking identifier, the target message is stored in a storage space, a message processing object corresponding to the message receiver is awakened, and the message processing object processes the target message according to a message processing policy corresponding to the target message. The method solves the problem of message communication between the message sending party and the message receiving party under the condition that a message communication mechanism between the message sending party and the message receiving party is blocked.
Fig. 5 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present disclosure. The message processing apparatus may execute a processing flow provided by an embodiment of a message processing method, as shown in fig. 5, and the message processing apparatus 500 includes:
an obtaining module 510, configured to obtain a target message sent by a message sender, and determine a message receiver of the target message;
a judging module 520, configured to judge whether the target message can be sent to the message receiver, and if not, store the target message in a storage space corresponding to the message receiver;
a wake-up module 530, configured to wake up a message processing object corresponding to a message receiver, where the message processing object obtains a target message from a storage space, and obtains a message processing policy corresponding to a target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
Optionally, the message processing apparatus 500 further includes a first creating module, configured to create a storage space corresponding to the message recipient of the target message before the judging module judges whether the target message can be sent to the message recipient, and if not, the target message is stored in the storage space corresponding to the message recipient.
Optionally, the message processing apparatus 500 further includes a second creating module, configured to create a message processing object corresponding to the message receiver of the target message and make the message processing object enter the sleep state before the waking module wakes the message processing object corresponding to the message receiver.
Optionally, when the wake-up module 530 is configured to wake up a message processing object corresponding to a message receiver, the wake-up module is specifically configured to: based on the wake-up notification, waking up a message processing object corresponding to the message receiver.
Optionally, the determining module 520 is configured to determine whether the target message can be sent to the message receiver, and if not, store the target message in a storage space corresponding to the message receiver, where the determining module is specifically configured to: judging whether a message receiver of the target message sets a blocking identifier corresponding to the target message or not based on the target message; if the message receiver does not set the blocking identifier corresponding to the target message, storing the target message into a storage space corresponding to the message receiver.
Optionally, the determining module 520 is configured to determine whether the target message can be sent to the message receiver, and if not, when storing the target message in the storage space corresponding to the message receiver, the determining module is further specifically configured to: judging whether a message receiver of the target message sets a blocking identifier corresponding to the target message or not based on the target message; if the message receiver sets the blocking identifier corresponding to the target message, the target message is added into the blocking storage; storing the target message in a storage space corresponding to the message receiver: comprising the following steps: after the message receiver receiving the target message releases the blocking identification corresponding to the target message, the target message is stored in the storage space corresponding to the message receiver.
The message processing apparatus of the embodiment shown in fig. 5 may be used to implement the technical solution of the above-mentioned method embodiment, and its implementation principle and technical effects are similar, and will not be described herein again.
Fig. 6 shows a schematic structural diagram of a message processing apparatus provided in an embodiment of the present disclosure. Referring now in particular to fig. 6, a schematic diagram of a message processing apparatus 600 suitable for use in implementing embodiments of the present disclosure is shown.
The message processing device 600 in the embodiments of the present disclosure may be an electronic device or a server. Among them, the electronic devices may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), wearable devices, and the like, and stationary terminals such as digital TVs, desktop computers, smart home devices, and the like. The server can be an independent server or a cluster of a plurality of servers, and can comprise a local server and a server erected at a cloud.
It should be noted that the message processing apparatus 600 shown in fig. 6 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, the message processing apparatus 600 may include a processing device (e.g., a central processing unit, a graphic processor, etc.) 601 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage device 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the message processing apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the message processing device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 shows a message processing apparatus 600 having various devices, it is to be understood that not all illustrated devices are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
The disclosed embodiments also provide a computer-readable medium storing a computer program which, when executed by a processor, causes the processor to implement the message processing method in the above embodiments.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 609, or from storage means 608, or from ROM 602. When executed by the processing means 601, performs the above-described functions defined in the message processing method of the embodiment of the present disclosure.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable medium, or any combination of the two. The computer readable medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may be any computer readable medium that is not a computer readable medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP, and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be embodied in the message processing apparatus; or may exist alone without being assembled into the message processing device.
The above computer readable medium carries one or more programs which, when executed by the message processing apparatus, cause the message processing apparatus to perform:
acquiring a target message sent by a message sender, and determining a message receiver of the target message; judging whether the target message can be sent to a message receiver, if not, storing the target message into a storage space corresponding to the message receiver; waking up a message processing object corresponding to a message receiver, wherein the message processing object acquires a target message from a storage space, and acquires a message processing strategy corresponding to the target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
In an embodiment of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (10)

1. A method of message processing, the method comprising:
acquiring a target message sent by a message sender, and determining a message receiver of the target message;
judging whether the target message can be sent to the message receiver, if not, storing the target message into a storage space corresponding to the message receiver;
waking up a message processing object corresponding to the message receiver, wherein the message processing object acquires the target message from the storage space and acquires a message processing strategy corresponding to the target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
2. The method of claim 1, wherein the storing the target message in the storage space corresponding to the message receiver is preceded by:
And creating a storage space corresponding to a message receiver of the target message.
3. The method of claim 1, wherein prior to waking the message processing object corresponding to the message recipient, the method further comprises:
and creating a message processing object corresponding to the message receiver of the target message, and enabling the message processing object to enter a dormant state.
4. The method of claim 1, wherein waking up the message processing object corresponding to the message recipient comprises:
and waking up the message processing object corresponding to the message receiver based on the wake-up notice.
5. The method of claim 1, wherein storing the target message in the storage space corresponding to the message recipient comprises:
judging whether a message receiver of the target message sets a blocking identifier corresponding to the target message or not based on the target message;
and if the message receiver does not set the blocking identifier corresponding to the target message, storing the target message into a storage space corresponding to the message receiver.
6. The method of claim 1, wherein storing the target message in a storage space corresponding to the message recipient further comprises:
Judging whether a message receiver of the target message sets a blocking identifier corresponding to the target message or not based on the target message;
if the message receiver sets a blocking identifier corresponding to the target message, adding the target message into a blocking storage;
storing the target message into a storage space corresponding to the message receiver: comprising the following steps:
after a message receiver receiving the target message releases the blocking identifier corresponding to the target message, storing the target message into a storage space corresponding to the message receiver.
7. A message processing apparatus, the apparatus comprising:
the acquisition module is used for acquiring the target message sent by the message sender and determining a message receiver of the target message;
the judging module is used for judging whether the target message can be sent to the message receiver, if not, the target message is stored in a storage space corresponding to the message receiver;
the awakening module is used for awakening a message processing object corresponding to the message receiver, and the message processing object acquires the target message from the storage space and acquires a message processing strategy corresponding to the target message preset by the message receiver; the message processing object processes the target message based on the message processing policy.
8. The apparatus of claim 7, wherein the determining module is configured to determine whether the target message can be sent to the message receiver, and if not, store the target message in a storage space corresponding to the message receiver, specifically configured to: judging whether a message receiver of the target message sets a blocking identifier corresponding to the target message or not based on the target message;
and if the message receiver does not set the blocking identifier corresponding to the target message, storing the target message into a storage space corresponding to the message receiver.
9. A message processing apparatus, comprising:
a processor;
a memory for storing executable instructions;
wherein the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the message processing method of any of the preceding claims 1-6.
10. A computer readable medium, characterized in that the medium stores a computer program which, when executed by a processor, causes the processor to implement the message processing method of any of the preceding claims 1-6.
CN202210561725.2A 2022-05-23 2022-05-23 Message processing method, device, equipment and computer readable storage medium Pending CN117149450A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210561725.2A CN117149450A (en) 2022-05-23 2022-05-23 Message processing method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210561725.2A CN117149450A (en) 2022-05-23 2022-05-23 Message processing method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN117149450A true CN117149450A (en) 2023-12-01

Family

ID=88904724

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210561725.2A Pending CN117149450A (en) 2022-05-23 2022-05-23 Message processing method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN117149450A (en)

Similar Documents

Publication Publication Date Title
CN109582310B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN110166791B (en) Connection establishing method, device, equipment and storage medium
US20140063344A1 (en) Augmenting Capabilities of a Host Device
CN110781373B (en) List updating method and device, readable medium and electronic equipment
CN110300165B (en) Method, device and equipment for calling functional program and storage medium
CN110381042B (en) Graceful restart service method, device, medium and electronic equipment
CN112019625A (en) Websocket-based message pushing method, system, equipment and medium
CN111246228A (en) Method, device, medium and electronic equipment for updating gift resources of live broadcast room
CN111432001A (en) Method, apparatus, electronic device, and computer-readable medium for jumping scenes
CN110865846B (en) Application management method, device, terminal, system and storage medium
CN111596992B (en) Navigation bar display method and device and electronic equipment
CN110960857A (en) Game data monitoring method and device, electronic equipment and storage medium
CN113518183B (en) Camera calling method and device and electronic equipment
CN117149450A (en) Message processing method, device, equipment and computer readable storage medium
CN112860431B (en) Connection method, system, equipment and storage medium of micro service node
CN111444457B (en) Data release method and device, storage medium and electronic equipment
CN109669679B (en) Service detection and processing method and device and electronic equipment
CN112162682A (en) Content display method and device, electronic equipment and computer readable storage medium
CN110633141A (en) Memory management method and device of application program, terminal equipment and medium
CN111538721A (en) Account processing method and device, electronic equipment and computer readable storage medium
CN111240758A (en) Material display method and device, electronic equipment and storage medium
CN109451152B (en) Information transmission method and system based on mobile terminal
CN115225586B (en) Data packet transmitting method, device, equipment and computer readable storage medium
CN110022368B (en) Method, device and equipment for controlling overtime time of uploaded pictures and storage medium
CN112817666B (en) Timing method, timing device, electronic 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