CN112968825B - Message sending method, device, equipment and storage medium - Google Patents

Message sending method, device, equipment and storage medium Download PDF

Info

Publication number
CN112968825B
CN112968825B CN202110126768.3A CN202110126768A CN112968825B CN 112968825 B CN112968825 B CN 112968825B CN 202110126768 A CN202110126768 A CN 202110126768A CN 112968825 B CN112968825 B CN 112968825B
Authority
CN
China
Prior art keywords
rule
message
matched
sent
matching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110126768.3A
Other languages
Chinese (zh)
Other versions
CN112968825A (en
Inventor
刘庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202110126768.3A priority Critical patent/CN112968825B/en
Publication of CN112968825A publication Critical patent/CN112968825A/en
Application granted granted Critical
Publication of CN112968825B publication Critical patent/CN112968825B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/212Monitoring or handling of messages using filtering or selective blocking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9035Filtering based on additional data, e.g. user or group profiles

Abstract

The present disclosure provides a message sending method, device, equipment and storage medium, where the method includes: firstly, obtaining a message to be sent carrying a message sending rule, determining a target client of the message to be sent, then matching the information of the target client with the message sending rule to obtain a matching result, and finally determining whether to send the message to be sent to the target client or not based on the matching result. The message sending rule is encapsulated in each message, and the message filtering function is realized by matching the information of the target client with the message sending rule in the message. Compared with the prior art, the embodiment of the disclosure does not need to call the rule filtering engine, so that the CPU computing resource consumption is reduced, and the system performance is improved.

Description

Message sending method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing, and in particular, to a method, an apparatus, a device, and a storage medium for sending a message.
Background
With the continuous development of computer technology, the development requirements of application programs are more and more diversified. For example, in a live APP, in order to guarantee the operation efficiency of the live APP, messages that require a large amount of computing resources to be presented at a client are generally limited to being received at a client with a higher configuration, while messages of this type are not presented at a client with a lower configuration.
For another example, the same live room in the live APP may be played simultaneously on multiple platforms, such as on multiple ends of the PC, an Zhuoduan, IOS, etc., but due to the differences of the platforms, some messages in the live room are not applicable to some of the platforms.
To reduce bandwidth usage during messaging, messages that cannot be presented to a lower configured client, as well as messages that are not applicable to certain platforms, may be filtered out before being sent to the client.
Currently, a rule filtering engine is typically invoked to filter messages before they are sent to clients to determine whether the messages meet the requirements for sending to the target client. However, filtering messages using a rule filtering engine consumes significant CPU computing resources and has an impact on system performance.
Disclosure of Invention
In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, an apparatus, a device, and a storage medium for message sending, which can encapsulate a message sending rule in each message, and implement a message filtering function by matching information of a target client with the message sending rule in the message, without calling a rule filtering engine, thereby reducing CPU computing resource consumption and improving system performance.
In a first aspect, the present disclosure provides a message sending method, the method including:
acquiring a message to be transmitted carrying a message transmission rule; the message sending rule is used for indicating the sending condition of the message to be sent;
determining a target client of the message to be sent, and matching the information of the target client with the message sending rule to obtain a matching result;
and determining whether to send the message to be sent to the target client based on the matching result.
Optionally, the message sending rule includes at least one rule to be matched, and the rule to be matched includes a rule type, a rule parameter and a rule parameter value;
the step of matching the information of the target client with the message sending rule to obtain a matching result comprises the following steps:
acquiring a parameter value corresponding to the rule parameter in the rule to be matched included in the message sending rule in the information of the target client;
determining a rule matching method corresponding to the rule type in the rules to be matched;
based on the rule matching method, matching the parameter value with the rule parameter value in the rule to be matched to obtain a matching result corresponding to the rule to be matched;
and determining a matching result corresponding to the message sending rule based on the matching results respectively corresponding to the at least one rule to be matched.
Optionally, the rule matching method includes a parameter type and matching logic; the parameter type comprises a number type, a character string type, a number binary group type, a number list type or a character string list type;
the matching logic includes: if the parameter value is determined to be in accordance with the rule parameter value in the rule to be matched, determining that the matching result corresponding to the rule to be matched is successful, otherwise, determining that the matching result corresponding to the rule to be matched is failed; wherein the parameter value belongs to the parameter type included in the rule matching method;
alternatively, the matching logic includes: if the parameter value is determined not to be in accordance with the rule parameter value in the rule to be matched, determining that the matching result corresponding to the rule to be matched is successful, otherwise, determining that the matching result corresponding to the rule to be matched is failed; wherein the parameter value belongs to the parameter type included in the rule matching method.
Optionally, the message sending rule further includes an negation rule; the determining the matching result corresponding to the message sending rule based on the matching results respectively corresponding to the at least one rule to be matched comprises the following steps:
determining an initial matching result based on matching results respectively corresponding to the at least one rule to be matched;
and inverting the initial matching result based on the inverting rule to obtain a matching result corresponding to the message sending rule.
Optionally, the obtaining the message to be sent carrying the message sending rule includes:
responding to a message request from a communication connection client, and acquiring a message to be sent corresponding to the message request; the message to be sent carries a message sending rule, and the message request carries information of the communication connection client;
the determining the target client of the message to be sent comprises the following steps:
and determining the client of the communication connection as the target client of the message to be sent.
Optionally, before obtaining the message to be sent carrying the message sending rule, the method further includes:
determining a message sending rule corresponding to a message to be sent based on the message type of the message to be sent;
and encapsulating the message sending rule in the message to be sent.
In a second aspect, the present disclosure provides a message sending apparatus, the apparatus comprising:
the acquisition module is used for acquiring the message to be transmitted carrying the message transmission rule; the message sending rule is used for indicating the sending condition of the message to be sent;
a first determining module, configured to determine a target client of the message to be sent;
the matching module is used for matching the information of the target client with the message sending rule to obtain a matching result;
and the second determining module is used for determining whether to send the message to be sent to the target client or not based on the matching result.
In a third aspect, the present disclosure provides a computer readable storage medium having instructions stored therein, which when run on a terminal device, cause the terminal device to implement the above-described method.
In a fourth aspect, the present disclosure provides a computing device comprising: the computer program comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the method when executing the computer program.
In a fifth aspect, the present disclosure provides a computer program product comprising computer programs/instructions which when executed by a processor implement the above-described method.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has at least the following advantages:
the embodiment of the disclosure provides a message sending method, which comprises the steps of firstly, obtaining a message to be sent carrying a message sending rule, determining a target client of the message to be sent, then matching the information of the target client with the message sending rule to obtain a matching result, and finally, determining whether the message to be sent is sent to the target client or not based on the matching result. The message sending rule is encapsulated in each message, and the message filtering function is realized by matching the information of the target client with the message sending rule in the message. Compared with the prior art, the embodiment of the disclosure does not need to call the rule filtering engine, so that the CPU computing resource consumption is reduced, and the system performance is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments of the present disclosure or the solutions in the prior art, the drawings that are required for the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a flowchart of a message sending method provided in an embodiment of the present disclosure;
fig. 2 is a flowchart of a matching method of a message sending rule according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a message sending device according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a message sending device according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, a further description of aspects of the present disclosure will be provided below. It should be noted that, without conflict, the embodiments of the present disclosure and features in the embodiments may be combined with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced otherwise than as described herein; it will be apparent that the embodiments in the specification are only some, but not all, embodiments of the disclosure.
During the running of an application, there may be a need to send differently for the same message transmitted by the server to the client. For example, it is allowed to send to a client with a higher configuration but not to a client with a lower configuration for the same message. For another example, for some messages that are applicable to a particular platform (e.g., PC side, etc.) but not to other platforms (e.g., an Zhuoduan, IOS side, etc.), the message may be sent to only the applicable platform and not to the other platforms in order to conserve bandwidth.
Aiming at the requirements, the message is filtered by calling a rule filtering engine at present, so that the message is sent in a distinguishing way. However, the filtering process of the message by calling the rule filtering engine consumes a large amount of CPU computing resources, which results in an impact on system performance.
The present disclosure provides a message sending method, firstly, obtaining a message to be sent carrying a message sending rule, determining a target client of the message to be sent, then matching the information of the target client with the message sending rule to obtain a matching result, and finally, determining whether to send the message to be sent to the target client based on the matching result.
The message sending rule is encapsulated in each message, and the message filtering function is realized by matching the information of the target client with the message sending rule in the message. Compared with the prior art, the embodiment of the disclosure does not need to call the rule filtering engine, so that the CPU computing resource consumption is reduced, and the system performance is improved.
Based on this, an embodiment of the present disclosure provides a message sending method, referring to fig. 1, which is a flowchart of the message sending method provided by the embodiment of the present disclosure, where the method includes:
s101: acquiring a message to be transmitted carrying a message transmission rule; the message sending rule is used for indicating the sending condition of the message to be sent.
In the embodiment of the disclosure, a message sending rule for representing a message sending condition is pre-packaged in a message to be sent, so as to realize a filtering function of the message to be sent.
In an alternative embodiment, after determining the message to be sent, a message sending rule is constructed for the message to be sent, and then the message sending rule is encapsulated in a message header of the message to be sent, so as to obtain the message to be sent carrying the message sending rule.
In another alternative embodiment, the message sending rule corresponding to the message to be sent may be determined based on the message type of the message to be sent, and then the message sending rule is encapsulated in the message header of the message to be sent, so as to obtain the message to be sent carrying the message sending rule.
The corresponding relation between the message type and the message sending rule is established in advance, and after the message type is determined, the message sending rule corresponding to the message type can be determined based on the corresponding relation.
Specifically, the message type may be used to identify the platform type to which the message is applicable, e.g., the message type is a message applicable to the PC side, a message applicable to An Zhuoduan, a message applicable to the iOS side, etc. The message type may also be used to identify the client configuration to which the message applies, such as a message type being one that applies to clients with a high configuration, etc.
In practical application, the message to be sent carrying the message sending rule can be obtained from the message storage server, and the filtering function of the message to be sent is subsequently realized. Wherein the message storage server may be used to store messages to be sent.
In an alternative embodiment, after receiving a message request of any client, a message to be sent corresponding to the message request is obtained from a message storage server, so as to determine whether to send the message to be sent to the client later.
In another alternative embodiment, after receiving the instruction for actively issuing the message, the message to be sent is obtained from the message storage server, so as to determine whether to issue the message to be sent to the target client.
S102: and determining the target client of the message to be sent, and matching the information of the target client with the message sending rule to obtain a matching result.
In the embodiment of the disclosure, after determining the message to be sent, the target client of the message to be sent is further determined, and related information of the target client is obtained, so as to determine whether to send the message to be sent to the target client later.
In an optional implementation manner, in response to a message request from any client, a message to be sent corresponding to the message request is obtained, the client is determined to be a target client of the message to be sent, and information of the target client is obtained from the message request and is used for matching with a message sending rule carried by the message to be sent, so that whether the message to be sent is sent to the target client is determined.
In another alternative embodiment, after receiving an instruction actively issued by a message, after acquiring the message to be sent from a message storage server, determining a target client of the message to be sent, and then acquiring information of the target client from pre-stored client information, wherein the information is used for matching with a message sending rule carried by the message to be sent, so as to determine whether to send the message to be sent to the target client.
In the embodiment of the disclosure, the message sending rule includes at least one rule to be matched, and the rule to be matched may include a rule type, a rule parameter and a rule parameter value. After the message to be sent is obtained, the message sending rule is obtained by analyzing the message to be sent, and rule parameters are determined from the message sending rule, so that parameter values for rule matching in the information of the target client are obtained based on the rule parameters. The matching method for a specific message sending rule is described later.
S103: and determining whether to send the message to be sent to the target client based on the matching result.
In the embodiment of the disclosure, after matching information of a target client with a message sending rule of a message to be sent to obtain a matching result, whether the message to be sent is sent to the target client is determined based on the matching result.
Specifically, if the matching result is that the information of the target client is successfully matched with the message sending rule, the message to be sent can be sent to the target client, otherwise, the message to be sent can be filtered, and the message to be sent is stopped being sent to the target client.
In the message sending method provided by the embodiment of the disclosure, firstly, a message to be sent carrying a message sending rule is obtained, a target client of the message to be sent is determined, then the information of the target client is matched with the message sending rule to obtain a matching result, and finally, whether the message to be sent is sent to the target client is determined based on the matching result.
According to the embodiment of the disclosure, the message sending rule is encapsulated in each message, and the message filtering function is realized by matching the information of the target client with the message sending rule in the message. Compared with the prior art, the embodiment of the disclosure does not need to call the rule filtering engine, so that the CPU computing resource consumption is reduced, and the system performance is improved.
Based on the foregoing embodiments, the message sending rule in the embodiments of the present disclosure may include at least one rule to be matched, where each rule to be matched may include a rule type, a rule parameter, and a rule parameter value.
In an alternative embodiment, the messaging rules may include the following rules to be matched
Figure BDA0002924275130000081
The rule Key represents rule parameters in the rule to be matched, the rule value represents rule parameter values in the rule to be matched, and the rule type represents rule types in the rule to be matched. Rule Key is AppVersion, rule value is 300,400, rule type is Filter rule type, rule type is INTUPLE, and rule Key is AppVersion, rule value is APP version number, rule value is 300,400, rule parameter value is in the numerical range of 300-400, namely, APP version number is version number of 300-400, rule type is Filter rule type.
And judging whether the APP version number of the target client is 300-400 based on a rule matching method corresponding to the rule type Filter rule type INTINULE to obtain a matching result of the rule to be matched.
On the basis of the introduction of the rule to be matched, the present disclosure provides a method for matching a message sending rule, and referring to fig. 2, a flowchart of a method for matching a message sending rule is provided for an embodiment of the present disclosure, where the message sending rule includes at least one rule to be matched, and the rule to be matched includes a rule type, a rule parameter, and a rule parameter value. Specifically, the method comprises the following steps:
s201: and acquiring a parameter value corresponding to a rule parameter in the rule to be matched included in the message sending rule in the information of the target client.
In the embodiment of the disclosure, after determining a target client and a message to be sent carrying a message sending rule, a parameter value corresponding to a rule parameter in the rule to be matched in the information of the target client is first obtained and used for matching with the rule.
Taking rule A to be matched as an example, rule parameters in rule A are "AppVersion", namely APP version numbers, therefore, the embodiment of the disclosure obtains the APP version numbers of the target clients so as to match the APP version numbers of the target clients with rule parameter values "300,400" in rule A, and obtain a matching result.
S202: determining a rule matching method corresponding to the rule type in the rules to be matched;
s203: and based on the rule matching method, matching the parameter value with the rule parameter value in the rule to be matched to obtain a matching result corresponding to the rule to be matched.
Specifically, after obtaining a parameter value corresponding to a rule parameter in a rule to be matched in the information of the target client, determining a rule type in the rule to be matched, and then invoking a rule matching method corresponding to the rule type to match the parameter value with the rule parameter value in the rule to be matched, so as to finally obtain a matching result corresponding to the rule to be matched.
In the embodiment of the disclosure, the corresponding relation between the rule type and the rule matching method is preset, and the corresponding rule matching method can be called through the rule type. Taking rule A to be matched as an example, if the rule type in rule A is Filter rule type, and calling a rule matching method corresponding to Filter rule type, and matching the APP version number of the target client with rule parameter values 300 and 400 in rule A to obtain a matching result. The rule matching method corresponding to the FilterRuleType is used for determining a matching result of the rule to be matched by judging whether the APP version number of the target client is a digital binary group type or not and is in a numerical range of 300-400.
S204: and determining a matching result corresponding to the message sending rule based on the matching results respectively corresponding to the at least one rule to be matched.
In the embodiment of the disclosure, after obtaining the matching results corresponding to each rule to be matched in the message sending rules, the matching results corresponding to the message sending rules are determined by integrating the matching results.
In an optional implementation manner, when the matching result corresponding to each rule to be matched in the message sending rule is successful, determining that the matching result corresponding to the message sending rule is successful.
In the embodiment of the disclosure, the rule to be matched is designed to be a structure comprising the rule type, the rule parameter and the corresponding relation of the rule parameter value, so that the coverage of various rules can be realized based on limited rule types, the rule management is convenient, and the threshold of rule configuration is reduced.
In an alternative embodiment, a rule matching method includes a parameter type and matching logic; the parameter type comprises a number type, a character string type, a number binary group type, a number list type or a character string list type;
wherein the matching logic comprises: if the parameter value is determined to be in accordance with the rule parameter value in the rule to be matched, determining that the matching result corresponding to the rule to be matched is successful, otherwise, determining that the matching result corresponding to the rule to be matched is failed; wherein the parameter value belongs to the parameter type included in the rule matching method;
alternatively, the matching logic includes: if the parameter value is determined not to be in accordance with the rule parameter value in the rule to be matched, determining that the matching result corresponding to the rule to be matched is successful, otherwise, determining that the matching result corresponding to the rule to be matched is failed; wherein the parameter value belongs to the parameter type included in the rule matching method.
In addition, the message sending rule may also include an negation rule; specifically, firstly, determining an initial matching result based on matching results respectively corresponding to the at least one rule to be matched; and then, inverting the initial matching result based on the inverting rule to obtain a matching result corresponding to the message sending rule.
Taking the implementation manner of the following rule matching method as an example, the definition of various message sending rules can be realized based on the following message matching methods respectively corresponding to 8 message types, and the definition is specific:
a field may be added to the header of the message to be sent for defining the data format of the message sending rule as follows:
enum FilterRuleType{
numequal=1,// where rule value is defined as a digital type and the parameters to be matched need to be equal to rule value
Stream=2,// where rule value is defined as the string type and the parameters to be matched need to be equal to rule value
Intupele=3,// where rule value is defined as a digital tuple type (representing an interval) and the parameters to be matched are within the tuple range corresponding to rule value
INNUMLIST=4,// where rule value is defined as a numeric list type and the parameters to be matched are in the list corresponding to rule value
Notinumlist=5,// where rule value is defined as a numeric list type and the parameters to be matched are not in the list corresponding to rule value
INSTRLIST =6,// where rule value is defined as a type of list and the parameters to be matched are in the list corresponding to rule value
Notinstrlist=7,// where rule value is defined as a list of list types and the parameters to be matched are not in the list corresponding to rule value
Isoposite=8,// where the current matching result is defined and is false, if the result calculated according to the remaining 7 pieces is true, the current matching result is false after matching by the rule
Figure BDA0002924275130000111
Figure BDA0002924275130000121
Assuming that only clients requiring a specific AppID for the message to be sent can receive, the message sending rules can be constructed as follows:
Figure BDA0002924275130000122
the message sending rule only comprises one rule to be matched, and the rule to be matched is used for determining that the client of appid=1128 or 1112 receives the message to be sent.
Assuming that only clients requiring a specific DeviceID for a message to be sent cannot receive, the message sending rules may be constructed as follows:
Figure BDA0002924275130000123
the message sending rule only includes one rule to be matched, and the rule to be matched is used for determining that the client of deviceid= 63424223 or 53464654 cannot receive the message to be sent.
In addition, the embodiment of the disclosure may further construct a message sending rule including a plurality of rules to be matched, where each rule to be matched is in a relationship with each other, that is, each rule to be matched is successfully matched, and the message sending rule is successfully matched, where the message sending rule is as follows:
Figure BDA0002924275130000124
/>
Figure BDA0002924275130000131
before matching to the rule, the target client that matches to the rule a and rule b is (appid=1128 or 1112) and (DeviceID is not 63424223 or 53464654) may receive the message to be sent corresponding to the message sending rule, and the client that does not meet the logic condition may not receive the message to be sent.
However, after matching with a rulec, the result obtained is that the current matching result is inverted, that is, the target client (appid=1128 or 1112) and (DeviceID is not 63424223 or 53464654) cannot receive the message to be sent corresponding to the message sending rule, and the client not meeting the logic condition can receive the message to be sent.
For the above 8 message types, how to implement message sending rule matching, the embodiments of the present disclosure provide the following manner, in particular:
in an optional implementation manner, for the message type with numequal=1, a rule matching method corresponding to the rule type in the rule to be matched may be invoked, and whether the parameter value obtained from the target client accords with the rule parameter value in the rule to be matched is determined, so as to obtain a matching result corresponding to the rule to be matched. Wherein the parameter value is of the digital type.
In an optional implementation manner, for the message type of the stream=2, a rule matching method corresponding to a rule type in the rule to be matched may be invoked, and whether the parameter value obtained from the target client does not conform to the rule parameter value in the rule to be matched is determined, so as to obtain a matching result corresponding to the rule to be matched; wherein the parameter value belongs to the character string type.
In an optional implementation manner, for the message type of intupele=3, a rule matching method corresponding to a rule type in the rules to be matched may be invoked, and whether the parameter value obtained from the target client accords with a numerical range corresponding to a rule parameter value in the rules to be matched is determined, so as to obtain a matching result corresponding to the rules to be matched; wherein the parameter value belongs to the digital binary group type.
In an optional implementation manner, for the message type of innumlist=4, a rule matching method corresponding to a rule type in the rules to be matched may be invoked, and whether the parameter value obtained from the target client accords with a numerical range corresponding to a rule parameter value in the rules to be matched is determined, so as to obtain a matching result corresponding to the rules to be matched; wherein the parameter value is of the digital type.
In an optional implementation manner, for the message type of notinumlist=5, a rule matching method corresponding to the rule type in the rule to be matched may be invoked, and whether the parameter value obtained from the target client does not conform to the numerical range corresponding to the rule parameter value in the rule to be matched is determined, so as to obtain a matching result corresponding to the rule to be matched; wherein the parameter value is of the digital type.
In an optional implementation manner, for the message type INSTRLIST =6, a rule matching method corresponding to the rule type in the rule to be matched may be invoked, and whether the parameter value obtained from the target client accords with the character string range corresponding to the rule parameter value in the rule to be matched is determined, so as to obtain a matching result corresponding to the rule to be matched; wherein the parameter value belongs to the character string type.
In an optional implementation manner, for the message type of notinstrilist=7, a rule matching method corresponding to the rule type in the rule to be matched may be invoked, and whether the parameter value obtained from the target client does not conform to the string range corresponding to the rule parameter value in the rule to be matched is determined, so as to obtain a matching result corresponding to the rule to be matched; wherein the parameter value belongs to the character string type.
In an optional implementation manner, the message sending rule may further include an inverse rule, taking an inverse rule corresponding to a message type with isoposite=8 as an example, and for the message type with isoposite=8, a rule matching method corresponding to a rule type in the rules to be matched may be invoked, and a matching result determined by the rules to be matched is inverted, so as to obtain a matching result corresponding to the rules to be matched.
Specifically, firstly, determining an initial matching result based on matching results respectively corresponding to the at least one rule to be matched, and then inverting the initial matching result based on the inverting rule to obtain a matching result corresponding to the message sending rule.
In the embodiment of the disclosure, the rule to be matched is designed to be a structure comprising the rule type, the rule parameter and the corresponding relation of the rule parameter value, so that the coverage of various rules can be realized based on limited rule types, the rule management is convenient, and the threshold of rule configuration is reduced.
Based on the same inventive concept as the above embodiment of the method, the present disclosure further provides a message sending device, referring to fig. 3, which is a schematic structural diagram of the message sending device provided by the embodiment of the present disclosure, where the device includes:
an obtaining module 301, configured to obtain a message to be sent, where the message is carried with a message sending rule; the message sending rule is used for indicating the sending condition of the message to be sent;
a first determining module 302, configured to determine a target client of the message to be sent;
a matching module 303, configured to match the information of the target client with the message sending rule to obtain a matching result;
a second determining module 304, configured to determine whether to send the message to be sent to the target client based on the matching result.
In an alternative embodiment, the message sending rule includes at least one rule to be matched, and the rule to be matched includes a rule type, a rule parameter and a rule parameter value;
the matching module comprises:
the first acquisition sub-module is used for acquiring a parameter value corresponding to the rule parameter in the rule to be matched, which is included in the message sending rule, in the information of the target client;
a determining submodule, configured to determine a rule matching method corresponding to the rule type in the rules to be matched;
the matching sub-module is used for matching the parameter value with the rule parameter value in the rule to be matched based on the rule matching method to obtain a matching result corresponding to the rule to be matched;
and the first determining submodule is used for determining the matching result corresponding to the message sending rule based on the matching result corresponding to the at least one rule to be matched respectively.
In an alternative embodiment of the present invention,
the rule matching method comprises parameter types and matching logic; the parameter type comprises a number type, a character string type, a number binary group type, a number list type or a character string list type;
the matching logic includes: if the parameter value is determined to be in accordance with the rule parameter value in the rule to be matched, determining that the matching result corresponding to the rule to be matched is successful, otherwise, determining that the matching result corresponding to the rule to be matched is failed; wherein the parameter value belongs to the parameter type included in the rule matching method;
alternatively, the matching logic includes: if the parameter value is determined not to be in accordance with the rule parameter value in the rule to be matched, determining that the matching result corresponding to the rule to be matched is successful, otherwise, determining that the matching result corresponding to the rule to be matched is failed; wherein the parameter value belongs to the parameter type included in the rule matching method.
In an alternative embodiment, the message sending rule further includes an negation rule; the first determination submodule includes:
the second determining submodule is used for determining an initial matching result based on the matching results respectively corresponding to the at least one rule to be matched;
and the negation sub-module is used for negating the initial matching result based on the negation rule to obtain a matching result corresponding to the message sending rule.
In an alternative embodiment, the acquiring module is specifically configured to:
responding to a message request from a communication connection client, and acquiring a message to be sent corresponding to the message request; the message to be sent carries a message sending rule, and the message request carries information of the communication connection client;
the first determining module is specifically configured to:
and determining the client of the communication connection as the target client of the message to be sent.
In an alternative embodiment, the apparatus further comprises:
a third determining module, configured to determine a message sending rule corresponding to a message to be sent based on a message type of the message to be sent;
and the packaging module is used for packaging the message sending rule in the message to be sent.
In the message sending device provided by the embodiment of the disclosure, firstly, a message to be sent carrying a message sending rule is obtained, a target client of the message to be sent is determined, then the information of the target client is matched with the message sending rule to obtain a matching result, and finally, whether the message to be sent is sent to the target client is determined based on the matching result. According to the embodiment of the disclosure, the message sending rule is encapsulated in each message, and the message filtering function is realized by matching the information of the target client with the message sending rule in the message. Compared with the prior art, the embodiment of the disclosure does not need to call the rule filtering engine, so that the CPU computing resource consumption is reduced, and the system performance is improved.
In addition to the above methods and apparatuses, the embodiments of the present disclosure further provide a computer readable storage medium, where instructions are stored, when the instructions are executed on a terminal device, cause the terminal device to implement the message sending method according to the embodiments of the present disclosure.
The disclosed embodiments also provide a computer program product comprising a computer program/instruction, characterized in that the computer program/instruction, when executed by a processor, implements the messaging method according to the disclosed embodiments.
In addition, the embodiment of the disclosure further provides a message sending device, which, as shown in fig. 4, may include:
a processor 401, a memory 402, an input device 403 and an output device 404. The number of processors 401 in the messaging device may be one or more, one processor being exemplified in fig. 4. In some embodiments of the present disclosure, the processor 401, memory 402, input device 403, and output device 404 may be connected by a bus or other means, with bus connections being exemplified in fig. 4.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing of the message transmission apparatus by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a storage program area that may store an operating system, application programs required for at least one function, and the like, and a storage data area. In addition, memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. The input means 403 may be used to receive entered numeric or character information and to generate signal inputs related to user settings and function control of the messaging device.
In particular, in this embodiment, the processor 401 loads executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 executes the application programs stored in the memory 402, so as to implement the various functions of the above-mentioned messaging device.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is merely a specific embodiment of the disclosure to enable one skilled in the art to understand or practice the disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown and described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A method of messaging, the method comprising:
acquiring a message to be transmitted carrying a message transmission rule; the message sending rule is encapsulated in a message header of the message to be sent, the message sending rule comprises at least one rule to be matched, the rule to be matched comprises a rule type, a rule parameter and a rule parameter value, and the message sending rule is used for representing the sending condition of the message to be sent;
analyzing the message to be sent to obtain the message sending rule;
determining a target client of the message to be sent, and acquiring a parameter value corresponding to the rule parameter in the rule to be matched included in the message sending rule in the information of the target client;
determining a rule matching method corresponding to the rule type in the rules to be matched;
based on the rule matching method, matching the parameter value with the rule parameter value in the rule to be matched to obtain a matching result corresponding to the rule to be matched;
determining a matching result corresponding to the message sending rule based on the matching results respectively corresponding to the at least one rule to be matched;
and determining whether to send the message to be sent to the target client based on the matching result.
2. The method of claim 1, wherein the rule matching method comprises a parameter type and matching logic; the parameter type comprises a number type, a character string type, a number binary group type, a number list type or a character string list type;
the matching logic includes: if the parameter value is determined to be in accordance with the rule parameter value in the rule to be matched, determining that the matching result corresponding to the rule to be matched is successful, otherwise, determining that the matching result corresponding to the rule to be matched is failed; wherein the parameter value belongs to the parameter type included in the rule matching method;
alternatively, the matching logic includes: if the parameter value is determined not to be in accordance with the rule parameter value in the rule to be matched, determining that the matching result corresponding to the rule to be matched is successful, otherwise, determining that the matching result corresponding to the rule to be matched is failed; wherein the parameter value belongs to the parameter type included in the rule matching method.
3. The method according to claim 1 or 2, wherein the messaging rules further comprise negation rules; the determining the matching result corresponding to the message sending rule based on the matching results respectively corresponding to the at least one rule to be matched comprises the following steps:
determining an initial matching result based on matching results respectively corresponding to the at least one rule to be matched;
and inverting the initial matching result based on the inverting rule to obtain a matching result corresponding to the message sending rule.
4. The method according to claim 1, wherein the obtaining the message to be sent carrying the message sending rule comprises:
responding to a message request from a communication connection client, and acquiring a message to be sent corresponding to the message request; the message to be sent carries a message sending rule, and the message request carries information of the communication connection client;
the determining the target client of the message to be sent comprises the following steps:
and determining the client of the communication connection as the target client of the message to be sent.
5. The method of claim 1, further comprising, prior to obtaining the message to be sent carrying the message sending rule:
determining a message sending rule corresponding to a message to be sent based on the message type of the message to be sent;
and encapsulating the message sending rule in the message to be sent.
6. A message transmission apparatus, the apparatus comprising:
the acquisition module is used for acquiring the message to be transmitted carrying the message transmission rule; the message sending rule is encapsulated in a message header of the message to be sent, the message sending rule comprises at least one rule to be matched, the rule to be matched comprises a rule type, a rule parameter and a rule parameter value, and the message sending rule is used for representing the sending condition of the message to be sent;
the analysis module is used for analyzing the message to be sent to obtain the message sending rule;
the first determining module is used for determining a target client of the message to be sent and acquiring a parameter value corresponding to the rule parameter in the rule to be matched included in the message sending rule in the information of the target client;
the method determining module is used for determining a rule matching method corresponding to the rule type in the rules to be matched;
the matching module is used for matching the parameter value with the rule parameter value in the rule to be matched based on the rule matching method to obtain a matching result corresponding to the rule to be matched;
the matching result determining module is used for determining a matching result corresponding to the message sending rule based on the matching result corresponding to the at least one rule to be matched respectively;
and the second determining module is used for determining whether to send the message to be sent to the target client or not based on the matching result.
7. A computer readable storage medium having instructions stored therein which, when run on a computer device, cause the computer device to implement the method of any of claims 1-5.
8. A computing device, comprising: a memory, a processor, and a computer program stored on the memory, which when executed by the processor, implements the method of any of claims 1-5.
CN202110126768.3A 2021-01-29 2021-01-29 Message sending method, device, equipment and storage medium Active CN112968825B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110126768.3A CN112968825B (en) 2021-01-29 2021-01-29 Message sending method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110126768.3A CN112968825B (en) 2021-01-29 2021-01-29 Message sending method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112968825A CN112968825A (en) 2021-06-15
CN112968825B true CN112968825B (en) 2023-05-26

Family

ID=76272102

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110126768.3A Active CN112968825B (en) 2021-01-29 2021-01-29 Message sending method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112968825B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075969A (en) * 2007-07-20 2007-11-21 中国建设银行股份有限公司 Method, apparatus and system for controlling data transmission
CN112203103A (en) * 2020-09-28 2021-01-08 北京字节跳动网络技术有限公司 Message processing method and device, electronic equipment and computer readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7853699B2 (en) * 2005-03-15 2010-12-14 Riverbed Technology, Inc. Rules-based transaction prefetching using connection end-point proxies
CN107426322A (en) * 2017-07-31 2017-12-01 深圳市金立通信设备有限公司 A kind of PUSH message target matching method, server, terminal and computer-readable recording medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075969A (en) * 2007-07-20 2007-11-21 中国建设银行股份有限公司 Method, apparatus and system for controlling data transmission
CN112203103A (en) * 2020-09-28 2021-01-08 北京字节跳动网络技术有限公司 Message processing method and device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN112968825A (en) 2021-06-15

Similar Documents

Publication Publication Date Title
CN111104664B (en) Risk identification method of electronic equipment and server
CN110602056B (en) Service parameter transmission method and device
CN114866965A (en) MaaP-based 5G message communication method, system, electronic equipment and storage medium
CN110780870A (en) Service execution method, device, equipment and storage medium
CN110825448A (en) Method, device, electronic equipment and storage medium for realizing mutual calling of multiple service modules
CN112861346A (en) Data processing system, method and electronic equipment
CN107819768B (en) Method for server to actively disconnect illegal long connection, terminal equipment and storage medium
CN114567650A (en) Data processing method and Internet of things platform system
CN110333916B (en) Request message processing method, device, computer system and readable storage medium
CN111338716A (en) Data processing method and device based on rule engine and terminal equipment
CN112968825B (en) Message sending method, device, equipment and storage medium
CN113051138A (en) Log analysis device and method based on Dubbo service interface
CN109525550B (en) Data message processing method, device and system
CN113127775A (en) Page loading method, device, equipment and storage medium
CN111309407A (en) Processing method and device for integrated third-party library
CN116450309A (en) System service providing method and device, storage medium and electronic equipment
CN115766894A (en) Implementation method, device, equipment and medium for improving service performance of Internet of things
CN114979157A (en) Load balancing method, system, storage medium and computer based on SOME/IP protocol
CN114866970A (en) Policy control method, system and related equipment
CN113992644A (en) Internet of things gateway system based on non-service technology and data processing method thereof
CN112202914A (en) Message pushing method and device
CN112131263A (en) Software package obtaining method, system, device, electronic equipment and storage medium
CN114090112B (en) Method and device for loading configuration file, storage medium and electronic device
CN111984341B (en) Project monitoring method and device, electronic equipment and storage medium
CN112988125B (en) Data bridging method, device, equipment and storage medium

Legal Events

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