A message processing method, device, electronic device and storage medium
By obtaining the target message configuration from the pre-configured candidate message configuration and generating and processing the target message based on the message processing conditions, the problem of high message processing cost after the change in the prior art is solved, and a low-cost message processing process is realized.
Patent Information
- Application Number
- CN202210615510.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2042-05-31
AI Technical Summary
In the prior art, it is necessary to implement the process of post-change messages at a higher development cost.
In response to the message processing instruction, a target message configuration is obtained from the pre-configured candidate message configuration, which includes message processing conditions and message content, determines the target message allowed to be processed based on the message processing conditions, and generates and processes the target message.
The process of changing messages is realized at a lower development cost, and there is no need to adjust the developed message processing code logic, which improves the development efficiency of system messages and saves development resources and test resources.
Smart Images

Figure CN115036044B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of Internet medical technology, and in particular, to a message processing method, device, electronic device and storage medium. Background Art
[0002] With the development of Internet technology, the application of Internet medical care is becoming more and more extensive. At present, the consultation scenarios of Internet hospitals and the consultation processes in various consultation scenarios are becoming more and more complicated, and these consultation processes are all centered around instant messaging (IM) conversations.
[0003] In order to facilitate the smooth progress of the consultation process, the business adds a large number of system messages to the IM session to assist the interaction between doctors and patients. Currently, these system messages are directly written in the message processing code logic, which means that when it is necessary to process the system messages after changes (such as addition, deletion and modification, etc.), the developed message processing code logic needs to be adjusted before it can be realized.
[0004] In the process of implementing the present invention, the inventors found that the prior art has the following technical problems: a relatively high development cost is required to implement the processing of the changed message. Summary of the invention
[0005] The embodiments of the present invention provide a message processing method, device, electronic device and storage medium, which can realize the processing process of changed messages with lower development cost.
[0006] According to one aspect of the present invention, a message processing method is provided, which may include:
[0007] In response to the message processing instruction, a target message configuration is obtained from pre-configured candidate message configurations, wherein the target message configuration includes a message processing condition and a message content;
[0008] In response to determining based on the message processing condition that processing of a target message corresponding to the message content is permitted, generating a target message based on the message content;
[0009] Process the generated target message.
[0010] According to another aspect of the present invention, a message processing device is provided, which may include:
[0011] A target message configuration obtaining module, used to obtain a target message configuration from pre-configured candidate message configurations in response to a message processing instruction, wherein the target message configuration includes a message processing condition and a message content;
[0012] A target message generating module, configured to generate a target message based on the message content in response to determining that the target message corresponding to the message content is allowed to be processed based on the message processing condition;
[0013] The target message processing module is used to process the generated target message.
[0014] According to another aspect of the present invention, there is provided an electronic device, which may include:
[0015] at least one processor; and
[0016] a memory communicatively connected to at least one processor; wherein,
[0017] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by at least one processor so that the at least one processor implements the message processing method provided by any embodiment of the present invention when executing the computer program.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, on which computer instructions are stored. The computer instructions are used to enable a processor to implement the message processing method provided by any embodiment of the present invention when executed.
[0019] The technical solution of the embodiment of the present invention determines the target message configuration in response to the message processing instruction. The target message configuration may be a configuration including message processing conditions and message content determined from the candidate message configuration obtained in advance; in response to determining that the target message corresponding to the message content is allowed to be processed based on the message processing condition, the target message may be first generated based on the message content, and then the generated target message may be processed. In the above technical solution, since various messages are obtained through dynamic configuration rather than being directly written in the message processing code logic, this means that the message change process can be achieved by changing the corresponding message configuration without changing the developed message processing code logic, thereby achieving the effect of realizing the processing process of the changed message (here taking the target message as the changed message as an example) at a lower development cost.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a flowchart of a message processing method provided according to an embodiment of the present invention;
[0023] Figure 2 is a flowchart of another message processing method provided according to an embodiment of the present invention;
[0024] Figure 3 is a flowchart of an optional example of another message processing method provided in an embodiment of the present invention;
[0025] Figure 4 is a flowchart of another message processing method provided according to an embodiment of the present invention;
[0026] Figure 5 is a flowchart of an optional example of another message processing method provided according to an embodiment of the present invention;
[0027] Figure 6 is an architecture diagram of an optional example of another message processing method provided according to an embodiment of the present invention;
[0028] Figure 7 According to another message processing method provided by an embodiment of the present invention, Figure 6 Flowcharts matching the optional examples shown;
[0029] Figure 8 is a structural block diagram of a message processing device provided according to an embodiment of the present invention;
[0030] Fig. 9 It is a structural schematic diagram of an electronic device for implementing the message processing method of an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The situations of "target", "original", etc. are similar and will not be repeated here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] Figure 1 1 is a flow chart of a message processing method provided in an embodiment of the present invention. This embodiment is applicable to the case where the processing process of the changed message is realized at a lower development cost. The method can be executed by the message processing device provided in an embodiment of the present invention, and the device can be implemented by software and / or hardware. The device can be integrated in a message processing device, and the device can be various user terminals or servers.
[0034] See also Figure 1 The method of the embodiment of the present invention specifically includes the following steps:
[0035] S110. In response to the message processing instruction, obtain a target message configuration from pre-configured candidate message configurations, wherein the target message configuration includes a message processing condition and a message content.
[0036] Among them, the message processing instruction can be an instruction for processing the target message, and the target message can be a message to be generated and its message processing conditions and message content have been pre-configured. The message processing conditions can indicate under what circumstances the target message can be processed, and the message content can indicate the specific content of the target message. It should be noted that the above message processing conditions and message content can be reflected in the target message configuration, and the target message configuration can be configured during the initial configuration process; it can be a newly added configuration after the initial configuration is completed, which is a process from nothing to something; it can be obtained by modifying the previously configured target message configuration, such as modifying the message content in a target message configuration configured at a certain time. Of course, at this time, the target message configuration before modification has been overwritten by the modified target message configuration; it can also be obtained by deleting the previously configured target message configuration, which is a situation from something to nothing, and the target message configuration at this time is empty. Compared with the initial message configuration configured in the initial configuration process, the target message configuration obtained based on the subsequent three situations can be understood as a changed configuration, and the corresponding target message can be called a changed message. In other words, the corresponding message can be changed by changing a message configuration. This process reduces development costs because there is no need to adjust the logic of the message processing code that has been developed.
[0037] The candidate message configuration may be a specific configuration of certain messages obtained by pre-configuration, which includes a target message configuration corresponding to the target message. Therefore, the target message configuration can be obtained from the candidate message configuration by responding to the message processing instruction, such as implementing the screening process of the target message configuration according to the message identifier, message scenario type and message process type in the message processing instruction. In combination with the application scenarios that may be involved in the embodiments of the present invention, taking the system message described in the background technology as an example, since it involves multiple consultation scenarios and consultation processes, the message processing conditions in the candidate message configuration are diversified configurations, that is, each consultation scenario and each consultation process under each consultation scenario can correspond to their own message processing conditions, such as the conditions for verifying whether the corresponding system message can be processed under the current payment status and order type. The specific processing process may be sending, storing and receiving.
[0038] S120. In response to determining that processing of a target message corresponding to the message content is allowed based on the message processing condition, generate a target message based on the message content.
[0039] Among them, if it is determined based on the message processing conditions that the target message can be processed at this time, and the target message is the message to be generated corresponding to the message content, then in response to determining that the target message is allowed to be processed, the target message is generated based on the message content, so as to process the generated target message in combination with subsequent steps. In actual applications, optionally, the message content can be represented by a template, thereby improving the convenience of generating the target message. Optionally, if it is determined based on the message processing conditions that the target message cannot be processed at this time, such as when verifying the payment status, it is determined that the order has been paid, then there is no need to send a system message for indicating the payment order at this time, then in response to determining that the target message is not allowed to be processed, it can be directly exited or a corresponding prompt can be given, etc., which is not specifically limited here.
[0040] S130: Process the generated target message.
[0041] Among them, the generated target message is processed, and the specific processing process is related to the actual application scenario and is not specifically limited here.
[0042] It should be noted that in the above technical solution, since various messages are obtained through configuration rather than being directly written in the message processing code logic, this means that after the message processing code logic is developed once, the message processing process of multiple application scenarios can be supported, and the dynamic update of changed messages (such as messages after the message content and / or message processing conditions are changed) can be realized, that is, the changed messages can take effect immediately in the running message processing code logic, which is highly convenient. Combined with the application scenarios of Internet hospitals that may be involved in the embodiments of the present invention, the above technical solution solves the problems of high development cost, low flexibility and difficult maintenance of system messages caused by hard coding in a large number of complex scenarios, and provides flexible and reliable configuration capabilities for system messages, thereby improving the development efficiency of system messages and saving development resources and testing resources. It is a general dynamic message configuration solution.
[0043] The technical solution of the embodiment of the present invention determines the target message configuration in response to the message processing instruction. The target message configuration may be a configuration including message processing conditions and message content determined from the candidate message configuration obtained in advance; in response to determining that the target message corresponding to the message content is allowed to be processed based on the message processing condition, the target message may be first generated based on the message content, and then the generated target message may be processed. In the above technical solution, since various messages are obtained through dynamic configuration rather than being directly written in the message processing code logic, this means that the message change process can be achieved by changing the corresponding message configuration without changing the developed message processing code logic, thereby achieving the effect of realizing the processing process of the changed message (here taking the target message as the changed message as an example) at a lower development cost.
[0044] Figure 2 It is a flowchart of another message processing method provided in an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, the target message configuration also includes a conditional data source configuration corresponding to the message processing condition, and a content data source configuration corresponding to the message content. The above-mentioned message processing method may also include: obtaining conditional data based on the conditional data source configuration, and verifying whether the message processing condition is established based on the conditional data to determine whether to allow the target message to be processed; generating a target message based on the message content may include: obtaining content data corresponding to the content data source configuration, and generating a target message based on the message content and the content data. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.
[0045] See also Figure 2 The method of this embodiment may specifically include the following steps:
[0046] S210. In response to a message processing instruction, a target message configuration is obtained from pre-configured candidate message configurations, wherein the target message configuration includes a message processing condition, a conditional data source configuration corresponding to the message processing condition, a message content, and a content data source configuration corresponding to the message content.
[0047] Among them, since the conditional data involved in the message processing conditions is dynamic data, that is, it is not fixed data, but data that is strongly related to the actual situation. For example, in the Internet hospital scenario, the order number of each order is different. Then, when the data processing condition is to determine the order payment status of the corresponding order by the order number, the order number cannot be directly configured in the message processing condition. Here, the conditional data source configuration related to the source of the conditional data is used as a part of the target message configuration, so as to realize the dynamic acquisition of the conditional data based on the conditional data source configuration. Similarly, the content data involved in the message content is also dynamic data. Here, the content data source configuration related to the source of the content data is used as a part of the target message configuration, so as to realize the dynamic acquisition of the content data based on the content data source configuration. That is to say, when configuring the message, taking the message configuration of the target message as an example, in addition to configuring the message processing conditions and the message content, the conditional data source configuration and the content data source configuration can also be configured together.
[0048] S220: Acquire conditional data based on the conditional data source configuration, and verify whether the message processing condition is met based on the conditional data to determine whether to allow processing of the target message corresponding to the message content.
[0049] As mentioned above, since the conditional data source configuration is related to the source of the conditional data, the conditional data can be dynamically obtained from the conditional data source storing the conditional data based on the conditional data source configuration, and the conditional data can be considered as the specific value of a certain attribute in the conditional data source. Then, based on the obtained conditional data, it is verified whether the message processing condition is established. If it is established, it means that the target message can be processed, otherwise the target message cannot be processed.
[0050] S230: In response to determining that processing of the target message corresponding to the message content is allowed, obtaining content data corresponding to the content data source configuration, and generating the target message based on the message content and the content data.
[0051] Among them, if it is determined after verification that the target message can be processed, the content data corresponding to the content data source configuration is obtained, such as dynamically obtaining the content data from the content data source storing the content data based on the content data source configuration; for example, when the content data is included in the previously obtained conditional data, the content data is directly obtained from the conditional data; and so on, which are not specifically limited here.
[0052] S240: Process the generated target message.
[0053] The technical solution of the embodiment of the present invention configures the conditional data source configuration and the content data source configuration in the target message configuration, thereby realizing the dynamic acquisition of conditional data and content data based on the two, and then can realize the verification of message processing conditions based on the conditional data, and after the verification is passed, realize the generation of the target message based on the content data, thereby obtaining a target message that completely matches the actual situation.
[0054] On this basis, an optional technical solution is provided, in which the conditional data source configuration may include a data source request link and a data source request parameter, and obtaining conditional data based on the conditional data source configuration includes: based on the data source request parameter, calling the data source request service corresponding to the data source request link to obtain the conditional data. Among them, the data source request link may be an application programming interface (API) address provided externally by the data source request service for requesting conditional data from the corresponding conditional data source, and the data source request parameter may be a parameter required when requesting the conditional data, so the data source request service corresponding to the data source request link may be called based on the data source request parameter to obtain the corresponding conditional data, thereby achieving the effect of effectively obtaining the conditional data.
[0055] Another optional technical solution, obtaining content data corresponding to the content data source configuration, may include: in response to the acquired conditional data including the content data corresponding to the content data source configuration, obtaining the content data from the conditional data; in response to the acquired conditional data not including the content data, obtaining the content data based on the content data source configuration. If the acquired conditional data includes all the content data, the content data can be directly obtained from the conditional data; otherwise, the content data can be obtained based on the content data source configuration, and the specific acquisition method can be the same as or different from the acquisition method of the conditional data, which is not specifically limited here. The above technical solution provides a solution for obtaining content data under different circumstances, thereby further ensuring the efficiency of obtaining content data while ensuring the effective acquisition of content data.
[0056] In another optional technical solution, the target message configuration is pre-configured through the following steps: in response to a message configuration change instruction, obtaining a changed message configuration; wherein the changed message configuration includes a message processing condition and a message content, the message processing condition includes a conditional data source identifier, and the message content includes a content data source identifier; determining a conditional data source configuration corresponding to the conditional data source identifier and a content data source configuration corresponding to the content data source identifier from the pre-configured data source configuration; and combining the changed message configuration, the conditional data source configuration and the content data source configuration to obtain the target message configuration.
[0057] The message configuration change instruction may be an instruction for changing a message configuration before the change corresponding to the target message configuration, and the message configuration before the change may be empty (i.e., the change type this time is new addition) or previously configured (i.e., the change type this time is modification or deletion), which may include the message processing conditions and message content before the change. In response to the message configuration change instruction, a message configuration after the change is obtained after the message configuration before the change (specifically, the message processing conditions and / or message content therein) is changed, and the message configuration after the change includes the (changed) message processing conditions and message content.
[0058] The message processing condition includes a conditional data source identifier for identifying a conditional data source configuration, and the message content includes a content data source identifier for identifying a content data source configuration. The data source configuration may include many pre-configured conditional data source configurations and content data source configurations, so the conditional data source configuration corresponding to the conditional data source identifier and the content data source configuration corresponding to the content data source identifier are determined from the data source configuration, and then the changed message configuration, conditional data source configuration and content data source configuration are combined to obtain a combined message configuration (i.e., the target message configuration).
[0059] The above technical solution isolates or decouples the intermediate message configuration (here, the message configuration before change and the message configuration after change are respectively regarded as a message configuration in the intermediate message configuration) from the data source configuration, and obtains the conditional data source configuration and the content data source configuration from the data source configuration through the data source identifier in the intermediate message configuration, thereby combining them to obtain the combined message configuration, thereby ensuring the flexible extensibility of the message configuration.
[0060] In order to understand the above technical solution more vividly, the implementation of dynamic configuration of system messages is taken as an example to illustrate it.
[0061] 1) System message configuration (i.e. the intermediate message configuration mentioned above) format
[0062] In order to achieve a more flexible system message configuration solution, a complete and standardized system message configuration format can be set first. Specifically, as shown in Table 1, the main configuration items of the system message configuration may include: 1. message configuration identifier, 2. message scenario type, 3. message sending condition expression (i.e., message sending condition expressed by expression), 4. message content template (message content expressed by template), 5. message sender, and 6. message receiver.
[0063] Table 1 Configuration items of system message configuration
[0064] Configuration items Configuration Type illustrate MsgId String Message configuration identifier MsgScene String Message scenario type MsgSendCondition String Message sending condition expression MsgContentPattern String Message content template MsgFrom String Message sender MsgTo String Message Recipient
[0065] The message sending condition expression defines the sending conditions of the system message, such as verifying the order payment status, order type, referral status, and prescription status. The specific examples are as follows:
[0066]
[0067] The sending conditions of the system message shown in the above example are: the payment status is paid, the order type is text consultation, the referral status is not referred, and the prescription status is not prescribed. The system message can only be sent when all the sending conditions are met. The order information (order), referral information (transfer), and prescription information (prescribe) come from three different data sources. The conditional data under these data sources need to be obtained by the message service through remote calls to the corresponding data source request service. In the above example, a small bracket content represents a judgment condition. The #[**] in the small bracket represents a certain attribute under a certain data source, such as #[order.payStatus] represents the payment status attribute of the order information. Multiple small brackets can directly express logic through && and ||. As can be seen from the above, the conditional data in the message sending condition expression is dynamic data obtained through remote calls. When the dynamic data to be obtained changes, in order to cope with such changes, the pre-configured data source configuration can be used to support new data sources.
[0068] Similarly, the method for obtaining dynamic data in the message content template is the same. For example, in the following example, doctor is the data source and name is the attribute under doctor:
[0069] "Hello, Doctor #[doctor.name], you have a new order to process!".
[0070] 2) Data source configuration format
[0071] In order to support the acquisition capability of new data sources, the data source configuration is set here. Its main configuration items may include: 1. Data source name (i.e. data source identifier, specifically, conditional data source name and content data source name), 2. Data source request link, 3. Data source request parameter format (i.e. data source request parameters), as shown in Table 2 below:
[0072] Table 2 Configuration items of data source configuration
[0073] Configuration items Configuration Type illustrate Name String Data Source Name DataUrl String Data Source Request Link RequestParams String Data source request parameter format
[0074] The data source name is the name of the corresponding data source request service, which corresponds to the data source name in the message sending condition expression in the system message configuration, such as order information is order. The data source request link is the API address provided by the data source request service to the outside world, which can be the API address of the Http protocol. The data source request parameter format is the parameter required by the request API, which can be the parameter in Json format. For example, the parameter required to obtain order information is the order ID, then the data source request parameter format is:
[0075]
[0076] The above completes the definition of system message configuration and data source configuration.
[0077] 3) Configuration synchronization
[0078] The system message configuration and data source configuration defined in 1) and 2) above can be saved in the configuration center, so that they can be obtained through the configuration center server API. The configuration center client is integrated in the message system. The configuration center client uses long polling to obtain the latest system message configuration in the configuration center server in real time (such as the changed message configuration above), and then parses it into a combined message configuration and stores it in the local cache of the message system. For the specific process, see Figure 3 . Among them, the configuration center client obtains the latest system message configuration in the configuration center server, and then parses it to obtain the conditional data source name (such as order, transfer and prescribe in the above example) and the content data source name (such as doctor in the above example); further, the conditional data source configuration is matched from the data source configuration according to the conditional data source name and the content data source configuration is matched from the data source configuration according to the content data source name; the latest system message configuration, conditional data source configuration and content data source configuration are combined to obtain a combined message configuration, and stored in the local cache of the message system. The main configuration items of the combined message configuration are shown in Table 3:
[0079] Table 3 Configuration items of combined message configuration
[0080] Configuration items Configuration Type illustrate MsgId String Message configuration identifier MsgScene String Message scenario type MsgSendCondition String Message sending condition expression MsgSendConditionDataConfig Object Conditional data source configuration MsgContentPattern String Message content template MsgContentPatternDataConfig Object Content data source configuration MsgFrom String Message sender MsgTo String Message Recipient
[0081] Figure 4 It is a flowchart of another message processing method provided in an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, the target message configuration is obtained from the pre-configured candidate message configuration, including: obtaining the message scenario type, and determining at least one target message configuration that matches the message scenario type from the pre-configured candidate message configuration; in response to determining based on the message processing conditions that the target message corresponding to the message content is allowed to be processed, generating the target message based on the message content, may include: for each target message configuration, in response to determining based on the message processing conditions in the target message configuration that the target message corresponding to the message content in the target message configuration is allowed to be processed, generating the target message based on the message content in the target message configuration. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.
[0082] See also Figure 4 The method of this embodiment may specifically include the following steps:
[0083] S310. In response to a message processing instruction, obtain a message scenario type, and determine at least one target message configuration matching the message scenario type from pre-configured candidate message configurations, wherein the target message configuration includes a message processing condition and a message content.
[0084] The message scenario type may be the type of the message scenario in which the target message to be processed is located, such as order payment, doctor consultation, and doctor prescription, etc. Since the candidate message configurations contain information related to the message scenario type, and there may be at least one message configuration corresponding to the same message scenario type in the candidate message configurations, such as doctor consultation may correspond to a precaution message configuration and a greeting message configuration, at least one target message configuration may be determined from the candidate message configurations based on the message scenario type.
[0085] S320. For each target message configuration, in response to determining based on the message processing conditions in the target message configuration that processing of the target message corresponding to the message content in the target message configuration is allowed, generate a target message based on the message content in the target message configuration.
[0086] This step is performed for each target message configuration. In practical applications, optionally, the at least one target message configuration can be processed by a multi-threaded processing method based on a thread pool, thereby improving message processing performance and further improving message processing efficiency.
[0087] S330: Process the generated target message.
[0088] The technical solution of the embodiment of the present invention determines at least one target message configuration from candidate message configurations by acquiring the message scenario type, and then performs corresponding operations on each target message configuration, thereby ensuring rapid determination and effective processing of the target message configuration.
[0089] On this basis, an optional technical solution obtains the message scenario type and determines at least one target message configuration that matches the message scenario type from pre-configured candidate message configurations, including: obtaining an event message and parsing the event message to obtain the message scenario type, scenario trigger time, event sending time and task identifier; verifying whether the event message has timed out according to the scenario trigger time and event sending time; in response to the event message not having timed out, obtaining a task status corresponding to the task identifier, and when it is determined that the target task corresponding to the event message is valid according to the task status, determining at least one target message configuration that matches the message scenario type from the pre-configured candidate message configurations.
[0090] Among them, the event message can be a message of a scenario event generated by a certain business system. The obtained event message is parsed to obtain the message scenario type, scenario trigger time, event sending time and task identifier. The scenario trigger time can be the time when the message scenario is triggered; the event sending time can be the time when the scenario event is sent to a certain object, and the certain object can be the object that generates the event message. In practical applications, it can be represented by a message queue; the task identifier can be the identifier of the target task corresponding to the target message. For example, when the target message is an order payment message, the target task can be an order payment task. It should be noted that the target task can also be understood as a task corresponding to the event message, because the target message configuration of the target message is also determined according to the message scenario type obtained after parsing the event message. Verify whether the event message is timed out according to the scenario trigger time and event sending time. There is no need to process the event message that has timed out (to be precise, the target message corresponding to the event message that has timed out). If it has not timed out, the task state corresponding to the task identifier can be further obtained, that is, the task state of the target task, and then the validity of the target task is determined. Since the corresponding target message needs to be processed only when the target task is valid, at least one target message configuration can be determined from the candidate message configurations according to the message scenario type when the target task is valid, thereby ensuring that the subsequently generated target message is a message that needs to be processed, thereby avoiding invalid operations.
[0091] In order to understand the above technical solution more vividly, the following will continue to use the application scenario of the Internet hospital described in the background technology as an example to illustrate it. Figure 5 As shown, the message service consumes the event message in the message queue (Message Queue, MQ). In actual applications, optionally, the consumption here can be set to the response mode, that is, when the subsequent verification and sending business is completed, the MQ success result is returned. If the processing fails or is abnormal, it can be consumed again, ensuring the reliability of message processing. Then, the event message is parsed to obtain the order basic data (such as order number and order type, etc., where the order number can be understood as the task identifier mentioned above) and event information (such as message scenario type, scenario trigger time and event sending time, etc.). Then, according to the scenario trigger time and event sending time, verify whether the event message is timed out. If it is timed out, send an alarm email and discard the event message, otherwise execute the following steps. The order service is remotely called by the order number to obtain the order details, and then the order validity is verified by the order status in the order details (that is, the task status mentioned above). If the order status is checked to be timed out and not paid or has ended, the order (that is, the order payment task) can be considered invalid, and there is no need to continue the subsequent message sending logic, otherwise execute the following steps. Match the target message configuration according to the message scenario type.
[0092] In order to better understand the above technical solutions as a whole, the following is an exemplary description of them in combination with specific examples. Figure 6 , here, taking the sending of system messages in IM sessions as described in the background technology as an example, the above message sending method can be applied to a message system, in which a message sending executor, an expression executor, a remote call executor and a configuration center client are provided, and a combined message configuration is stored in the local cache of the message system. In addition, the configuration personnel can make changes (such as adding, modifying and deleting) to the system message configuration and data source configuration stored in the configuration center server corresponding to the configuration center client, and the flexibility and timeliness of the configuration changes are better. Specifically,
[0093] When the message system is started, the built-in configuration center client obtains the latest system message configuration and data source configuration in the configuration center server in real time, pulls them locally, and stores the obtained combined message configuration in the local cache of the message system after parsing, so that the subsequent message system can independently execute the sending task based on the combined message configuration in the local cache. In actual applications, the configuration center can be used to uniformly manage all configurations, parameters, switches, etc. in the project, and provide a set of standard interfaces. When each service needs to obtain the configuration in the configuration center, it can be pulled through this interface. Moreover, when the configuration in the configuration center is updated, it can also notify each service in real time to synchronize the latest configuration, thereby achieving the effect of dynamic configuration update.
[0094] Scenario events (or event messages corresponding to scenario events) generated by other business systems are sent to the message queue. The message system consumes the event messages in the message queue in real time, and then matches them to the corresponding combined message configuration in the local cache based on the message scenario type obtained after parsing the event message.
[0095] Parse the combined message configuration, and then use the remote call executor to obtain the condition data and content data based on the parsing results. Then use the expression executor to verify the message sending condition expression based on the condition data. If the verification passes, use the expression executor to generate a system message with the obtained content data and the message content template in the combined message configuration, and send the system message.
[0096] On this basis, in order to ensure the reliability of message processing, the ACK mechanism can be enabled when consuming the message queue, that is, if the current consumption process fails, it can be consumed again. In addition, since the message system is usually a distributed architecture, for the distributed architecture, in order to solve the concurrency problem of message processing in a multi-threaded processing environment, a distributed lock can be added to the group message object before processing. In actual applications, a distributed lock based on cache (Redis) can be optionally used, which helps to reduce system complexity, improve system performance and ensure system stability and reliability.
[0097] Based on the above exemplary descriptions, in order to more vividly understand the sending process of the system message after the above dynamic configuration, the following will continue to illustrate it with specific examples. Figure 7 , according to the message scenario type matching, the combined message configuration in the local cache is obtained, and the combined message configuration is parsed to obtain the conditional data source configuration and the content data source configuration. For example, the following is an example of a conditional data source configuration, which includes three conditional data source configurations for obtaining order information (order), obtaining referral information (transfer), and obtaining prescription information (prescribe). Name represents the conditional data source name, DataUrl represents the conditional data source request link, and RequestParams represents the conditional data source request parameters.
[0098]
[0099] Further, according to the conditional data source configuration, remote calls are made to obtain conditional data, such as the payment status (order.payStatus) and order type (order.orderType) under the order information corresponding to the order id, the referral status (transfer.status) under the referral information, and the prescription status (prescribe.status) under the prescription information. Then, based on the expression executor, the conditional data is used to verify whether the message sending condition expression in the combined message configuration is established. If not, no subsequent logical processing (i.e., exit) is performed, otherwise, the following steps are continued. Based on the content data source configuration, the corresponding content data is obtained from the cached conditional data, and it is determined whether the obtained content data contains all the content data required in the message content template. If so, the content data can be obtained from the conditional data; otherwise, the content data is obtained based on the content data source configuration. Finally, a system message is constructed based on the content data and the message content template, and the system message is sent.
[0100] The above technical solution combines static configuration (i.e., message sending conditional expression and message content template) with dynamic configuration (i.e., data source configuration), and utilizes local multi-dimensional cache (i.e., local cache of combined message configuration and local cache of conditional data) to effectively realize dynamic message configuration. In addition, the system message configuration and data source configuration are isolated, and then the combination of the two is realized through a custom configuration protocol (i.e., custom conditional data source configuration in the message sending conditional expression) and an expression processor, thereby realizing real-time parsing operations and efficiently and dynamically verifying the effect of the message sending conditional expression.
[0101] Figure 8 This is a structural block diagram of a message processing device provided in an embodiment of the present invention. The device is used to execute the message processing method provided in any of the above embodiments. The device and the message processing method of each of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the message processing device, refer to the embodiment of the above message processing method. Figure 8 The device may specifically include: a target message configuration obtaining module 410, a target message generating module 420 and a target message processing module 430. Among them,
[0102] The target message configuration obtaining module 410 is used to obtain the target message configuration from the pre-configured candidate message configurations in response to the message processing instruction, wherein the target message configuration includes the message processing conditions and the message content;
[0103] A target message generating module 420, configured to generate a target message based on the message content in response to determining that the target message corresponding to the message content is allowed to be processed based on the message processing condition;
[0104] The target message processing module 430 is used to process the generated target message.
[0105] Optionally, the target message configuration further includes a conditional data source configuration corresponding to the message processing condition and a content data source configuration corresponding to the message content. The message processing device may further include:
[0106] The message processing condition verification module is used to obtain condition data based on the condition data source configuration, and verify whether the message processing condition is established based on the condition data to determine whether the target message is allowed to be processed;
[0107] The target message generation module 420 may include:
[0108] The target message generating unit is used to obtain content data corresponding to the content data source configuration, and generate a target message based on the message content and the content data.
[0109] On this basis, optionally, the conditional data source configuration includes a data source request link and a data source request parameter; the message processing condition verification module may include:
[0110] The conditional data acquisition unit is used to call the data source request service corresponding to the data source request link based on the data source request parameters to acquire the conditional data.
[0111] Optionally, the target message generating unit may include:
[0112] a first content data acquisition subunit, configured to acquire content data from the condition data in response to the acquired condition data including content data corresponding to the content data source configuration;
[0113] The second content data acquisition subunit is configured to acquire the content data based on the content data source configuration in response to the fact that the acquired condition data does not include the content data.
[0114] Optionally, the target message configuration is pre-configured by the following modules:
[0115] A changed message configuration acquisition module, used to respond to the message configuration change instruction and acquire the changed message configuration; wherein the changed message configuration includes a message processing condition and a message content, the message processing condition includes a condition data source identifier, and the message content includes a content data source identifier;
[0116] A data source configuration determination module, used to determine a conditional data source configuration corresponding to the conditional data source identifier and a content data source configuration corresponding to the content data source identifier from pre-configured data source configurations;
[0117] The configuration combination module is used to combine the changed message configuration, the conditional data source configuration and the content data source configuration to obtain the target message configuration.
[0118] Optionally, the target message configuration obtaining module 410 may include:
[0119] A target message configuration determining unit, configured to obtain a message scenario type and determine at least one target message configuration matching the message scenario type from pre-configured candidate message configurations;
[0120] The target message generation module 420 may be specifically used for:
[0121] For each target message configuration, in response to determining based on the message processing conditions in the target message configuration that processing of the target message corresponding to the message content in the target message configuration is permitted, a target message is generated based on the message content in the target message configuration.
[0122] On this basis, optionally, the target message configuration determining unit may be specifically used to:
[0123] Obtain event messages and parse them to obtain message scenario type, scenario triggering time, event sending time, and task identifier;
[0124] Verify whether the event message has timed out based on the scene trigger time and event sending time;
[0125] In response to the event message not timing out, a task status corresponding to the task identifier is obtained, and when it is determined according to the task status that the target task corresponding to the event message is valid, at least one target message configuration matching the message scenario type is determined from pre-configured candidate message configurations.
[0126] The message processing device provided by the embodiment of the present invention determines the target message configuration by obtaining a module through the target message configuration in response to the message processing instruction. The target message configuration may be a configuration including message processing conditions and message content determined from the candidate message configuration obtained in advance; further, through the cooperation between the target message generation module and the target message processing module, in response to determining based on the message processing conditions that the target message corresponding to the message content is allowed to be processed, the target message may be first generated based on the message content, and then the generated target message may be processed. In the above device, since various messages are obtained through dynamic configuration rather than being directly written in the message processing code logic, this means that the message change process can be realized by changing the corresponding message configuration without changing the developed message processing code logic, thereby achieving the effect of realizing the processing process of the changed message (here taking the target message as the changed message as an example) at a lower development cost.
[0127] The message processing device provided in the embodiment of the present invention can execute the message processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0128] It is worth noting that in the embodiment of the above-mentioned message processing device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0129] Fig. 9A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0130] like Fig. 9 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0131] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0132] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a message processing method.
[0133] In some embodiments, the message processing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the message processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the message processing method in any other appropriate manner (e.g., by means of firmware).
[0134] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0135] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0136] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0137] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0138] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by 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), a blockchain network, and the Internet.
[0139] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0140] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0141] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A message processing method, characterized in that: include: In response to the message processing instruction, a target message configuration is obtained from pre-configured candidate message configurations, wherein the target message configuration includes a message processing condition and a message content; In response to determining that processing of the target message corresponding to the message content is allowed based on the message processing condition, generating the target message based on the message content; Processing the generated target message; The target message configuration also includes a conditional data source configuration corresponding to the message processing condition and a content data source configuration corresponding to the message content. The method also includes: Acquiring conditional data based on the conditional data source configuration, and verifying whether the message processing condition is satisfied based on the conditional data to determine whether processing of the target message is allowed; The generating the target message based on the message content includes: Content data corresponding to the content data source configuration is acquired, and the target message is generated based on the message content and the content data.
2. The method according to claim 1, characterized in that: The conditional data source configuration includes a data source request link and a data source request parameter; The acquiring of conditional data based on the conditional data source configuration includes: Based on the data source request parameters, a data source request service corresponding to the data source request link is called to obtain conditional data.
3. The method according to claim 1, characterized in that The acquiring of content data corresponding to the content data source configuration includes: In response to the acquired condition data including content data corresponding to the content data source configuration, acquiring the content data from the condition data; In response to the acquired condition data not including the content data, acquiring the content data based on the content data source configuration.
4. The method according to claim 1, characterized in that: The target message configuration is pre-configured by the following steps: In response to the message configuration change instruction, obtaining a changed message configuration; wherein the changed message configuration includes the message processing condition and the message content, the message processing condition includes a condition data source identifier, and the message content includes a content data source identifier; Determine the conditional data source configuration corresponding to the conditional data source identifier and the content data source configuration corresponding to the content data source identifier from pre-configured data source configurations; The changed message configuration, the conditional data source configuration and the content data source configuration are combined to obtain the target message configuration.
5. The method according to claim 1, characterized in that Obtaining the target message configuration from the pre-configured candidate message configurations includes: Acquire a message scenario type, and determine at least one target message configuration matching the message scenario type from pre-configured candidate message configurations; In response to determining based on the message processing condition that the target message corresponding to the message content is allowed to be processed, generating the target message based on the message content includes: For each of the target message configurations, in response to determining based on the message processing conditions in the target message configuration that processing of the target message corresponding to the message content in the target message configuration is allowed, the target message is generated based on the message content in the target message configuration.
6. The method according to claim 5, characterized in that The acquiring of the message scenario type and determining at least one target message configuration matching the message scenario type from pre-configured candidate message configurations includes: Obtain an event message, and parse the event message to obtain the message scenario type, scenario triggering time, event sending time, and task identifier; Verify whether the event message has timed out according to the scene triggering time and the event sending time; In response to the event message not timing out, a task status corresponding to the task identifier is obtained, and when it is determined that the target task corresponding to the event message is valid based on the task status, at least one target message configuration matching the message scenario type is determined from pre-configured candidate message configurations.
7. A message processing device, characterized in that: include: A target message configuration obtaining module, used to obtain a target message configuration from pre-configured candidate message configurations in response to a message processing instruction, wherein the target message configuration includes a message processing condition and a message content; A target message generating module, configured to generate the target message based on the message content in response to determining that the target message corresponding to the message content is allowed to be processed based on the message processing condition; A target message processing module, used for processing the generated target message; The target message configuration also includes a conditional data source configuration corresponding to the message processing condition and a content data source configuration corresponding to the message content. The message processing device also includes: A message processing condition verification module, configured to obtain condition data based on the condition data source configuration, and verify whether the message processing condition is satisfied based on the condition data, so as to determine whether the target message is allowed to be processed; The target message generating module comprises: The target message generating unit is used to obtain content data corresponding to the content data source configuration, and generate the target message based on the message content and the content data.
8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor executes the message processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the message processing method according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Data visualization method and device, electronic equipment and computer readable storage medium
CN110618814A
Intelligent display system and method for resource management information of image department
CN111028928A
Message pushing method and device, storage medium and control terminal
CN112583694A