Disclosure of Invention
The embodiment of the invention provides a message processing method, a message processing device, electronic equipment and a computer readable storage medium.
In a first aspect, an embodiment of the present invention provides a message processing method.
Specifically, the message processing method includes:
responding to a received message, and acquiring attribute information of the message;
determining a service set which does not process the message according to the attribute information of the message;
and for the services in the service set, creating corresponding message processing tasks based on a multithreading mechanism and processing the corresponding message processing tasks.
With reference to the first aspect, in a first implementation manner of the first aspect, the determining, according to the attribute information of the message, a service set that does not process the message includes:
inquiring the processing state of the service stored in a memory on the message by taking the attribute information of the message as an inquiry condition;
and determining a service set which does not process the message according to the processing state.
With reference to the first aspect and the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the creating, based on a multithreading mechanism, a corresponding message processing task and processing the message processing task for a service in the service set includes:
for the services in the service set, establishing corresponding message processing tasks based on a multithreading mechanism;
adding the message processing task into a task queue;
and taking out the current task to be processed from the task queue for processing.
With reference to the first aspect, the first implementation manner of the first aspect, and the second implementation manner of the first aspect, in a third implementation manner of the first aspect, the creating, for the service in the service set, a corresponding message processing task based on a multithreading mechanism includes:
for the services in the service set, creating corresponding message processing tasks based on the attribute information of the messages;
generating a plurality of threads, wherein the number of threads is less than or equal to the number of message processing tasks;
and distributing the message processing task to the thread according to a preset distribution rule.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, and the third implementation manner of the first aspect, in a fourth implementation manner of the first aspect, the adding the message processing task to the task queue includes:
acquiring a priority evaluation element;
calculating the priority of the message processing task according to the priority evaluation element;
and adding the message processing task into a task queue according to the priority of the message processing task.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, and the fourth implementation manner of the first aspect, the present invention further includes, in a fifth implementation manner of the first aspect:
and updating the service message processing state.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, the fourth implementation manner of the first aspect, and the fifth implementation manner of the first aspect, in a sixth implementation manner of the first aspect, the updating a service message processing state includes:
when the message processing task is finished, deleting the corresponding service in the service set, and updating the processing state of the service stored in a memory on the message;
and when the processing of the message processing task is abnormal, the message processing task is processed again according to a preset rule, and the processing state of the service stored in the memory on the message is updated.
In a second aspect, an embodiment of the present invention provides a message processing apparatus.
Specifically, the message processing apparatus includes:
an acquisition module configured to acquire attribute information of a message in response to receiving the message;
the determining module is configured to determine a service set which does not process the message according to the attribute information of the message;
and the processing module is configured to create and process corresponding message processing tasks for the services in the service set based on a multithreading mechanism.
With reference to the second aspect, in a first implementation manner of the second aspect, the determining module includes:
the query submodule is configured to query the processing state of the business stored in the memory on the message by taking the attribute information of the message as a query condition;
a determining submodule configured to determine a service set which does not process the message according to the processing state.
With reference to the second aspect and the first implementation manner of the second aspect, in a second implementation manner of the second aspect, the processing module includes:
the first creating submodule is configured to create corresponding message processing tasks for the services in the service set based on a multithreading mechanism;
a first joining submodule configured to join the message processing task in a task queue;
and the processing submodule is configured to take out the current task to be processed from the task queue for processing.
With reference to the second aspect, the first implementation manner of the second aspect, and the second implementation manner of the second aspect, in a third implementation manner of the second aspect, the first creating sub-module includes:
the second creating submodule is configured to create corresponding message processing tasks for the services in the service set based on the attribute information of the messages;
a generation submodule configured to generate a plurality of threads, wherein the number of threads is less than or equal to the number of message processing tasks;
and the distribution submodule is configured to distribute the message processing task to the thread according to a preset distribution rule.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, and the third implementation manner of the second aspect, in a fourth implementation manner of the second aspect, the first adding sub-module includes:
an acquisition submodule configured to acquire a priority evaluation element;
a calculation submodule configured to calculate a priority of the message processing task according to the priority evaluation element;
and the second adding submodule is configured to add the message processing task into the task queue according to the priority of the message processing task.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, and the fourth implementation manner of the second aspect, in a fifth implementation manner of the second aspect, the present invention further includes:
and the updating module is configured to update the service message processing state.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, the fourth implementation manner of the second aspect, and the fifth implementation manner of the second aspect, in a sixth implementation manner of the second aspect, the updating a service message processing state includes:
when the message processing task is finished, deleting the corresponding service in the service set, and updating the processing state of the service stored in a memory on the message;
and when the processing of the message processing task is abnormal, the message processing task is processed again according to a preset rule, and the processing state of the service stored in the memory on the message is updated.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a memory and a processor, where the memory is used to store one or more computer instructions that support a message processing apparatus to execute the message processing method in the first aspect, and the processor is configured to execute the computer instructions stored in the memory. The message processing apparatus may further comprise a communication interface for the message processing apparatus to communicate with other devices or a communication network.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium for storing computer instructions for a message processing apparatus, where the computer instructions include computer instructions for executing the message processing method in the first aspect to a message processing apparatus.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the technical scheme firstly determines the services which do not process the message according to the attribute information of the received message, and then creates corresponding message processing tasks for the services based on a multithreading mechanism to perform corresponding processing. According to the technical scheme, the asynchronous multithreading mechanism is adopted to carry out parallel processing on the messages to be monitored, so that the response time consumption of message processing can be effectively reduced, the message overstock is avoided, meanwhile, the system calculation and processing resources can be saved, and especially under the conditions of numerous services and high message receiving frequency, the requirement of the message processing response time consumption can be still met.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of embodiments of the invention.
Detailed Description
Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. Also, for the sake of clarity, parts not relevant to the description of the exemplary embodiments are omitted in the drawings.
In the embodiments of the present invention, it is to be understood that terms such as "including" or "having", etc., are intended to indicate the presence of the features, numbers, steps, actions, components, parts, or combinations thereof disclosed in the present specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, actions, components, parts, or combinations thereof may be present or added.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. Embodiments of the present invention will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
The technical scheme provided by the embodiment of the invention firstly determines the services which do not process the message according to the attribute information of the received message, and then creates corresponding message processing tasks for the services based on an asynchronous multithreading mechanism to carry out corresponding processing. According to the technical scheme, the asynchronous multithreading mechanism is adopted to carry out parallel processing on the messages to be monitored, so that the response time consumption of message processing can be effectively reduced, the message overstock is avoided, meanwhile, the system calculation and processing resources can be saved, and especially under the conditions of numerous services and high message receiving frequency, the requirement of the message processing response time consumption can be still met.
Fig. 1 shows a flow chart of a message processing method according to an embodiment of the invention, which, as shown in fig. 1, comprises the following steps S101-S103:
in step S101, in response to receiving a message, attribute information of the message is acquired;
in step S102, determining a service set that does not process the message according to the attribute information of the message;
in step S103, for the services in the service set, a corresponding message processing task is created based on a multithreading mechanism and processed.
As mentioned above, with the development of data technology, many platforms need to run multiple services simultaneously, and these services monitor the same type of messages simultaneously and execute corresponding service processing according to the received messages. The traditional message monitoring processing mode is a serial processing mode, i.e. a received message is serially sent to a plurality of services for subsequent processing. Under the conditions of small service quantity and low message receiving frequency, the processing mode can also meet the time-consuming requirement of basic message processing response, but under the conditions of large service quantity and high message receiving frequency, the processing mode obviously cannot meet the time-consuming requirement of message processing response.
In view of the above problem, in this embodiment, a message processing method is proposed, which first determines services that do not process a received message according to attribute information of the message, and then creates corresponding message processing tasks for the services based on an asynchronous multithreading mechanism to perform corresponding processing. According to the technical scheme, the asynchronous multithreading mechanism is adopted to carry out parallel processing on the messages to be monitored, so that the response time consumption of message processing can be effectively reduced, the message overstock is avoided, meanwhile, the system calculation and processing resources can be saved, and especially under the conditions of numerous services and high message receiving frequency, the requirement of the message processing response time consumption can be still met.
In an optional implementation manner of this embodiment, the message refers to a message that the service needs to listen to, such as a payment message, a signature message, a verification message, an alarm message, and the like, which may trigger the service to perform a next operation.
In an optional implementation manner of this embodiment, the attribute information of the message may include one or more of the following information: message type information, message source information, message size information, message related operation execution subject information, and the like. For example, for a payment message, if the message is a message generated by user a through a payment of a payment instrument, the attribute information may be represented as: the payment system comprises a payment class, a payment treasure, 100k and a user A, wherein the user A exists as execution subject information of the operation related to the message, and the execution subject information can be embodied as subject identification information with uniqueness, such as the name, the identification information, the account information and the like of the user A. The identity identification information can be unique identity identification information such as an identity card number, a passport number, a military officer license number and the like; the account information can be platform account information such as payment treasures, WeChat, QQ, nailing and the like, and can also be portal account information such as banks, insurance and the like; the account information can be platform account information such as payment treasures, WeChat, QQ, nail nails and the like, and can also be portal account information such as banks, insurance and the like.
In an optional implementation manner of this embodiment, the attribute information of the message may be sent with the message as the carried information of the message, or may be sent with the message as a part of the message content, so that after receiving the message, the attribute information of the message may be obtained through the information carried by the message, or the attribute information of the message may be obtained by means of a message content extraction operation.
In an optional implementation manner of this embodiment, as shown in fig. 2, the step S102, that is, the step of determining, according to the attribute information of the message, a service set that does not process the message includes the following steps S201 to S202:
in step S201, the attribute information of the message is used as a query condition to query the processing state of the message by the service stored in the memory;
in step S202, a service set that does not process the message is determined according to the processing status.
In the normal process, the processing status of each service for the message is usually stored in a memory for monitoring the message processing. Therefore, in this embodiment, the processing state of the services stored in the memory for the message may be queried using the attribute information of the message as a query condition to determine which services have not processed the message, and further combine the services that have not processed the message into a service set.
The processing state of a certain service to the message is not stored in the memory, or the stored processing state of a certain service to the message is incomplete, and the service is considered not to process the message.
In an optional implementation manner of this embodiment, as shown in fig. 3, the step S103, that is, for the services in the service set, the step of creating and processing the corresponding message processing task based on the multithreading mechanism includes the following steps S301 to S303:
in step S301, for the services in the service set, a corresponding message processing task is created based on a multithreading mechanism;
in step S302, adding the message processing task to a task queue;
in step S303, the current task to be processed is taken out from the task queue for processing.
In order to reduce the response time consumption of message processing, in this embodiment, for a service in the service set, a corresponding message processing task is created based on a multithreading mechanism, then the message processing task is added to a task queue, and then a current task to be processed is taken out from the task queue for processing.
In an optional implementation manner of this embodiment, as shown in fig. 4, the step S301, that is, the step of creating, based on a multithreading mechanism, a corresponding message processing task for a service in the service set includes the following steps S401 to S403:
in step S401, for the services in the service set, a corresponding message processing task is created based on the attribute information of the message;
in step S402, generating a plurality of threads, wherein the number of threads is less than or equal to the number of message processing tasks;
in step S403, the message processing task is allocated to the thread according to a preset allocation rule.
In order to improve the working efficiency of message processing and save the time taken by message processing, in the embodiment, the messages are processed in parallel by utilizing multiple threads. Specifically, in this embodiment, first, for the services in the service set, a corresponding message processing task is created based on the attribute information of the message; and then generating a plurality of threads, and distributing the message processing task to the threads according to a preset distribution rule.
The number of the threads is less than or equal to the number of the message processing tasks, and the preset allocation rule may be set according to the number of currently available threads, the number of the message processing tasks to be processed, specific contents of the message processing tasks to be processed, and specific requirements of actual message processing, for example, when the number of the threads is equal to the number of the message processing tasks, one message processing task may be correspondingly allocated to each process, and when the number of the threads is less than the number of the message processing tasks, one message processing task may be allocated to each process in one part of the processes, and two or more message processing tasks may be allocated to each process in the other part of the processes.
In an optional implementation manner of this embodiment, after the corresponding message processing task is created, a preset processing operation may be further performed on the message processing task, where the preset processing may include one or more of the following processes: the service logic refers to a logic rule set for realizing the function of a certain service, and the service logics of different services are different, so that the service logic filtering operation of different services is different and can be determined according to the function realized by the service, and the invention is not limited in particular.
In an optional implementation manner of this embodiment, as shown in fig. 5, the step S302 of adding the message processing task to the task queue includes the following steps S501 to S503:
in step S501, a priority evaluation element is acquired;
in step S502, calculating the priority of the message processing task according to the priority evaluation element;
in step S503, the message processing task is added to a task queue according to the priority of the message processing task.
In order to reflect the importance of different services and enable the related operations of more important services to be processed preferentially, when the message processing task is added into a task queue, priority information of the message processing task is considered. Specifically, in this embodiment, the priority evaluation element is acquired first; then calculating the priority of the message processing task according to the priority evaluation element; and finally, adding the message processing tasks into a task queue according to the priority of the message processing tasks, and subsequently, extracting one or more message processing tasks with higher priority in the task queue for priority processing.
Wherein the priority rating element may comprise one or more of the following elements: the type of service, the immediacy of service information processing, the importance of service-related operations, and the like.
When the priority of the message processing task is calculated according to the priority evaluation elements, corresponding priority evaluation scores can be respectively generated according to the priority evaluation elements, and then the priority of a certain service is obtained by summing the priority evaluation scores. Furthermore, different weights can be set for the preset priority evaluation elements according to the importance degree of the preset priority evaluation elements, and then the priority information of a certain service can be obtained by weighting and summing the priority evaluation values.
In an optional implementation manner of this embodiment, the method further includes a step of updating the message processing status, that is, as shown in fig. 6, the method includes the following steps S601 to S604:
in step S601, in response to receiving a message, attribute information of the message is acquired;
in step S602, determining a service set that does not process the message according to the attribute information of the message;
in step S603, for the services in the service set, a corresponding message processing task is created based on a multithreading mechanism and processed;
in step S604, the service message processing status is updated.
As mentioned above, the memory stores the processing status of each service for the message to supervise message processing, and therefore, in this embodiment, in order to ensure real-time performance and accuracy of service data, after the message processing task is processed, the service message processing status needs to be updated.
In an optional implementation manner of this embodiment, the step S604, that is, the step of updating the service message processing status, may be implemented as:
when the message processing task is finished, deleting the corresponding service in the service set, and updating the processing state of the service stored in a memory on the message;
and when the processing of the message processing task is abnormal, the message processing task is processed again according to a preset rule, and the processing state of the service stored in the memory on the message is updated.
In this embodiment, when the message processing task is completed, the corresponding service in the service set may be deleted, and the processing state of the message by the service stored in the memory may be updated to be completed. When the message processing task is abnormal, whether the message processing task needs to be executed again can be determined according to the priority of the corresponding service or preset configuration information, and the processing state of the message is updated according to the service stored in the memory based on the current message processing task processing condition, so that not only can all services be ensured to process the message, but also the repeated processing of the service which has processed the message can be avoided. For example, if the priority of the corresponding service is higher, or if the service is preset to re-execute the message processing task if the message processing task is abnormal, the message processing task is re-executed when the message processing task is abnormal; otherwise, if the priority of the corresponding service is lower, or if the service is preset that the message processing task is not re-executed if the message processing task is abnormal, the message processing task is not re-executed when the message processing task is abnormal.
In an optional implementation manner of this embodiment, when the message processing task is abnormal, the information on whether the message processing task needs to be reprocessed may be further obtained by sending a message processing task processing request to a corresponding service. In practical applications, a person skilled in the art may determine a processing manner of the exception message processing task according to needs of practical applications, and the foregoing is merely an exemplary illustration, and the present invention is not limited thereto.
The following are embodiments of the apparatus of the present invention that may be used to perform embodiments of the method of the present invention.
Fig. 7 shows a block diagram of a message processing apparatus according to an embodiment of the present invention, which may be implemented as part or all of an electronic device by software, hardware, or a combination of both. As shown in fig. 7, the message processing apparatus includes:
an obtaining module 701 configured to obtain attribute information of a message in response to receiving the message;
a determining module 702 configured to determine, according to the attribute information of the message, a service set that does not process the message;
a processing module 703 configured to create and process a corresponding message processing task based on a multithreading mechanism for the services in the service set.
As mentioned above, with the development of data technology, many platforms need to run multiple services simultaneously, and these services monitor the same type of messages simultaneously and execute corresponding service processing according to the received messages. The traditional message monitoring processing mode is a serial processing mode, i.e. a received message is serially sent to a plurality of services for subsequent processing. Under the conditions of small service quantity and low message receiving frequency, the processing mode can also meet the time-consuming requirement of basic message processing response, but under the conditions of large service quantity and high message receiving frequency, the processing mode obviously cannot meet the time-consuming requirement of message processing response.
In view of the above problem, in this embodiment, a message processing apparatus is proposed, which determines services that do not process a received message according to attribute information of the message, and creates corresponding message processing tasks for the services based on an asynchronous multithreading mechanism to perform corresponding processing. According to the technical scheme, the asynchronous multithreading mechanism is adopted to carry out parallel processing on the messages to be monitored, so that the response time consumption of message processing can be effectively reduced, the message overstock is avoided, meanwhile, the system calculation and processing resources can be saved, and especially under the conditions of numerous services and high message receiving frequency, the requirement of the message processing response time consumption can be still met.
In an optional implementation manner of this embodiment, the message refers to a message that the service needs to listen to, such as a payment message, a signature message, a verification message, an alarm message, and the like, which may trigger the service to perform a next operation.
In an optional implementation manner of this embodiment, the attribute information of the message may include one or more of the following information: message type information, message source information, message size information, message related operation execution subject information, and the like. For example, for a payment message, if the message is a message generated by user a through a payment of a payment instrument, the attribute information may be represented as: the payment system comprises a payment class, a payment treasure, 100k and a user A, wherein the user A exists as execution subject information of the operation related to the message, and the execution subject information can be embodied as subject identification information with uniqueness, such as the name, the identification information, the account information and the like of the user A. The identity identification information can be unique identity identification information such as an identity card number, a passport number, a military officer license number and the like; the account information can be platform account information such as payment treasures, WeChat, QQ, nailing and the like, and can also be portal account information such as banks, insurance and the like; the account information can be platform account information such as payment treasures, WeChat, QQ, nail nails and the like, and can also be portal account information such as banks, insurance and the like.
In an optional implementation manner of this embodiment, the attribute information of the message may be sent with the message as the carried information of the message, or may be sent with the message as a part of the message content, so that after receiving the message, the attribute information of the message may be obtained through the information carried by the message, or the attribute information of the message may be obtained by means of a message content extraction operation.
In an optional implementation manner of this embodiment, as shown in fig. 8, the determining module 702 includes:
a query submodule 801 configured to query the processing state of the message by the service stored in the memory with the attribute information of the message as a query condition;
a determining submodule 802 configured to determine, according to the processing status, a service set that does not process the message.
In the normal process, the processing status of each service for the message is usually stored in a memory for monitoring the message processing. Therefore, in this embodiment, the processing state of the services stored in the memory for the message may be queried using the attribute information of the message as a query condition to determine which services have not processed the message, and further combine the services that have not processed the message into a service set.
The processing state of a certain service to the message is not stored in the memory, or the stored processing state of a certain service to the message is incomplete, and the service is considered not to process the message.
In an optional implementation manner of this embodiment, as shown in fig. 9, the processing module 703 includes:
a first creating submodule 901, configured to create, for the services in the service set, corresponding message processing tasks based on a multithreading mechanism;
a first adding submodule 902 configured to add the message processing task to a task queue;
and the processing submodule 903 is configured to take out the current task to be processed from the task queue for processing.
In order to reduce the response time consumption of message processing, in this embodiment, for the services in the service set, the first creating sub-module 901 creates corresponding message processing tasks based on a multi-thread mechanism, the first adding sub-module 902 adds the message processing tasks into a task queue, and the subsequent processing sub-module 903 takes out the current task to be processed from the task queue for processing.
In an optional implementation manner of this embodiment, as shown in fig. 10, the first creating sub-module 901 includes:
a second creating sub-module 1001 configured to create, for the services in the service set, corresponding message processing tasks based on the attribute information of the messages;
a generation submodule 1002 configured to generate a plurality of threads, wherein the number of threads is less than or equal to the number of message processing tasks;
an allocating submodule 1003 configured to allocate the message processing task to the thread according to a preset allocation rule.
In order to improve the working efficiency of message processing and save the time taken by message processing, in the embodiment, the messages are processed in parallel by utilizing multiple threads. Specifically, in this embodiment, for the services in the service set, the second creating sub-module 1001 creates corresponding message processing tasks based on the attribute information of the message; the generating submodule 1002 generates a plurality of threads, and the allocating submodule 1003 allocates the message processing task to the threads according to a preset allocation rule.
The number of the threads is less than or equal to the number of the message processing tasks, and the preset allocation rule may be set according to the number of currently available threads, the number of the message processing tasks to be processed, specific contents of the message processing tasks to be processed, and specific requirements of actual message processing, for example, when the number of the threads is equal to the number of the message processing tasks, one message processing task may be correspondingly allocated to each process, and when the number of the threads is less than the number of the message processing tasks, one message processing task may be allocated to each process in one part of the processes, and two or more message processing tasks may be allocated to each process in the other part of the processes.
In an optional implementation manner of this embodiment, after the second creating sub-module 1001 creates the corresponding message processing task, it may further perform a preset processing operation on the message processing task, where the preset processing may include one or more of the following processes: the service logic refers to a logic rule set for realizing the function of a certain service, and the service logics of different services are different, so that the service logic filtering operation of different services is different and can be determined according to the function realized by the service, and the invention is not limited in particular.
In an optional implementation manner of this embodiment, as shown in fig. 11, the first adding sub-module 902 includes:
an acquisition submodule 1101 configured to acquire a priority evaluation element;
a calculating submodule 1102 configured to calculate a priority of the message processing task according to the priority evaluation element;
a second adding sub-module 1103 configured to add the message processing task to the task queue according to the priority of the message processing task.
In order to reflect the importance of different services and enable the related operations of more important services to be processed preferentially, when the message processing task is added into a task queue, priority information of the message processing task is considered. Specifically, in this embodiment, the acquisition sub-module 1101 acquires a priority evaluation element; the calculating submodule 1102 calculates the priority of the message processing task according to the priority evaluation element; the second adding sub-module 1103 adds the message processing tasks into the task queue according to the priority of the message processing tasks, and then may extract one or more message processing tasks with higher priority in the task queue for priority processing.
Wherein the priority rating element may comprise one or more of the following elements: the type of service, the immediacy of service information processing, the importance of service-related operations, and the like.
When calculating the priority of the message processing task according to the priority evaluation elements, the calculation submodule 1102 may generate corresponding priority evaluation scores according to each priority evaluation element, and then sum the priority evaluation scores to obtain the priority of a certain service. Furthermore, different weights can be set for the preset priority evaluation elements according to the importance degree of the preset priority evaluation elements, and then the priority information of a certain service can be obtained by weighting and summing the priority evaluation values.
In an optional implementation manner of this embodiment, the apparatus further includes a part for updating the message processing status, that is, as shown in fig. 12, the apparatus includes:
an obtaining module 1201 configured to obtain attribute information of a message in response to receiving the message;
a determining module 1202 configured to determine, according to the attribute information of the message, a service set that does not process the message;
a processing module 1203, configured to create and process a corresponding message processing task based on a multithreading mechanism for the services in the service set;
an update module 1204 configured to update the traffic message processing status.
As mentioned above, the memory stores the processing status of each service for the message to supervise message processing, and therefore, in this embodiment, in order to ensure real-time performance and accuracy of service data, after the message processing task is processed, the update module 1204 is further required to be arranged to update the processing status of the service message.
In an optional implementation manner of this embodiment, the update module 1204 may be configured to:
when the message processing task is finished, deleting the corresponding service in the service set, and updating the processing state of the service stored in a memory on the message;
and when the processing of the message processing task is abnormal, the message processing task is processed again according to a preset rule, and the processing state of the service stored in the memory on the message is updated.
In this embodiment, when the message processing task is completed, the updating module 1204 may delete the corresponding service in the service set and update the processing status of the message by the service stored in the memory to be completed. When the message processing task is abnormal, the updating module 1204 may determine whether to re-execute the message processing task according to the priority of the corresponding service or preset configuration information, and update the processing state of the message for the service stored in the memory based on the current message processing task processing condition, so that not only can all services be ensured to process the message, but also the repeated processing of the service that has processed the message can be avoided. For example, if the priority of the corresponding service is higher, or if the service is preset to re-execute the message processing task if the message processing task is abnormal, the message processing task is re-executed when the message processing task is abnormal; otherwise, if the priority of the corresponding service is lower, or if the service is preset that the message processing task is not re-executed if the message processing task is abnormal, the message processing task is not re-executed when the message processing task is abnormal.
In an optional implementation manner of this embodiment, when the message processing task is abnormal, the updating module 1204 may further obtain information about whether the message processing task needs to be reprocessed by sending a message processing task processing request to a corresponding service. In practical applications, a person skilled in the art may determine a processing manner of the exception message processing task according to needs of practical applications, and the foregoing is merely an exemplary illustration, and the present invention is not limited thereto.
Fig. 13 is a block diagram illustrating a structure of an electronic device according to an embodiment of the present invention, and as shown in fig. 13, the electronic device 1300 includes a memory 1301 and a processor 1302; wherein,
the memory 1301 is used to store one or more computer instructions, which are executed by the processor 1302 to implement any of the method steps described above.
Fig. 14 is a schematic structural diagram of a computer system suitable for implementing the message processing method according to the embodiment of the present invention.
As shown in fig. 14, the computer system 1400 includes a Central Processing Unit (CPU)1401 which can execute various processes in the above-described embodiments according to a program stored in a Read Only Memory (ROM)1402 or a program loaded from a storage portion 1408 into a Random Access Memory (RAM) 1403. In the RAM1403, various programs and data necessary for the operation of the system 1400 are also stored. The CPU1401, ROM1402, and RAM1403 are connected to each other via a bus 1404. An input/output (I/O) interface 1405 is also connected to bus 1404.
The following components are connected to the I/O interface 1405: an input portion 1406 including a keyboard, a mouse, and the like; an output portion 1407 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker and the like; a storage portion 1408 including a hard disk and the like; and a communication portion 1409 including a network interface card such as a LAN card, a modem, or the like. The communication section 1409 performs communication processing via a network such as the internet. The driver 1410 is also connected to the I/O interface 1405 as necessary. A removable medium 1411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1410 as necessary, so that a computer program read out therefrom is installed into the storage section 1408 as necessary.
In particular, the above described method may be implemented as a computer software program according to an embodiment of the present invention. For example, embodiments of the present invention include a computer program product comprising a computer program tangibly embodied on a medium readable thereby, the computer program comprising program code for performing the message processing method. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 1409 and/or installed from the removable media 1411.
The flowchart 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 invention. In this regard, each block in the flowcharts or block diagrams may represent a module, a program segment, or a 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 or modules described in the embodiments of the present invention may be implemented by software, or may be implemented by hardware. The units or modules described may also be provided in a processor, and the names of the units or modules do not in some cases constitute a limitation of the units or modules themselves.
As another aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may be a computer-readable storage medium included in the apparatus in the foregoing embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the embodiments of the present invention.
The foregoing description is only exemplary of the preferred embodiments of the invention and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention according to the embodiments of the present invention is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept. For example, the above features and (but not limited to) the features with similar functions disclosed in the embodiments of the present invention are mutually replaced to form the technical solution.