Business processing method and device, storage medium, and electronic device
By pulling and parsing the filtering rules and business processing classes of message queues, the problem of real-time update of logic and server differentiated configurations in the existing technology is solved, and flexible filtering and logic updates are realized, suitable for large-scale promotional activities and new business trial run scenarios.
Patent Information
- Application Number
- CN202010966694.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-15
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2040-09-15
AI Technical Summary
The existing technology cannot modify the judgment logic of the online program in real time, and the same group of servers cannot execute different judgment logic, resulting in complex filtering and processing in scenarios such as large-scale promotions or trial operation of new businesses and consuming a lot of manpower and material resources.
Provides a business processing method, which can solve and filter the message queue by pulling the target filtering rules and target business processing classes of the message queue, and realize real-time change logic updates without restarting the server, and supports differentiated configurations of the same set of servers.
It enriches the application scenarios of message queues, solves the filtering and processing problems under large-scale promotions or new business trial runs, meets the need for continuous update of judgment logic, and realizes differentiated configuration of the server.
Smart Images

Figure CN113918357B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a business processing method and device, a computer-readable storage medium, and an electronic device. Background Art
[0002] Message queues, with their asynchronous processing, security, and stability, have been widely used in various fields of the Internet. Producers can put messages into message queues, and message consumers can monitor and consume messages in message queues.
[0003] When consumers monitor and consume message queues, they cannot modify the judgment logic of the online program in real time, nor can they meet the needs of executing different judgment logics on the same set of servers.
[0004] In view of this, there is an urgent need in this field to develop a new business processing method and device.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention
[0006] The purpose of the present disclosure is to provide a business processing method, a business processing device, a computer-readable storage medium and an electronic device, thereby overcoming, at least to a certain extent, the problem of being unable to modify the judgment logic in real time and being unable to execute different judgment logics on the same group of servers due to the limitations of related technologies.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by practice of the present disclosure.
[0008] According to a first aspect of an embodiment of the present invention, a business processing method is provided, which is applied to a client. The method includes: when a message queue is monitored, pulling the target filtering rules and target business processing class corresponding to the message queue; parsing the message queue to obtain a parsing queue, and using the target filtering rules to filter the parsing queue to obtain a target message; and executing the business logic of the target message through the target business processing class.
[0009] In an exemplary embodiment of the present invention, pulling the target filtering rules and target business processing class corresponding to the message queue includes: pulling configuration information corresponding to the message queue; and determining the target filtering rules and target business processing class in the configuration information.
[0010] In an exemplary embodiment of the present invention, the configuration information includes: initial configuration information and updated configuration information; the pulling of the configuration information corresponding to the message queue includes: when the configuration information is updated configuration information, pulling the updated configuration information corresponding to the message queue; and caching the updated configuration information.
[0011] In an exemplary embodiment of the present invention, determining the target filtering rules and target business processing class in the configuration information includes: determining that the filter type in the configuration information is a serial filter, and obtaining multiple serial filtering rules of the serial filter; determining the multiple serial filtering rules as target filtering rules, and determining that the business processing class corresponding to the target filtering rules is the target business processing class.
[0012] In an exemplary embodiment of the present invention, determining the target filtering rules and target business processing classes in the configuration information includes: determining that the filter type in the configuration information is a decision filter, and determining multiple sub-filters in the decision filter; obtaining multiple filtering rules corresponding to the multiple sub-filters and multiple business processing classes corresponding to the decision filter; determining one of the multiple filtering rules as the target filtering rule, and determining one of the multiple business processing classes as the target business processing class.
[0013] In an exemplary embodiment of the present invention, determining the target filtering rules and target business processing class in the configuration information includes: determining that the filter type in the configuration information is a downgraded filter, and obtaining the target filtering rules in the downgraded filter; determining that the business processing class corresponding to the target filtering rules is the target business processing class.
[0014] In an exemplary embodiment of the present invention, pulling the target filtering rules and target business processing classes corresponding to the message queue includes: sending the client's token and client identifier to determine whether the client has the pulling permission; if the client has the pulling permission, pulling the target filtering rules and target business processing classes corresponding to the message queue.
[0015] According to the second aspect of an embodiment of the present invention, a business processing device is provided, which includes: a data pulling module, configured to pull the target filtering rules and target business processing class corresponding to the message queue when monitoring the message queue; a filtering processing module, configured to parse the message queue to obtain a parsing queue, and use the target filtering rules to filter the parsing queue to obtain a target message; and a business processing module, configured to execute the business logic of the target message through the target business processing class.
[0016] According to a third aspect of an embodiment of the present invention, there is provided an electronic device comprising: a processor and a memory; wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the business processing method of any of the above exemplary embodiments is implemented.
[0017] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the business processing method in any of the above exemplary embodiments is implemented.
[0018] As can be seen from the above technical solutions, the service processing method, service processing device, computer storage medium, and electronic device in the exemplary embodiments of the present invention have at least the following advantages and positive effects:
[0019] In the method and device provided by the exemplary embodiments of the present disclosure, on the one hand, the message queue is filtered and processed by pulling the target filtering rules, providing a variety of filtering methods, enriching the application scenarios of the message queue, and solving the filtering processing problems in scenarios such as large-scale promotional activities or new business trial runs; on the other hand, the pulled target filtering rules and target business processing classes can be changed in real time without restarting the server, meeting the needs of continuous updating of judgment logic in actual scenarios, and can also realize differentiated configuration of servers in the same group.
[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0022] Figure 1 The following is a schematic diagram showing the flow of the first processing logic of the consumption message queue in the related art;
[0023] Figure 2 The following is a schematic diagram showing the flow of the second processing logic of the consumption message queue in the related art;
[0024] Figure 3 A schematic diagram illustrating a third processing logic flow of a consumption message queue in the related art;
[0025] Figure 4 A flowchart schematically illustrates a business processing method in an exemplary embodiment of the present disclosure;
[0026] Figure 5 A schematic diagram schematically illustrates a flow chart of a method for verifying client pull permissions in an exemplary embodiment of the present disclosure;
[0027] Figure 6 A flowchart schematically illustrates a method for pulling configuration information in an exemplary embodiment of the present disclosure;
[0028] Figure 7 A flowchart schematically illustrates a method for pulling updated configuration information in an exemplary embodiment of the present disclosure;
[0029] Figure 8 A schematic flow chart of a first method for determining target filtering rules and target business processing classes in an exemplary embodiment of the present disclosure is schematically shown;
[0030] Figure 9 A schematic flow chart illustrating a second method for determining target filtering rules and target business processing classes in an exemplary embodiment of the present disclosure is shown;
[0031] Figure 10 A schematic flow chart illustrating a third method for determining target filtering rules and target business processing classes in an exemplary embodiment of the present disclosure is shown;
[0032] Figure 11 A schematic diagram schematically illustrates a process flow of a business processing method in an application scenario in an exemplary embodiment of the present disclosure;
[0033] Figure 12 A schematic diagram schematically illustrates the structure of a service processing device in an exemplary embodiment of the present disclosure;
[0034] Figure 13 Schematically illustrates an electronic device for implementing a service processing method in an exemplary embodiment of the present disclosure;
[0035] Figure 14 A computer-readable storage medium for implementing a business processing method in an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0036] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present disclosure will be more comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or that other methods, components, devices, steps, etc. may be employed. In other cases, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0037] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0038] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the drawings represent identical or similar parts, and thus repeated descriptions thereof will be omitted. Some of the blocks shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically separate entities.
[0039] In related technologies, a producer may put generated messages into a message queue, and a consumer may monitor the message queue and consume the messages.
[0040] The producer is the provider and sender of messages, a node rather than a natural person, while the consumer is the receiver and user of messages, also a node.
[0041] When consuming a message queue, you may see Figure 1 、 Figure 2 and Figure 3 Three processing logics are shown.
[0042] Figure 1 The flowchart of the first processing logic of the consumption message queue in the related technology is shown as follows: Figure 1 As shown, after receiving the message queue, three layers of judgment logic are used to verify whether the message in the message queue needs to be processed.
[0043] Figure 2A flow chart showing the second processing logic of the consumer message queue in the related art is shown as follows: Figure 2 As shown, after receiving the message queue, the business logic to be executed can be determined through multiple different logical judgments.
[0044] Figure 3 A flow chart showing the third processing logic of the consumption message queue in the related art is shown as follows: Figure 3 As shown, for some large-scale promotions, some message queues may be downgraded; or when a new service is launched, phased release verification may be performed. These downgrade methods require the configuration of corresponding judgment logic.
[0045] There are two potential problems with these three processing logics: First, it's impossible to dynamically modify the judgment logic for an already deployed program; and second, the same set of servers cannot execute different judgment logics.
[0046] Although the second problem can be solved by configuring each server individually, this is not only complicated and cumbersome to operate, requiring a large investment of manpower and material resources, but is also highly invasive to the code logic.
[0047] In response to the problems existing in the related technologies, the present disclosure proposes a business processing method applied to a client. Figure 4 A flowchart of a business processing method is shown in FIG. Figure 4 As shown, the business processing method includes at least the following steps:
[0048] Step S410: When a message queue is monitored, the target filtering rule and target business processing class corresponding to the message queue are pulled.
[0049] Step S420: Parse the message queue to obtain a parsing queue, and filter the parsing queue using the target filtering rule to obtain the target message.
[0050] Step S430: Execute the business logic of the target message through the target business processing class.
[0051] In the exemplary embodiments of the present disclosure, on the one hand, the message queue is filtered and processed by pulling the target filtering rules, providing a variety of filtering methods, enriching the application scenarios of the message queue, and solving the filtering processing problems in scenarios such as large-scale promotional activities or new business trial runs; on the other hand, the pulled target filtering rules and target business processing classes can be changed in real time without restarting the server, meeting the needs of continuous updating of judgment logic in actual scenarios, and can also realize differentiated configuration of servers in the same group.
[0052] The following describes in detail each step of the business processing method.
[0053] In step S410, when a message queue is monitored, the target filtering rule and target business processing class corresponding to the message queue are pulled.
[0054] In the exemplary embodiments of the present disclosure, a message queue is a communication method used to asynchronously process a series of messages. For example, a message queue can be a message queue for placing an order, a message queue for shipping a product, or a message queue for completing an order, etc., although this exemplary embodiment does not specifically limit this.
[0055] The message may be data or management instructions, etc.
[0056] Monitoring the message queue can be achieved through a global handler (GlobalHandler). Specifically, you can register the GlobalHandler with the Spring container to implement the function of monitoring the message queue.
[0057] Usually, when calling objects at different levels, objects need to be created continuously, and two objects need to be created for each access. If you use the Spring container to put objects at different levels into the container, you don't need to create many objects each time you call the object in the container, thus saving memory space through the Spring container.
[0058] When monitoring the message queue, you can first verify the client's pull permission.
[0059] In an alternative embodiment, Figure 5 A flow chart showing a method for verifying client pull permissions is shown in FIG. Figure 5 As shown, the method includes at least the following steps: In step S510, the client's token and client identification are sent to determine whether the client has pull permission.
[0060] A token is a string of characters generated by the server for client requests. When a client logs in to the server for the first time, the server generates a token and returns it to the client. The client only needs to include the token when making subsequent requests for data.
[0061] Specifically, the token can be a string generated by encryption processing on the server side, or a string generated by setting other rules, or generated by other methods that can ensure the uniqueness of the token. This exemplary embodiment does not make special limitations on this.
[0062] The client ID can also uniquely identify the client and serve as the basis for authorization verification of requested data.
[0063] For example, the client identifier may be a universally unique identifier (UUID) or other identification information, which is not particularly limited in this exemplary embodiment.
[0064] The token and client ID are sent to the server, which can verify the token and client ID to determine whether the client has pull permission based on the verification result.
[0065] In step S520, if the client has the pull permission, the target filtering rule and target business processing class corresponding to the message queue are pulled.
[0066] When the server verifies the token and client ID, it indicates that the client has the pull permission and can pull the target filtering rules and target business processing classes.
[0067] Specifically, the target filtering rules and target business processing class can be obtained by pulling the configuration information corresponding to the message queue.
[0068] The configuration information may be information configured by the server according to business rules.
[0069] For example, the configuration information may include service name information, which may facilitate viewing and logging, and may serve as identification information of the configuration information.
[0070] In addition, it can also include the name of the message queue entity, that is, the category name of the message queue, and the execution slice information. The execution slice information is the client machine information registered with the server at startup. Therefore, during configuration, the server can select the client that executes the current business logic.
[0071] In an alternative embodiment, Figure 6 A flow chart of a method for pulling configuration information is shown, as shown in Figure 6 As shown, the method includes at least the following steps: in step S610, pulling configuration information corresponding to the message queue.
[0072] In an optional embodiment, the configuration information includes initial configuration information and updated configuration information. Figure 7 A flow chart of a method for pulling and updating configuration information is shown, as shown in FIG. Figure 7 As shown, the method at least includes the following steps: in step S710, when the configuration information is update configuration information, pull the update configuration information corresponding to the message queue.
[0073] The initial configuration information may be the configuration information pulled when the client starts the server.
[0074] Specifically, when the configuration is pulled, it can be grouped according to the message queue category name in the configuration, and the configurations with the same category name are stored in the same hash table.
[0075] A hash table is a data structure that allows direct access based on key-value pairs. In other words, it accesses records by mapping key-value pairs to a location in the table, speeding up lookups. This mapping function is called a hash function, and the array that stores the records is called a hash table.
[0076] The value in the hash table stores configuration information corresponding to the message queue, which may include business processing class, filter type, and filtering rules.
[0077] The updated configuration information may be configuration information obtained by adjusting the initial configuration information, or may be configuration information updated through user operation, which is not particularly limited in this exemplary embodiment.
[0078] When the configuration information to be pulled is updated configuration information, the configuration information pulled by the currently registered client is the updated configuration information.
[0079] In step S720 , the cache updates the configuration information.
[0080] In order to prevent too many clients from pulling at the same time, causing excessive load on the server, a data cache with a preset duration can be set to cache the updated configuration information. The preset duration can be 1 minute or 40 seconds, and this exemplary embodiment does not make special restrictions on this.
[0081] In addition, the initial configuration information and the updated configuration information can also be pulled by a timer trigger. The timer duration can be 30 minutes or other durations, and this exemplary embodiment does not make special restrictions on this.
[0082] In this exemplary embodiment, by caching when pulling updated configuration information, the load pressure on the server side can be alleviated and the efficiency of pulling configuration information can be improved.
[0083] In step S620, the target filtering rule and the target service processing class are determined in the configuration information.
[0084] Since different filter types determine target filtering rules and target business processing classes in different ways, different determination methods may be described separately.
[0085] The filter may be a message filter set on the server side, and is used to filter out messages of a predetermined type in the message queue, or to retain only messages of a predetermined type in the message queue.
[0086] Further, Figure 8 、 Figure 9 and Figure 10 The following are flowcharts of three methods for determining target filtering rules and target business processing classes. Figure 8 It is a flowchart of a method for determining a target filtering rule and a target business processing class when the filter type is a serial filter; Figure 9 It is a flowchart of a method for determining a target filtering rule and a target business processing class when the filter type is a decision filter type; Figure 10 This is a flowchart of a method for determining a target filtering rule and a target business processing class when the filter type is a degradation filter.
[0087] It is worth noting that each layer in each filter can be implemented by a separate Groovy code snippet.
[0088] Among them, Groovy is an agile development language based on the Java virtual machine. It combines many powerful features of Python, Ruby and Smalltalk. Groovy code can be well combined with Java code and can also be used to expand existing code.
[0089] In an alternative embodiment, Figure 8 A flow chart of a first method for determining target filtering rules and target business processing classes is shown, as shown in FIG. Figure 8 As shown, the method at least includes the following steps: in step S810, it is determined that the filter type in the configuration information is a serial filter, and multiple serial filtering rules of the serial filter are obtained.
[0090] A serial filter can be a multi-layer filter added by the server. Each layer of the multi-layer filter is assigned a corresponding filtering rule. In other words, a serial filter corresponds to multiple serial filtering rules. Furthermore, these multiple serial filtering rules can determine whether filtering is performed based on the on / off status of each layer of the multi-layer filter.
[0091] Moreover, when the serial filter switch is turned on, the messages in the message queue can only continue to be judged by the next layer of filtering rules if they meet the filtering rules of the previous layer.
[0092] In step S820 , a plurality of serial filtering rules are determined as target filtering rules, and a business processing class corresponding to the target filtering rules is determined as a target business processing class.
[0093] When the filter type is a serial filter, multiple serial filter rules of the serial filter together constitute the target filter rule.
[0094] Furthermore, since the serial filter is configured with one business processing class, the configured business processing class is determined to be the target business processing class of the serial filter.
[0095] It's worth noting that the target business processing class is the full class path. The full class path is the storage address of the business processing class, specifically the package name where the target business processing class resides. Because business processing classes with the same name can exist in different packages, specifying the full path is necessary to facilitate locating the target business processing class.
[0096] In this exemplary embodiment, the target filtering rule and target business processing class of the serial filter are determined, providing a filtering type for completing message filtering, and the determination method is simple and accurate, and has strong applicability.
[0097] In an alternative embodiment, Figure 9 A flow chart of a second method for determining target filtering rules and target business processing classes is shown, as shown in FIG. Figure 9 As shown, the method at least includes the following steps: in step S910, it is determined that the filter type in the configuration information is a decision filter, and multiple sub-filters in the filter are determined.
[0098] The decision filter can be a multi-layer filter added by the server, and each layer of the filter is provided with a corresponding filtering rule. When the filtering rule of one layer is met, the business processing class corresponding to the filtering rule can be executed.
[0099] Each filter layer in the decision filter is a sub-filter in the decision filter. Therefore, a decision filter corresponds to multiple sub-filters.
[0100] In step S920, a plurality of filtering rules corresponding to the plurality of sub-filters and a plurality of business processing classes corresponding to the decision filter are obtained.
[0101] After determining the multiple sub-filters in the decision filter, the filtering rules corresponding to each sub-filter can be obtained. In addition, since a decision filter needs to be configured with multiple business processing classes, multiple business processing classes can also be obtained.
[0102] It's worth noting that the business processing class is the full class path. The full class path is the storage address of the business processing class, that is, the package name where the business processing class is located. Because business processing classes with the same name can exist in different packages, specifying the full path is necessary to facilitate finding the target business processing class.
[0103] In step S930 , one of the plurality of filtering rules is determined to be a target filtering rule, and one of the plurality of business processing classes is determined to be a target business processing class.
[0104] When a message in the message list satisfies one of the multiple filtering rules, the filtering rule may be determined as a target filtering rule, and the business processing class corresponding to the filtering rule may be determined as a target business processing class.
[0105] In this exemplary embodiment, the target filtering rule and target business processing class of the decision filter are determined, providing another type of filtering for completing message filtering, and the determination method is simple and accurate, and has strong applicability.
[0106] In an alternative embodiment, Figure 10 A flow chart of a third method for determining target filtering rules and target business processing classes is shown, as shown in FIG. Figure 10 As shown, the method at least includes the following steps: in step S1010, it is determined that the filter type in the configuration information is a degraded filter, and the target filtering rule in the degraded filter is obtained.
[0107] The demotion filter may be a layer of filter added by the server, and a demotion parameter may be set in the filter. For example, the demotion parameter may be in the form of a percentage or other form, which is not specifically limited in this exemplary embodiment.
[0108] Furthermore, the rule configuration set according to the degradation parameter is the target filtering rule.
[0109] In addition, the target filtering rule of the downgrade filter may also achieve the purpose of downgrade filtering through other methods, which are not particularly limited in this exemplary embodiment.
[0110] In step S1020, the business processing class corresponding to the target filtering rule is determined as the target business processing class.
[0111] Since the demotion filter configures a business processing class, when the filter type is a demotion filter, it is sufficient to determine the business processing class as the target business processing class.
[0112] It's worth noting that the business processing class is the full class path. The full class path is the storage address of the business processing class, that is, the package name where the business processing class is located. Because business processing classes with the same name can exist in different packages, specifying the full path is necessary to facilitate finding the target business processing class.
[0113] In this exemplary embodiment, the target filtering rules and target business processing class of the downgrade filter are determined, providing another filtering type for completing message filtering, and the determination method is simple and accurate, and has strong applicability.
[0114] It is worth noting that when there are multiple clients, the downgrade filtering function can also be implemented through other middleware such as Redis.
[0115] Redis is an open-source, network-based, memory-based key-value store that supports a variety of data types and operations, offering powerful data management capabilities. Redis supports storing values of various types, including strings, lists, sets, and ordered sets. These data types support a richer set of operations, all of which are atomic.
[0116] In step S420, the message queue is parsed to obtain a parsed queue, and the parsed queue is filtered using a target filtering rule to obtain a target message.
[0117] In an exemplary embodiment of the present disclosure, the message queue may be parsed by decrypting the encrypted message queue, converting the message queue in json format into an object, or other parsing methods, which are not specifically limited in this exemplary embodiment.
[0118] After parsing the message queue, a parsed queue can be obtained, and the messages in the parsed queue can be intercepted using target filtering rules.
[0119] For example, when the target filtering rule is a filtering rule corresponding to a degradation filter with a degradation parameter of 10%, 10% of the messages in the message queue may be intercepted, and the remaining 90% of the messages in the message queue are target messages.
[0120] In step S430, the business logic of the target message is executed through the target business processing class.
[0121] In an exemplary embodiment of the present disclosure, when a target message is obtained through filtering, the target business processing class may be used to execute the business logic of the target message.
[0122] Specifically, the target business processing class may be loaded into a Spring container, and the execute() method of the target business processing class may be called to execute the business logic of the target message.
[0123] The following describes in detail the service processing method in the embodiment of the present disclosure in conjunction with an application scenario.
[0124] Figure 11 A flow chart of a business processing method in an application scenario is shown, such as Figure 11 As shown, in step S1110, the message queue is monitored uniformly through GlobalHandler.
[0125] The message queue may include an order placement message queue, a delivery message queue, an order completion message queue, etc., and this exemplary embodiment does not impose any special limitation on this.
[0126] In step S1120, configuration information corresponding to the message queue is pulled.
[0127] The configuration information may include initial configuration information and updated configuration information.
[0128] The initial configuration information may be the configuration information pulled when the client starts the server.
[0129] Specifically, when the configuration is pulled, it can be grouped according to the message queue category name in the configuration, and the configurations with the same category name are stored in the same hash table.
[0130] A hash table is a data structure that allows direct access based on key-value pairs. In other words, it accesses records by mapping key-value pairs to a location in the table, speeding up lookups. This mapping function is called a hash function, and the array that stores the records is called a hash table.
[0131] The value in the hash table stores configuration information corresponding to the message queue, which may include business processing class, filter type, and filtering rules.
[0132] In step S1121, when the configuration information is the first configuration information, the first configuration information is pulled from the cache module of the client.
[0133] In step S1122, when the configuration information is updated configuration information, the configuration function notifies the client to pull the updated configuration information.
[0134] The updated configuration information may be configuration information obtained by adjusting the initial configuration information, or may be configuration information updated through user operation, which is not particularly limited in this exemplary embodiment.
[0135] It is worth noting that pulling configuration information also supports Quartz triggering, that is, timed pulling.
[0136] For example, the timing duration may be 30 minutes, or other durations set according to actual scenarios, which is not specifically limited in this exemplary embodiment.
[0137] In addition, in step S1130, when the client starts the server, the server will start the function of registering the client information.
[0138] In addition, the server will register the current client's information so that the client that executes the business logic can be selected during configuration.
[0139] Furthermore, in step S1140, when the configuration information is pulled, the target filtering rule and the target business processing class may be determined in the configuration information.
[0140] The method of determining target filtering rules and target business processing classes is the same as Figure 8 、 Figure 9 and Figure 10 The same, no longer repeated here.
[0141] The target filtering rules can be used to filter the messages in the message queue to obtain the target messages.
[0142] It is worth noting that when the message queue is encrypted or in JSON format, the message queue can be parsed first.
[0143] In step S1150, the business processing class is called to execute the business logic of the target message.
[0144] Specifically, the target business processing class may be loaded into a Spring container, and the execute() method of the target business processing class may be called to execute the business logic of the target message.
[0145] The updated configuration information may be configuration information obtained by adjusting the initial configuration information, or may be configuration information updated through user operation, which is not particularly limited in this exemplary embodiment.
[0146] In the exemplary embodiments of the present disclosure, on the one hand, the message queue is filtered and processed by pulling the target filtering rules, providing a variety of filtering methods, enriching the application scenarios of the message queue, and solving the filtering processing problems in scenarios such as large-scale promotional activities or new business trial runs; on the other hand, the pulled target filtering rules and target business processing classes can be changed in real time without restarting the server, meeting the needs of continuous updating of judgment logic in actual scenarios, and can also realize differentiated configuration of servers in the same group.
[0147] In addition, in an exemplary embodiment of the present disclosure, a service processing device is also provided. Figure 12 A schematic diagram of the structure of the service processing device is shown in FIG. Figure 12 As shown, the service processing device 1200 may include: a data pulling module 1210, a filtering processing module 1220 and a service processing module 1230. Among them:
[0148] The data pulling module 1210 is configured to pull the target filtering rules and target business processing class corresponding to the message queue when monitoring the message queue; the filtering processing module 1220 is configured to parse the message queue to obtain a parsing queue, and use the target filtering rules to filter the parsing queue to obtain the target message; the business processing module 1230 is configured to execute the business logic of the target message through the target business processing class.
[0149] The specific details of the above-mentioned business processing device 1200 have been described in detail in the corresponding business processing method, so they will not be repeated here.
[0150] It should be noted that although the detailed description above refers to several modules or units of the service processing device 1200, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in a single module or unit. Conversely, the features and functions of a single module or unit described above can be further divided and embodied by multiple modules or units.
[0151] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0152] Refer to the following Figure 13 13. The electronic device 1300 according to this embodiment of the present invention is described below. Figure 13 The electronic device 1300 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0153] like Figure 13 As shown, electronic device 1300 is implemented as a general-purpose computing device. Components of electronic device 1300 may include, but are not limited to, the aforementioned at least one processing unit 1310, the aforementioned at least one storage unit 1320, a bus 1330 connecting various system components (including storage unit 1320 and processing unit 1310), and a display unit 1340.
[0154] The storage unit stores program codes, which can be executed by the processing unit 1310, so that the processing unit 1310 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification.
[0155] The storage unit 1320 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 1321 and / or a cache memory unit 1322 , and may further include a read-only memory unit (ROM) 1323 .
[0156] The storage unit 1320 may also include a program / utility 1324 having a set (at least one) of program modules 1325, such program modules 1325 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0157] Bus 1330 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0158] The electronic device 1300 can also communicate with one or more external devices 1500 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 1300, and / or any device that enables the electronic device 1300 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). Such communication can occur via an input / output (I / O) interface 1350. Furthermore, the electronic device 1300 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 1360. As shown, the network adapter 1360 communicates with other modules of the electronic device 1300 via a bus 1330. It should be understood that, although not shown, other hardware and / or software modules can be used in conjunction with the electronic device 1300, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0159] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0160] In exemplary embodiments of the present disclosure, a computer-readable storage medium is also provided, storing a program product capable of implementing the aforementioned methods of this specification. In some possible embodiments, various aspects of the present invention may also be implemented in the form of a program product comprising program code. When the program product is executed on a terminal device, the program code is configured to cause the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the "Exemplary Methods" section of this specification.
[0161] refer to Figure 14 As shown, a program product 1400 for implementing the above method according to an embodiment of the present invention is described. The program product 1400 may be a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0162] The program product may be implemented in any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable 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 thereof.
[0163] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0164] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0165] The program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0166] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow from the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
Claims
1. A business processing method, applied to a client, characterized in that: The method comprises: When a message queue is monitored, the target filtering rule and target business processing class corresponding to the message queue are pulled; Pulling the target filtering rules and target business processing classes corresponding to the message queue includes: Pulling configuration information corresponding to the message queue; the configuration information includes filter types, the filter types including serial filters, decision filters and degradation filters, and each filter type is associated with multiple filtering rules; determining the target filtering rules and target business processing class in the configuration information; The serial filter is a multi-layer filter, each layer of which is provided with corresponding filtering rules. When the message in the message queue meets the filtering rules of the current layer, further filtering judgment is performed according to the filtering rules of the next layer; The decision filter includes multiple layers of sub-filters, each layer of sub-filters is associated with a filtering rule, and when a message in the message queue meets the filtering rule of one layer, the business processing class corresponding to the filtering rule is executed; The degradation filter includes a single-layer filter, and the single-layer filter is provided with degradation parameters, and the target filtering rule is determined according to the rule configuration set by the degradation parameters; Parsing the message queue to obtain a parsing queue, and filtering the parsing queue using the target filtering rule to obtain a target message; The business logic of the target message is executed through the target business processing class.
2. The service processing method according to claim 1, wherein: The configuration information includes: initial configuration information and updated configuration information; Pulling the configuration information corresponding to the message queue includes: When the configuration information is update configuration information, pull the update configuration information corresponding to the message queue; The updated configuration information is cached.
3. The service processing method according to claim 1, wherein: Determining the target filtering rules and target service processing class in the configuration information includes: Determining that the filter type in the configuration information is a serial filter, and obtaining a plurality of serial filtering rules of the serial filter; The multiple serial filtering rules are determined as target filtering rules, and the business processing class corresponding to the target filtering rules is determined as the target business processing class.
4. The service processing method according to claim 1, wherein: Determining the target filtering rules and target service processing class in the configuration information includes: Determining that the filter type in the configuration information is a decision filter, and determining a plurality of sub-filters in the decision filter; Acquire multiple filtering rules corresponding to the multiple sub-filters and multiple business processing classes corresponding to the decision filter; One of the multiple filtering rules is determined to be a target filtering rule, and one of the multiple business processing classes is determined to be a target business processing class.
5. The business processing method according to claim 1, characterized in that: Determining the target filtering rules and target service processing class in the configuration information includes: Determining that the filter type in the configuration information is a degraded filter, and obtaining a target filtering rule in the degraded filter; The business processing class corresponding to the target filtering rule is determined as the target business processing class.
6. The business processing method according to claim 1, characterized in that: Pulling the target filtering rules and target business processing classes corresponding to the message queue includes: Send the client's token and client identification to determine whether the client has pull permission; If the client has the pull permission, the target filtering rule and target business processing class corresponding to the message queue are pulled.
7. A business processing device, characterized in that: include: A data pulling module is configured to pull a target filtering rule and a target business processing class corresponding to a message queue when monitoring the message queue; a data pulling module configured to pull configuration information corresponding to the message queue; the configuration information including filter types, including serial filters, decision filters, and degradation filters, each filter type being associated with multiple filtering rules; and determining a target filtering rule and a target business processing class in the configuration information; The serial filter is a multi-layer filter, each layer of which is provided with corresponding filtering rules. When the message in the message queue meets the filtering rules of the current layer, further filtering judgment is performed according to the filtering rules of the next layer; The decision filter includes multiple layers of sub-filters, each layer of sub-filters is associated with a filtering rule, and when a message in the message queue meets the filtering rule of one layer, the business processing class corresponding to the filtering rule is executed; The degradation filter includes a single-layer filter, and the single-layer filter is provided with degradation parameters, and the target filtering rule is determined according to the rule configuration set by the degradation parameters; a filtering processing module configured to parse the message queue to obtain a resolution queue, and filter the resolution queue using the target filtering rule to obtain a target message; The business processing module is configured to execute the business logic of the target message through the target business processing class.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the business processing method according to any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: include: processor; a memory for storing executable instructions of the processor; The processor is configured to execute the business processing method according to any one of claims 1 to 6 by executing the executable instructions.
Citation Information
Patent Citations
Method and device for real-time data processing based on stream-oriented calculation engine
CN104615777A