CN112445868A - Service message processing method and device - Google Patents

Service message processing method and device Download PDF

Info

Publication number
CN112445868A
CN112445868A CN201910816045.9A CN201910816045A CN112445868A CN 112445868 A CN112445868 A CN 112445868A CN 201910816045 A CN201910816045 A CN 201910816045A CN 112445868 A CN112445868 A CN 112445868A
Authority
CN
China
Prior art keywords
service
service type
message
type
module
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.)
Granted
Application number
CN201910816045.9A
Other languages
Chinese (zh)
Other versions
CN112445868B (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 Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information 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 Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN201910816045.9A priority Critical patent/CN112445868B/en
Publication of CN112445868A publication Critical patent/CN112445868A/en
Application granted granted Critical
Publication of CN112445868B publication Critical patent/CN112445868B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a service message processing method and a service message processing device, and relates to the technical field of computers. Wherein, the method comprises the following steps: receiving a service message downloaded by an upstream system; analyzing the service message to determine a first service type of the service message; inquiring the corresponding relation between the service and the channel according to the first service type of the service message to determine a message queue channel corresponding to the first service type; and sending the service message to a message queue channel corresponding to the first service type. Through the steps, the service messages of different service types can be split into different message queue channels after order receiving, so that the pressure on a downstream system is reduced, the running stability of the downstream system is improved, and the separation and the decoupling of subsequent service processing logics are facilitated.

Description

Service message processing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a service packet.
Background
With the rapid development of the internet, online shopping has become a fashion consumer due to the advantages of rapidness, convenience and the like. With the diversification and evolution of online purchased articles, the purchasing strength of people increases year by year, the business requirements of various merchants and users also change to diversification, and the pressure brought to business systems also increases.
In the prior art, after a service message is downloaded from an upstream system, a service processing system mainly adopts a uniform pipeline mode to receive orders. For example, an RPC service framework interface may be adopted to receive service messages, and then all the service messages are uniformly sent to an MQ (message queue), and then all the service messages are uniformly processed by the service processing system.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: firstly, with the rapid iterative development of services and the accompanying of the customized services of the infinite merchants, the message volume required to be received and processed by the service processing system gradually increases, and the existing unified pipeline order receiving mode has more and more pressure on the downstream system and may affect the operation stability of the downstream system. Secondly, because the service messages are received through the unified pipeline, various service processing logics in a subsequent service processing system are coupled together, so that the iteration of subsequent services is more and more difficult. Thirdly, due to the limited storage time of the service messages in the MQ, asynchronous operation between the sending of the service messages by the sender and the receiving of the MQ, and the like, the problems of loss of the service messages in the MQ, incapability of re-consuming the service messages subsequently, and the like can be caused.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for processing a service packet, which can split service packets of different service types into different message queue channels after receiving a single, reduce the pressure on a downstream system, improve the stability of the operation of the downstream system, and facilitate the separation and decoupling of subsequent service processing logics.
To achieve the above object, according to an aspect of the present invention, a method for processing a service packet is provided.
The service message processing method of the invention comprises the following steps: receiving a service message downloaded by an upstream system; analyzing the service message to determine a first service type of the service message; inquiring the corresponding relation between the service and the channel according to the first service type of the service message to determine a message queue channel corresponding to the first service type; and sending the service message to a message queue channel corresponding to the first service type.
Optionally, the method further comprises: after the step of receiving the service message downloaded by the upstream system is executed, calling a factory class according to a second service type identifier carried by the service message to create a service message splitting processing example corresponding to the second service type; wherein the first service type is a sub-service type under the second service type.
Optionally, the step of analyzing the service packet to determine the first service type of the service packet includes: loading a configuration file; the configuration file comprises a plurality of service type analysis rules, and each service type analysis rule is a key value pair which takes a first service type identifier as a key and takes an activation state identifier as a value; under the condition that the service type analysis rule is in an enabled state, judging whether the service message contains a first service type identifier in the service type analysis rule; if yes, determining that the first service type of the service message is the service type defined by the first service type identifier; if not, traversing the next service type analysis rule until determining the first service type of the service message.
Optionally, the method further comprises: and after the step of receiving the service message downloaded by the upstream system is executed, performing persistence processing on the service message.
To achieve the above object, according to another aspect of the present invention, a service packet processing apparatus is provided.
The service message processing device of the invention comprises: the receiving module is used for receiving the service message downloaded by the upstream system; the analysis module is used for analyzing the service message to determine a first service type of the service message; the determining module is used for inquiring the corresponding relation between the service and the channel according to the first service type of the service message so as to determine a message queue channel corresponding to the first service type; and the sending module is used for sending the service message to a message queue channel corresponding to the first service type.
Optionally, the apparatus further comprises: the creating module is used for calling a factory class according to a second service type identifier carried by the service message so as to create a service message splitting processing example corresponding to the second service type; wherein, the first service type is a sub-service type under the second service type; the splitting processing instance comprises the parsing module, the determining module and the sending module.
Optionally, the analyzing module analyzes the service packet to determine the first service type of the service packet includes: the analysis module loads a configuration file; the configuration file comprises a plurality of service type analysis rules, and each service type analysis rule is a key value pair which takes a first service type identifier as a key and takes an activation state identifier as a value; the analysis module judges whether the service message contains a first service type identifier in the service type analysis rule under the condition that the service type analysis rule is in an enabled state; if yes, the analysis module determines that the first service type of the service message is the service type defined by the first service type identifier; if not, the analysis module traverses the next service type analysis rule until the first service type of the service message is determined.
Optionally, the apparatus further comprises: and the storage module is used for performing persistence processing on the service message after the receiving module receives the service message downloaded by the upstream system.
To achieve the above object, according to still another aspect of the present invention, there is provided an electronic apparatus.
The electronic device of the present invention includes: one or more processors; and storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the service message processing method of the present invention.
To achieve the above object, according to still another aspect of the present invention, there is provided a computer-readable medium.
The computer readable medium of the present invention has stored thereon a computer program which, when executed by a processor, implements the service message processing method of the present invention.
One embodiment of the above invention has the following advantages or benefits: after receiving a service message downloaded by an upstream system, analyzing the service message to determine a first service type of the service message; inquiring the corresponding relation between the service and the channel according to the first service type of the service message to determine a message queue channel corresponding to the first service type; the steps of sending the service message to the message queue channel corresponding to the first service type can split the service messages of different service types to different message queue channels, reduce the pressure on a downstream system, improve the running stability of the downstream system, and facilitate the separation and decoupling of subsequent service processing logics.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a service packet processing method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a main flow of a service packet processing method according to another embodiment of the present invention;
FIG. 3 is a schematic diagram of the main modules of a service packet processing apparatus according to an embodiment of the present invention;
fig. 4 is a schematic diagram of main modules of a service packet processing apparatus according to another embodiment of the present invention;
FIG. 5 is one of exemplary system architecture diagrams in which embodiments of the present invention may be employed;
FIG. 6 is a second exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 7 is a block diagram of a computer system suitable for use with the electronic device to implement an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
Fig. 1 is a schematic diagram of a main flow of a service packet processing method according to an embodiment of the present invention. As shown in fig. 1, the method for processing a service packet according to the embodiment of the present invention includes:
and step S101, receiving a service message downloaded by an upstream system.
In this step, a service packet downloaded by an upstream system may be received based on an RPC (remote procedure call protocol) interface. For example, when the upstream system is an ordering system, the second service type of the service packet downloaded by the upstream system may be an order, a rejected entering order, a returned providing order, or the like.
Step S102, analyzing the service message to determine a first service type of the service message.
In this step, the first service type identifier carried by the service packet may be obtained by analyzing the service packet. Wherein the first traffic type is a sub-traffic type of the second traffic type. For example, for the second business type, the subsytem (i.e., the first business type) covered by the order may be a bin-to-bin order, a bin-to-out order, a source bin order, a size-to-bin order, etc.
Step S103, inquiring the corresponding relation between the service and the channel according to the first service type of the service message so as to determine the message queue channel corresponding to the first service type.
In an optional example, the correspondence between the service and the channel adopts a Map (Map is a collection for storing key value pairs) data structure. The Map data structure may include a plurality of Key-Value pairs identified by a first service type as Key and a corresponding message queue channel as Value. In another optional example, the correspondence between the service and the channel adopts a data structure such as a database table.
And step S104, sending the service message to a message queue channel corresponding to the first service type.
In the embodiment of the invention, after receiving a service message downloaded by an upstream system, analyzing the service message to determine a first service type of the service message; inquiring the corresponding relation between the service and the channel according to the first service type of the service message to determine a message queue channel corresponding to the first service type; the steps of sending the service message to the message queue channel corresponding to the first service type can split the service messages of different service types to different message queue channels, reduce the pressure on a downstream system, improve the running stability of the downstream system, and facilitate the separation and decoupling of subsequent service processing logics.
Fig. 2 is a schematic diagram of a main flow of a service packet processing method according to another embodiment of the present invention. As shown in fig. 2, the method for processing a service packet according to the embodiment of the present invention includes:
step S201, receiving a service message of an upstream system based on an RPC interface.
For example, the Service interface can be provided to other systems through a JSF interface (an RPC interface, which is a Service interface published on a Service Framework such as a Jingdong Service Framework). For example, when the upstream system is an ordering system, the second service type of the service packet downloaded by the upstream system may be an order, a rejected entering order, a returned providing order, or the like.
Step S202, the service message is processed in a persistent mode.
In this step, the persistence processing may be to store the received service packet in a database table. By carrying out persistence processing on the service message, the service message can be acquired from the database table when the abnormity occurs, so that the problems that the service message cannot be subsequently re-consumed and the like are solved. In addition, the method of the embodiment of the invention can also comprise the following steps: and constructing a visual page based on the stored service messages so as to quickly locate the corresponding service messages through the visual page when the abnormity occurs.
Step S203, calling a factory class according to the second service type identifier carried by the service message to create a service message splitting processing example corresponding to the second service type.
The second service type may be in a one-to-one correspondence with the service packet splitting processing instance, or may be in a many-to-one correspondence. For example, if the second service type has a type such as an order, a rejection stock entry, a withdrawal receipt, etc., the type of the order may correspond to the service packet splitting example 1, and the other types such as the rejection stock entry, the withdrawal receipt, etc. may correspond to the service packet splitting example 2. Furthermore, in this step, if the second service type identifier carried in the service packet is an order identifier, a factory type creation service packet splitting processing example 1 is called; and if the second service type identifier carried by the service message is other types of identifiers such as a rejection warehousing entry, a withdrawal supply entry and the like, calling a factory type to establish a service message splitting processing example 2.
In the embodiment of the present invention, a service packet splitting processing instance corresponding to the second service type is created in a factory mode, and subsequent steps such as step S204 and step S205 are executed by the corresponding service packet splitting processing instance, so that further decoupling of the service splitting processing logic can be achieved.
Step S204, loading a configuration file, and analyzing the service message according to a service type analysis rule in the configuration file to determine a first service type of the service message.
Wherein the first traffic type is a sub-traffic type of the second traffic type. For example, for the second business type, the subsytem (i.e., the first business type) covered by the order may be a bin-to-bin order, a bin-to-out order, a source bin order, a size-to-bin order, etc.
In specific implementation, the configuration file can be loaded through the injection-dependent function of the Spring framework (the Spring framework is a container framework with light-weight control inversion and facing to the section).
In an optional example, the configuration file may be an XML configuration file, and the XML configuration file includes two Map data structures, which are a set of service type parsing rules and a set of service and channel correspondence, respectively. The service type analysis rule set may include a plurality of service type analysis rules, and each service type analysis rule is a key value pair having the first service type identifier as a key and the enabled state identifier as a value. Further, the enabling status flag may include two possible values: the first value (e.g., true) indicates that the service type parsing rule is in an enabled state, and the second value (e.g., false) indicates that the service type parsing rule is in a non-enabled state.
In this optional example, parsing the service packet according to a service type parsing rule to determine a first service type of the service packet includes: step A, traversing a service type analysis rule, and judging whether the service type analysis rule is in an enabled state; step B, under the condition that the service type analysis rule is in the starting state, judging whether the service message contains a first service type identifier in the service type analysis rule; step C, under the condition that the service message contains a first service type identifier in the service type analysis rule, determining that the first service type of the service message is the service type defined by the first service type identifier; and D, traversing the next service type analysis rule under the condition that the service message does not contain the first service type identifier in the service type analysis rule or the service type analysis rule is in a non-starting state until the first service type of the service message is determined.
In a specific example, the set of traffic type resolution rules includes the following traffic type resolution rules: the term "value" includes "1 _ 1"/>, "1 _ 2"/>, "value" 1 "/>," 2_1+5_1 "/>," 2 "/>. The entry key is "1 _ 1" and the value of the first service type identifier is "1 _ 1", which indicates that the first bit in the target character string is 1, the value of "2" is an enabling state identifier, and the value of "2" indicates that the service type parsing rule is in an enabling state; the entry key is "1 _ 2" and is a first service type identifier, the value of the first service type identifier is "1 _ 2" which indicates that the first bit in the target character string is 2, the value of "1" is an enabled state identifier, and the value of "1" indicates that the service type parsing rule is in a non-enabled state; the entry key is "2 _1+5_ 1" and is a first service type identifier, the value of the first service type identifier is "2 _1+5_ 1" and indicates that the 2 nd bit in the target character string is 1 and the 5 th bit is 1, the value of "2" is an enabled state identifier, and the value of "2" indicates that the service type parsing rule is in an enabled state. After the configuration file is loaded, first, a first business type analysis rule is traversed, and a value in the first business type analysis rule is judged. Since the value in the first service type parsing rule is 2 (indicating that the parsing rule is in the enabled state), it is determined whether the 1 st bit of a target character string (e.g., sendpay field) in the service message is 1, if the 1 st bit of the target character string in the service message is 1, it is determined that the first service type of the service message is the service type defined by the first service type identifier entry key ═ 1_1, and if the 1 st bit of the target character string in the service message is not 1, the second service type parsing rule is traversed until the first service type of the service message is determined.
Step S205, inquiring the corresponding relation between the service and the channel according to the first service type of the service message to determine the message queue channel corresponding to the first service type.
In one example, the set of service-to-channel correspondences in the configuration file includes the following service-to-channel correspondences: the term "value" includes "service 1_ topo"/>, "value" 1_2 "value" service2_ topo "/>, and" value "2 _1+5_ 1" value "service 3_ topo/>. Further, in this step, if the first service type of the service packet determined in step S204 is the service type defined by entry key ═ 1_1 ", the corresponding message queue channel is" service1_ topoc "; if the first service type of the service packet determined in step S204 is the service type defined by entry key ═ 2_1+5_1, "the corresponding message queue channel is" service3_ topoc.
Step S206, the service message is sent to a message queue channel corresponding to the first service type.
Further, after the service messages of different service types are sent to different message queue channels, the service processing servers can be respectively and independently deployed for the split service messages, so that physical isolation of each service during subsequent processing is realized, and the running stability of a downstream system is ensured. In addition, after step S206, the relevant data of each split service packet (for example, the service packet data in each message queue channel) may also be written into the task table, so as to perform subsequent operations such as current limiting on each message queue channel.
In the embodiment of the invention, the service message is subjected to persistence processing after being received, and the service message can be acquired from the database table when the abnormity occurs, so that the problems of data loss, incapability of re-consuming the service message in the follow-up process and the like are solved; the method comprises the steps of analyzing a service message to determine a first service type of the service message, inquiring the corresponding relation between the service and a channel according to the first service type of the service message to determine a message queue channel corresponding to the first service type, and sending the service message to the message queue channel corresponding to the first service type, so that the service messages of different service types can be split into different message queue channels, the pressure on a downstream system is reduced, the running stability of the downstream system is improved, and the separation and the decoupling of subsequent service processing logics are facilitated.
Fig. 3 is a schematic diagram of main modules of a service packet processing apparatus according to an embodiment of the present invention. As shown in fig. 3, a service packet processing apparatus 300 according to an embodiment of the present invention includes: a receiving module 301, a parsing module 302, a determining module 303, and a sending module 304.
The receiving module 301 is configured to receive a service packet downloaded by an upstream system.
Specifically, the receiving module 301 may receive a service packet downloaded by an upstream system based on an RPC (remote procedure call protocol) interface. For example, when the upstream system is an ordering system, the second service type of the service packet downloaded by the upstream system may be an order, a rejected entering order, a returned providing order, or the like.
The parsing module 302 is configured to parse the service packet to determine a first service type of the service packet.
Specifically, the parsing module 302 may parse the service packet to obtain a first service type identifier carried in the service packet. Wherein the first traffic type is a sub-traffic type of the second traffic type. For example, for the second business type, the subsytem (i.e., the first business type) covered by the order may be a bin-to-bin order, a bin-to-out order, a source bin order, a size-to-bin order, etc.
The determining module 303 is configured to query a correspondence between a service and a channel according to a first service type of the service packet, so as to determine a message queue channel corresponding to the first service type.
In an optional example, the correspondence between the service and the channel adopts a Map data structure. The Map data structure may include a plurality of Key-Value pairs identified by a first service type as Key and a corresponding message queue channel as Value. In this alternative example, the determining module 303 may query the Map data structure according to the first service type identifier parsed by the parsing module 302 to obtain a message queue channel identifier corresponding to the first service type identifier.
In another optional example, the correspondence between the service and the channel may also adopt a data structure such as a database table.
A sending module 304, configured to send the service packet to a message queue channel corresponding to the first service type.
In the embodiment of the invention, a receiving module receives a service message downloaded by an upstream system, an analyzing module analyzes the service message to determine a first service type of the service message, a determining module queries the corresponding relation between a service and a channel according to the first service type of the service message to determine a message queue channel corresponding to the first service type, and a sending module sends the service message to the message queue channel corresponding to the first service type, so that the service messages of different service types can be split into different message queue channels, the pressure on a downstream system is reduced, the running stability of the downstream system is improved, and the separation and decoupling of subsequent service processing logics are facilitated.
Fig. 4 is a schematic diagram of main modules of a service packet processing apparatus according to another embodiment of the present invention. As shown in fig. 4, a service packet processing apparatus 400 according to an embodiment of the present invention includes: a receiving module 401, a saving module 402, a creating module 403, an analyzing module 404, a determining module 405, and a sending module 406.
A receiving module 401, configured to receive a service packet of an upstream system based on an RPC interface. For example, the receiving module 401 may provide a Service interface to other systems through a JSF interface (a RPC interface, which is a Service interface published on a Jingdong Service Framework). For example, when the upstream system is an ordering system, the second service type of the service packet downloaded by the upstream system may be an order, a rejected entering order, a returned providing order, or the like.
The storing module 402 is configured to perform persistence processing on the service packet after the receiving module 401 receives the service packet of the upstream system. Illustratively, the persistence process performed by the save module 402 may be: and storing the received service message into a database table. The service message is subjected to persistence processing by the storage module 402, and the service message can be acquired from the database table when an exception occurs, so that the problems that the service message cannot be re-consumed subsequently and the like are solved.
A creating module 403, configured to invoke a factory class according to the second service type identifier carried in the service packet, so as to create a service packet splitting processing instance corresponding to the second service type. Wherein, the first service type is a sub-service type under the second service type; the split processing instance includes a parsing module 404, a determining module 405, and a sending module 406.
The second service type may be in a one-to-one correspondence with the service packet splitting processing instance, or may be in a many-to-one correspondence. For example, if the second service type has a type such as an order, a rejection stock entry, a withdrawal receipt, etc., the type of the order may correspond to the service packet splitting example 1, and the other types such as the rejection stock entry, the withdrawal receipt, etc. may correspond to the service packet splitting example 2. Furthermore, if the second service type identifier carried in the service packet is an order identifier, the creating module 403 calls a factory type creating service packet splitting processing example 1; if the second service type identifier carried in the service packet is another type identifier such as a rejection warehousing entry, a withdrawal supply entry, etc., the creating module 403 calls a factory type creating service packet splitting processing example 2.
In the embodiment of the present invention, the creating module 403 creates the service packet splitting processing instance corresponding to the second service type in the factory mode, and performs subsequent splitting processing through the corresponding service packet splitting processing instance, so as to further decouple the service splitting processing logic.
The parsing module 404 is configured to load a configuration file, and parse the service packet according to a service type parsing rule in the configuration file, so as to determine a first service type of the service packet.
In particular, the parsing module 404 may load the configuration file through a dependent injection function of a Spring framework (the Spring framework is a lightweight control inversion and a container framework facing a cutting plane).
In an optional example, the configuration file may be an XML configuration file, and the XML configuration file includes two Map data structures, which are a set of service type parsing rules and a set of service and channel correspondence, respectively. The service type analysis rule set may include a plurality of service type analysis rules, and each service type analysis rule is a key value pair having the first service type identifier as a key and the enabled state identifier as a value. Further, the enabling status flag may include two possible values: the first value (e.g., true) indicates that the service type parsing rule is in an enabled state, and the second value (e.g., false) indicates that the service type parsing rule is in a non-enabled state.
In this optional example, the parsing module 404 parses the service packet according to a service type parsing rule to determine the first service type of the service packet includes: step A, an analysis module 404 traverses a service type analysis rule and judges whether the service type analysis rule is in an enabled state; step B, under the condition that the service type analysis rule is in the enabled state, the analysis module 404 determines whether the service packet includes the first service type identifier in the service type analysis rule; step C, under the condition that the service message includes the first service type identifier in the service type analysis rule, the analysis module 404 determines that the first service type of the service message is the service type defined by the first service type identifier; and step D, under the condition that the service message does not include the first service type identifier in the service type analysis rule, or the service type analysis rule is in a non-enabled state, the analysis module 404 traverses the next service type analysis rule until the first service type of the service message is determined.
The determining module 405 is configured to query a correspondence between a service and a channel according to a first service type of the service packet, so as to determine a message queue channel corresponding to the first service type.
In one example, the set of service-to-channel correspondences in the configuration file includes the following service-to-channel correspondences: the term "value" includes "service 1_ topo"/>, "value" 1_2 "value" service2_ topo "/>, and" value "2 _1+5_ 1" value "service 3_ topo/>. Furthermore, in this step, if the first service type of the service packet determined by the parsing module 404 is the service type defined by entry key ═ 1_1 ", the corresponding message queue channel determined by the determining module 405 is" service1_ topic "; if the first service type of the service packet determined by the parsing module 404 is a service type defined by "2 _1+5_ 1", the corresponding message queue channel determined by the determining module 405 is "service 3_ topoc".
A sending module 406, configured to send the service packet to a message queue channel corresponding to the first service type.
In the embodiment of the invention, the received service message is subjected to persistence processing through the storage module, and the service message can be acquired from the database table when the abnormity occurs, so that the problems of data loss, incapability of re-consuming the service message in the follow-up process and the like are solved; the method comprises the steps of analyzing a service message through an analysis module to determine a first service type of the service message, inquiring a corresponding relation between a service and a channel according to the first service type of the service message through the analysis module to determine a message queue channel corresponding to the first service type, and sending the service message to the message queue channel corresponding to the first service type through a sending module, so that the service messages of different service types can be split to different message queue channels, the pressure on a downstream system is reduced, the running stability of the downstream system is improved, and the separation and decoupling of subsequent service processing logics are facilitated.
Fig. 5 is one of exemplary system architecture diagrams in which embodiments of the present invention may be employed. As shown in fig. 5, the exemplary system architecture includes: the system comprises an upstream system 501, a service message processing device 502, a message queue channel 1503, a message queue channel 2504 and a message queue channel N505.
The upstream system 501 is configured to download a service packet. Illustratively, the upstream system may be an ordering system, and the second service type of the downloaded service packet may be an order, a rejection order, a withdrawal order, or the like.
The service packet processing device 502 is configured to receive a service packet downloaded by an upstream system, and then parse the service packet to determine a first service type of the service packet. Wherein the first traffic type is a sub-traffic type of the second traffic type. For example, for the second business type, the subsytem (i.e., the first business type) covered by the order may be a bin-to-bin order, a bin-to-out order, a source bin order, a size-to-bin order, etc.
The service packet processing device 502 is further configured to query a correspondence between a service and a channel according to a first service type of the service packet to determine a message queue channel corresponding to the first service type, and further configured to send the service packet to the message queue channel corresponding to the first service type.
The message queue channel 1503, the message queue channel 2504, and the message queue channel N505 are configured to store the service packet sent by the service packet processing apparatus 502.
In the embodiment of the invention, the service messages of different service types can be split to different message queue channels after the order is received through the system architecture, so that the pressure on a downstream system is reduced, the running stability of the downstream system is improved, and the separation and the decoupling of subsequent service processing logics are facilitated.
Fig. 6 shows an exemplary system architecture 600 to which a service packet processing method or a service packet processing apparatus according to an embodiment of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. Various communication client applications, such as ordering system applications, warehouse management platform applications, and the like, may be installed on the terminal devices 601, 602, and 603.
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server that provides various services, such as a background management server that provides support for ordering system applications browsed by the user using the terminal devices 601, 602, 603. The background management server can split and process the received data such as the service message and send the split service message to the corresponding message queue channel.
It should be noted that the service packet processing method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the service packet processing apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with the electronic device implementing an embodiment of the present invention. The computer system illustrated in FIG. 7 is only an example and should not impose any limitations on the scope of use or functionality of embodiments of the invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a receiving module, a parsing module, a determining module, and a sending module. The names of these modules do not form a limitation on the module itself in some cases, for example, the receiving module may also be described as a "module that receives a service packet downloaded by an upstream system".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform the following: receiving a service message downloaded by an upstream system; analyzing the service message to determine a first service type of the service message; inquiring the corresponding relation between the service and the channel according to the first service type of the service message to determine a message queue channel corresponding to the first service type; and sending the service message to a message queue channel corresponding to the first service type.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for processing service messages is characterized in that the method comprises the following steps:
receiving a service message downloaded by an upstream system;
analyzing the service message to determine a first service type of the service message;
inquiring the corresponding relation between the service and the channel according to the first service type of the service message to determine a message queue channel corresponding to the first service type;
and sending the service message to a message queue channel corresponding to the first service type.
2. The method of claim 1, further comprising:
after the step of receiving the service message downloaded by the upstream system is executed, calling a factory class according to a second service type identifier carried by the service message to create a service message splitting processing example corresponding to the second service type; wherein the first service type is a sub-service type under the second service type.
3. The method of claim 1, wherein the parsing the service packet to determine the first service type of the service packet comprises:
loading a configuration file; the configuration file comprises a plurality of service type analysis rules, and each service type analysis rule is a key value pair which takes a first service type identifier as a key and takes an activation state identifier as a value; under the condition that the service type analysis rule is in an enabled state, judging whether the service message contains a first service type identifier in the service type analysis rule; if yes, determining that the first service type of the service message is the service type defined by the first service type identifier; if not, traversing the next service type analysis rule until determining the first service type of the service message.
4. The method of claim 1, further comprising:
and after the step of receiving the service message downloaded by the upstream system is executed, performing persistence processing on the service message.
5. A service packet processing apparatus, wherein the apparatus comprises:
the receiving module is used for receiving the service message downloaded by the upstream system;
the analysis module is used for analyzing the service message to determine a first service type of the service message;
the determining module is used for inquiring the corresponding relation between the service and the channel according to the first service type of the service message so as to determine a message queue channel corresponding to the first service type;
and the sending module is used for sending the service message to a message queue channel corresponding to the first service type.
6. The apparatus of claim 5, further comprising:
the creating module is used for calling a factory class according to a second service type identifier carried by the service message so as to create a service message splitting processing example corresponding to the second service type; wherein, the first service type is a sub-service type under the second service type; the splitting processing instance comprises the parsing module, the determining module and the sending module.
7. The apparatus of claim 5, wherein the parsing module parses the service packet to determine the first service type of the service packet comprises:
the analysis module loads a configuration file; the configuration file comprises a plurality of service type analysis rules, and each service type analysis rule is a key value pair which takes a first service type identifier as a key and takes an activation state identifier as a value; the analysis module judges whether the service message contains a first service type identifier in the service type analysis rule under the condition that the service type analysis rule is in an enabled state; if yes, the analysis module determines that the first service type of the service message is the service type defined by the first service type identifier; if not, the analysis module traverses the next service type analysis rule until the first service type of the service message is determined.
8. The apparatus of claim 5, further comprising:
and the storage module is used for performing persistence processing on the service message after the receiving module receives the service message downloaded by the upstream system.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method of any one of claims 1 to 4.
CN201910816045.9A 2019-08-30 2019-08-30 Service message processing method and device Active CN112445868B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910816045.9A CN112445868B (en) 2019-08-30 2019-08-30 Service message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910816045.9A CN112445868B (en) 2019-08-30 2019-08-30 Service message processing method and device

Publications (2)

Publication Number Publication Date
CN112445868A true CN112445868A (en) 2021-03-05
CN112445868B CN112445868B (en) 2024-04-12

Family

ID=74734104

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910816045.9A Active CN112445868B (en) 2019-08-30 2019-08-30 Service message processing method and device

Country Status (1)

Country Link
CN (1) CN112445868B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113114776A (en) * 2021-04-20 2021-07-13 北京京东振世信息技术有限公司 Data pushing method and device
CN113612773A (en) * 2021-08-03 2021-11-05 厦门至恒融兴信息技术股份有限公司 Intelligent message identification and analysis system and method realized by artificial intelligence
CN114928663A (en) * 2022-06-02 2022-08-19 蜂助手股份有限公司 Method and device for recognizing callback message
CN115208947A (en) * 2022-09-16 2022-10-18 北京中科江南信息技术股份有限公司 Business information pushing method, system and storage medium
CN116934271A (en) * 2023-08-08 2023-10-24 上海中汇亿达金融信息技术有限公司 Service processing method, device, electronic equipment and medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7334015B1 (en) * 2000-10-27 2008-02-19 Vestacare, Inc. Integration of legacy mainframe systems through data stream objectification into finite state machines
CN101471854A (en) * 2007-12-29 2009-07-01 华为技术有限公司 Method and device for forwarding message
CN101655795A (en) * 2009-09-25 2010-02-24 金蝶软件(中国)有限公司 Method for creating service embodiment and enterprise resource planning system
CN105306277A (en) * 2015-11-19 2016-02-03 中国建设银行股份有限公司 Message scheduling method and message scheduling device for message queues
CN105681346A (en) * 2016-03-15 2016-06-15 福建星海通信科技有限公司 Method for realizing message analysis based on factory class
CN106385378A (en) * 2016-08-31 2017-02-08 北京神州绿盟信息安全科技股份有限公司 Processing method and device for controlling message in in-band management control
CN106899452A (en) * 2017-02-23 2017-06-27 江苏徐工信息技术股份有限公司 A kind of internet-of-things terminal adjustment method of the message loop treatment based on XM2M agreements
CN108009028A (en) * 2017-11-29 2018-05-08 中国平安人寿保险股份有限公司 Message treatment method, device, equipment and computer-readable recording medium
CN109639653A (en) * 2018-11-29 2019-04-16 中国人民银行清算总中心 Message transmitting method and system based on distributed internet banking system
CN109889375A (en) * 2019-01-23 2019-06-14 中国银行股份有限公司 Service message method of calibration, device and computer storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7334015B1 (en) * 2000-10-27 2008-02-19 Vestacare, Inc. Integration of legacy mainframe systems through data stream objectification into finite state machines
CN101471854A (en) * 2007-12-29 2009-07-01 华为技术有限公司 Method and device for forwarding message
CN101655795A (en) * 2009-09-25 2010-02-24 金蝶软件(中国)有限公司 Method for creating service embodiment and enterprise resource planning system
CN105306277A (en) * 2015-11-19 2016-02-03 中国建设银行股份有限公司 Message scheduling method and message scheduling device for message queues
CN105681346A (en) * 2016-03-15 2016-06-15 福建星海通信科技有限公司 Method for realizing message analysis based on factory class
CN106385378A (en) * 2016-08-31 2017-02-08 北京神州绿盟信息安全科技股份有限公司 Processing method and device for controlling message in in-band management control
CN106899452A (en) * 2017-02-23 2017-06-27 江苏徐工信息技术股份有限公司 A kind of internet-of-things terminal adjustment method of the message loop treatment based on XM2M agreements
CN108009028A (en) * 2017-11-29 2018-05-08 中国平安人寿保险股份有限公司 Message treatment method, device, equipment and computer-readable recording medium
CN109639653A (en) * 2018-11-29 2019-04-16 中国人民银行清算总中心 Message transmitting method and system based on distributed internet banking system
CN109889375A (en) * 2019-01-23 2019-06-14 中国银行股份有限公司 Service message method of calibration, device and computer storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邓子云;黄婧;谢艳梅;杨晓峰;: "一种XML报文自动处理引擎的关键技术", 西南科技大学学报, no. 02, 15 June 2010 (2010-06-15) *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113114776A (en) * 2021-04-20 2021-07-13 北京京东振世信息技术有限公司 Data pushing method and device
CN113612773A (en) * 2021-08-03 2021-11-05 厦门至恒融兴信息技术股份有限公司 Intelligent message identification and analysis system and method realized by artificial intelligence
CN114928663A (en) * 2022-06-02 2022-08-19 蜂助手股份有限公司 Method and device for recognizing callback message
CN115208947A (en) * 2022-09-16 2022-10-18 北京中科江南信息技术股份有限公司 Business information pushing method, system and storage medium
CN116934271A (en) * 2023-08-08 2023-10-24 上海中汇亿达金融信息技术有限公司 Service processing method, device, electronic equipment and medium
CN116934271B (en) * 2023-08-08 2024-02-02 上海中汇亿达金融信息技术有限公司 Service processing method, device, electronic equipment and medium

Also Published As

Publication number Publication date
CN112445868B (en) 2024-04-12

Similar Documents

Publication Publication Date Title
CN112445868B (en) Service message processing method and device
CN112860451A (en) Multi-tenant data processing method and device based on SaaS
CN112148711B (en) Batch processing task processing method and device
CN108897854B (en) Monitoring method and device for overtime task
CN111917687A (en) Method and device for circularly pushing reminding message
CN111427701A (en) Workflow engine system and business processing method
CN111478781B (en) Message broadcasting method and device
CN114297278A (en) Method, system and device for quickly writing batch data
CN112084042B (en) Message processing method and device
CN114979295A (en) Gateway management method and device
CN109981546B (en) Method and device for acquiring remote call relation between application modules
CN113282589A (en) Data acquisition method and device
CN112948138A (en) Method and device for processing message
CN110764769A (en) Method and device for processing user request
CN114979256A (en) Message pushing method and device, electronic equipment and computer readable medium
CN113297087A (en) Test method and device
CN110909269B (en) Log reporting method and device
CN113779018A (en) Data processing method and device
CN112099841A (en) Method and system for generating configuration file
CN113448652A (en) Request processing method and device
CN113556370A (en) Service calling method and device
CN113760886B (en) Method, apparatus, device and computer readable medium for providing data service
CN115309612B (en) Method and device for monitoring data
CN110830662A (en) Outbound call data generation method and device
CN116112880B (en) MQ-based high concurrency short message sending method and device

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