A message state query method, device, apparatus and storage medium

By obtaining status query instructions and delivering messages to the message middleware under certain delivery conditions, the load pressure on the business system caused by the native API of the message middleware is solved, and efficient message status query and delivery are achieved.

CN115510098BActive Publication Date: 2025-11-04JIALIAN PAYMENTS CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110693086.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-22
Publication Date
2025-11-04
Estimated Expiration
2041-06-22

AI Technical Summary

Technical Problem

The native API message status query of existing message middleware puts a load on the connected business systems, and the simple message status query cannot meet the business needs.

Method used

By obtaining status query instructions, the status of business messages is determined, and the messages are delivered to the message middleware when the delivery conditions are met. By combining the interaction between the business system, the third-party message system and the message middleware, message status query and delivery can be realized.

Benefits of technology

It effectively reduced the processing pressure on the business system, met the business system's need for message status query, and improved the efficiency of message delivery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115510098B_ABST
    Figure CN115510098B_ABST
Patent Text Reader

Abstract

The application discloses a message state query method and device, equipment and a storage medium, which are applied to a third-party message system interacting with a business system and a message middleware respectively, and comprises the following steps: obtaining a first state query instruction, determining a first state of a business message corresponding to the first state query instruction; the first state is a state corresponding to the business message recorded in the third-party message system; if the first state of the business message meets a delivery condition, the business message is delivered to the message middleware. According to the application, the first state query instruction is obtained, then the first state of the business message corresponding to the first state query instruction is determined, and the business message is delivered to the message middleware when the first state meets the delivery condition, so that the state of the business message can be queried based on the interaction between the business system, the third-party message system and the message middleware, then the message delivery is realized, and the processing pressure of the business system is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication, in particular to a message state query method and device, equipment and storage medium. BACKGROUND

[0002] Message middleware is a common component in software systems, and is often used in communication scenarios between multiple services under a micro-service architecture, and usually has message accumulation and persistence capabilities. Using message middleware can alleviate communication loss, timeouts and other problems caused by fluctuations or inconsistencies in processing capabilities between services.

[0003] Currently, the native API message state query of the message middleware can cause load pressure on the accessed business system, and simple message state query through the message middleware cannot meet business requirements. Therefore, how to provide an efficient message state query method is a technical problem that needs to be solved by those skilled in the art. SUMMARY

[0004] Therefore, the purpose of the present application is to provide a message query method, device, equipment and storage medium, which can query the state of a business message based on the interaction between the business system, the third-party message system and the message middleware, and then implement message delivery, effectively reducing the processing pressure of the business system. The specific scheme is as follows:

[0005] The first aspect of the present application provides a message state query method applied to a third-party message system interacting with a business system and a message middleware respectively, comprising:

[0006] obtaining a first state query instruction and determining a first state of a business message corresponding to the first state query instruction; wherein the first state is a state corresponding to the business message recorded in the third-party message system;

[0007] If the first state of the business message meets the delivery condition, the business message is delivered to the message middleware.

[0008] Optionally, if the first state of the business message meets the delivery condition, the business message is delivered to the message middleware, comprising:

[0009] If the first state of the business message is a submission state, the business message is delivered to the message middleware.

[0010] Optionally, after determining the first state of the business message corresponding to the first state query instruction, the method further comprises:

[0011] If the first state of the business message is a cancelled state or a committed state, stop processing the business message.

[0012] Optionally, after determining the first state of the business message corresponding to the first state query instruction, the method further comprises:

[0013] If the first state of the business message is an unknown state or an initialization state, a second state query instruction corresponding to the business message is sent to the business system, so that the business system determines and returns a second state of the business message according to the second query instruction; wherein the unknown state represents that the state corresponding to the business message is not queried in the third-party message system.

[0014] The second state of the business message sent by the business system is received, and if the second state meets the delivery condition, the business message is delivered to the message middleware.

[0015] Optionally, if the second state of the business message meets the delivery condition, the business message is delivered to the message middleware, comprising:

[0016] If the second state of the business message is the committed state, the business message is delivered to the message middleware.

[0017] Correspondingly, after receiving the second state of the business message sent by the business system, the method further comprises:

[0018] If the second state of the business message is the unknown state, the operation of repeatedly sending the second state query instruction corresponding to the business message to the business system is repeated to obtain a new state of the business message returned by the business system, and the business message is processed according to the new state of the business message.

[0019] Optionally, the first state query instruction is triggered by a delay message set by the third-party message system for the business message.

[0020] Optionally, according to the new state of the business message, the business message is processed accordingly, comprising:

[0021] When the new state of the business message is the committed state, the business message is delivered to the message middleware.

[0022] If the new state of the business message is the unknown state, it is determined whether the number of operations of repeatedly sending the second state query instruction corresponding to the business message to the business system is within a preset number range. If yes, the delay message is set for the business message again, so that the message middleware queries the state of the business message according to the delay message. If no, the business message is stored to a database.

[0023] The second aspect of the present application provides a message state query device applied to a third-party message system interacting with a business system and a message middleware respectively, comprising:

[0024] The obtaining module is configured to obtain a first state query instruction and determine a first state of a business message corresponding to the first state query instruction, wherein the first state is a state corresponding to the business message recorded in the third-party message system.

[0025] The judging module is configured to deliver the business message to the message middleware if the first state of the business message meets a delivery condition.

[0026] The third aspect of the present application provides an electronic device comprising a processor and a memory; wherein the memory is configured to store a computer program, the computer program is loaded and executed by the processor to realize the message state query method.

[0027] The fourth aspect of the present application provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions are loaded and executed by a processor to realize the message state query method.

[0028] The message state query method in the present application is applied to a third-party message system interacting with a business system and a message middleware respectively. First, a first state query instruction is obtained, and a first state of a business message corresponding to the first state query instruction is determined. The first state is a state corresponding to the business message recorded in the third-party message system. If the first state of the business message meets a delivery condition, the business message is delivered to the message middleware. The present application can query the state of the business message based on the interaction between the business system, the third-party message system and the message middleware, and then realize message delivery, thereby effectively reducing the processing pressure of the business system. BRIEF DESCRIPTION OF DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description only represent some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative effort based on the provided drawings.

[0030] Figure 1 A message state query method flowchart is provided for the present application;

[0031] Figure 2 A specific message state query method flowchart is provided for the present application;

[0032] Figure 3 Another specific message state query method flowchart is provided for the present application;

[0033] Figure 4 A message state query device structure schematic diagram is provided for the present application;

[0034] Figure 5 A message state query electronic equipment structure diagram is provided for the present application. DETAILED DESCRIPTION

[0035] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments only represent some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort fall within the scope of the present application.

[0036] Currently, the native API message state query of the message middleware will cause load pressure to the accessed business system, and simple message state query through the message middleware cannot meet the business requirements. In view of the above technical defects, the present application provides a message state query scheme, which acquires a first state query instruction, then determines a first state of a business message corresponding to the first state query instruction, and in the case that the first state meets a delivery condition, delivers the business message to the message middleware. The state of the business message can be queried based on the interaction between the business system, the third-party message system and the message middleware, and then the message delivery is realized, which effectively reduces the processing pressure of the business system.

[0037] Figure 1 A message state query method flowchart is provided for the embodiments of the present application. Referring to Figure 1 As shown in the figure, the message state query method is applied to a third-party message system which interacts with a business system and a message middleware respectively, and includes the following steps.

[0038] S11: acquire a first status query instruction and determine a first status of a service message corresponding to the first status query instruction; wherein the first status is a status corresponding to the service message recorded in the third-party message system.

[0039] In this embodiment, a first status query instruction is acquired first, and a first status of a service message corresponding to the first status query instruction is determined; wherein the first status is a status corresponding to the service message recorded in the third-party message system. It is not difficult to understand that a message status query operation needs to be driven by a request trigger, and the query instruction in this embodiment is the driving request, and the first status query instruction can be triggered automatically by the system or manually triggered to compensate for the delivery of the service message. The first status can be stored in the third-party message system in the form of a remote dictionary service (Redis). In this embodiment, the status of the service message is an initialization state, a submission state, a submitted state, a canceled state or an unknown state, the initialization state indicates that the service message has been initialized, the submission state indicates that the service message is waiting to be submitted to the message middleware, the submitted state indicates that the service message has been submitted to the message middleware, the canceled state indicates that subsequent state queries cannot be initiated for the service message, and the unknown state indicates that the corresponding status of the service message is not queried in the third-party message system. Of course, there are many ways to define the message status, in addition to the above description, other definitions that can achieve the same technical effect also fall within the protection scope of the present scheme.

[0040] S12: if the first status of the service message meets the delivery condition, the service message is delivered to the message middleware.

[0041] In this embodiment, compensation delivery is only performed when the delivery status is the submission state, that is, if the first status of the service message is the submission state, the service message is delivered to the message middleware. Correspondingly, if the first status of the service message is the canceled state or the submitted state, the processing of the service message is stopped to end the status query operation of the service message.

[0042] In this embodiment, the third-party message system provides an interface of a hypertext transfer protocol (HTTP protocol) for the service system, without introducing additional dependencies, and only a commonly used HTTP client / server can be used to complete the access. The third-party message system includes a message query module and a message routing module, and the message query module acquires status information of the service message from the message routing module to complete steps S11 and S12.

[0043] It can be seen that the message state query method in the embodiment of the application is applied to a third-party message system that respectively interacts with a business system and a message middleware, a first state query instruction is acquired first, and a first state of a business message corresponding to the first state query instruction is determined; the first state is a state corresponding to the business message recorded in the third-party message system. If the first state of the business message meets a delivery condition, the business message is delivered to the message middleware. The embodiment of the application can query the state of the business message based on the interaction among the business system, the third-party message system and the message middleware, and then implement message delivery, thereby effectively reducing the processing pressure of the business system.

[0044] Figure 2 A specific message state query method flowchart is provided in the embodiment of the application. Referring to FIG. 21, Figure 2 the message state query method comprises the following steps.

[0045] S21: A first state query instruction is acquired, and a first state of a business message corresponding to the first state query instruction is determined; the first state is a state corresponding to the business message recorded in the third-party message system.

[0046] In the embodiment, the specific process of step S21 can refer to the corresponding content disclosed in the foregoing embodiments, which will not be described here. It needs to be supplemented that the first state query instruction in the embodiment is a delay message trigger set by the third-party message system for the business message. Specifically, the delay message is a message sent by the third-party message system to the message middleware, which records the id of the business message to be delivered by the business system. After a fixed time after delivery, the third-party message system will receive the delay message, and initiate a delivery state query for the business message without a determined delivery state according to the id of the business message attached in the delay message, and finally decide whether to deliver the business message according to the query result, as shown in FIG. 22. Figure 3

[0047] S22: If the first state of the business message is an unknown state or an initialization state, a second state query instruction corresponding to the business message is sent to the business system, so that the business system determines and returns a second state of the business message according to the second query instruction; the unknown state represents that the state corresponding to the business message is not queried in the third-party message system.

[0048] ​In the embodiment, if the first state of the service message is the unknown state or the initialization state, it indicates that the state corresponding to the service message is not queried in the third-party message system or the service message has been initialized but it is not determined whether it is submitted to the message middleware, at this time the subsequent processing of the message system cannot be determined, and the state backtracking of the service message needs to be performed to the service system, that is, the second state query instruction corresponding to the service message is sent to the service system, so that the service system determines and returns the second state of the service message according to the second query instruction. The first state represents what operation the service system wants the third-party message system to perform on the service system. In addition, in the process of determining the first state of the service message corresponding to the first state query instruction, for the case that the record of the service message does not exist in the Redis, the state backtracking operation can also be initiated to the service system.

[0049] S23: receiving the second state of the service message sent by the service system, and if the second state meets the delivery condition, delivering the service message to the message middleware.

[0050] S24: if the second state of the service message is the unknown state, repeating the operation of sending the second state query instruction corresponding to the service message to the service system to obtain the new state of the service message returned by the service system, and performing corresponding processing on the service message according to the new state of the service message.

[0051] In the embodiment, after receiving the second state of the service message sent by the service system, if the second state of the service message is the submission state, the service message is delivered to the message middleware. As shown in Figure 3 The message middleware can be RocketMQ, which is a widely used message middleware. Its message persistence accumulation capability, transaction-based message, retry push and other functions are widely used in software systems related to payment transactions. If the second state of the service message is the unknown state, the operation of sending the second state query instruction corresponding to the service message to the service system is repeated to obtain the new state of the service message returned by the service system, and corresponding processing is performed on the service message according to the new state of the service message.

[0052] Further, the specific process of performing corresponding processing on the service message according to the new state of the service message is referred to Figure 3In one aspect, when the new state of the business message is the commit state, the business message is delivered to the message middleware. In another aspect, when the new state of the business message is the unknown state, it is determined whether the number of operations of repeatedly sending the second state query instruction corresponding to the business message to the business system is within a preset number of times, that is, whether it is within the query number limit, and if so, the delay message is set for the business message again, so that the message middleware queries the state of the business message according to the delay message, and if not, the business message is stored to a database. That is, if the commit state is returned as unknown after multiple queries, active query is no longer performed, and at this time, the business message is written to the database for subsequent processing.

[0053] It can be understood that the business message in the unknown state may be caused by abnormal conditions such as transaction channel side timeout, network fluctuation, etc. For such business messages that cannot maintain the delivery state, the embodiment provides a unified compensation entry, which can complete the compensation delivery of the business message written to the database based on the message management platform through task scheduling or manual triggering. Specifically, the business message in the database record is queried, a message state query request is initiated to the message query module of the third-party message system, and a commit state backtracking -> return commit -> send message process is performed.

[0054] It can be seen that the embodiment of the present application further initiates a state backtracking request to the business system based on the unknown state of the business message in the third-party message system, and performs corresponding processing on the business message according to the message state returned by the business system. The simple message delivery state backtracking mechanism cannot meet the business requirements and the load pressure of the state query service on the business system, etc. The state of the business message can be queried based on the interaction between the business system, the third-party message system and the message middleware, and then the message delivery is realized.

[0055] Referring to Figure 4 The embodiment of the present application also discloses a message state query device, which is applied to a third-party message system interacting with a business system and a message middleware respectively, and comprises:

[0056] The obtaining module 11 is configured to obtain a first state query instruction and determine a first state of a business message corresponding to the first state query instruction; wherein the first state is a state corresponding to the business message recorded in the third-party message system.

[0057] The judging module 12 is configured to deliver the business message to the message middleware if the first state of the business message meets a delivery condition.

[0058] It can be seen that the message state query method in the embodiment of the application is applied to a third-party message system interacting with a business system and a message middleware respectively, a first state query instruction is acquired first, and a first state of a business message corresponding to the first state query instruction is determined; the first state is a state corresponding to the business message recorded in the third-party message system. If the first state of the business message meets a delivery condition, the business message is delivered to the message middleware. The embodiment of the application can query the state of the business message based on the interaction among the business system, the third-party message system and the message middleware, and then implement message delivery, thereby effectively reducing the processing pressure of the business system, by acquiring the first state query instruction, then determining the first state of the business message corresponding to the first state query instruction, and delivering the business message to the message middleware if the first state meets the delivery condition.

[0059] In some specific embodiments, the determining module 12 specifically comprises:

[0060] a first determining unit, configured to deliver the business message to the message middleware if the first state of the business message is a submitted state;

[0061] a second determining unit, configured to stop processing the business message if the first state of the business message is a cancelled state or a submitted state;

[0062] a third determining unit, configured to send a second state query instruction corresponding to the business message to the business system if the first state of the business message is an unknown state or an initialized state, so that the business system determines and returns a second state of the business message according to the second query instruction; the unknown state represents that the state corresponding to the business message is not queried in the third-party message system.

[0063] Correspondingly, the message state query apparatus further comprises a receiving module, configured to receive the second state of the business message sent by the business system, and deliver the business message to the message middleware if the second state meets the delivery condition.

[0064] In some specific embodiments, the receiving module specifically comprises:

[0065] a third determining unit, configured to deliver the business message to the message middleware if the second state of the business message is the submitted state;

[0066] The fourth judging unit is configured to, if the second state of the service message is the unknown state, repeatedly send the second state query instruction corresponding to the service message to the service system to obtain a new state of the service message returned by the service system, and perform corresponding processing on the service message according to the new state of the service message.

[0067] Further, the embodiment of the present application further provides an electronic device. Figure 5 The electronic device 20 structure diagram shown in the figure is according to an exemplary embodiment, and the content in the figure cannot be considered as any limitation on the use range of the present application.

[0068] Figure 5 The electronic device 20 structure diagram provided by the embodiment of the present application. The electronic device 20, specifically can include: at least one processor 21, at least one memory 22, power supply 23, communication interface 24, input output interface 25 and communication bus 26. Wherein, the memory 22 is used for storing computer program, the computer program is loaded and executed by the processor 21, to realize the related steps in the message state query method disclosed by any preceding embodiment. In addition, the electronic device 20 in the embodiment can be a server.

[0069] In the embodiment, the power supply 23 is used for providing working voltage for each hardware device on the electronic device 20; the communication interface 24 can create data transmission channel between the electronic device 20 and external device, and the communication protocol followed by the communication interface 24 can be any communication protocol applicable to the technical solution of the present application, which is not limited specifically herein; the input output interface 25 is used for obtaining external input data or outputting data to the outside world, and the specific interface type can be selected according to the specific application needs, which is not limited specifically herein.

[0070] In addition, the memory 22 as the carrier of resource storage can be read-only memory, random access memory, disk or optical disk, etc., and the resources stored thereon can include operating system 221, computer program 222 and data 223, etc., and the storage mode can be temporary storage or permanent storage.

[0071] The operating system 221 is configured to manage and control each hardware device on the electronic device 20 and the computer program 222, so as to realize the operation and processing of the processor 21 on the mass data 223 in the memory 22. The operating system 221 can be Windows Server, Netware, Unix, Linux, etc. The computer program 222 can further include computer programs for completing other specific work in addition to the computer programs for completing the message state query method disclosed by any of the foregoing embodiments and executed by the electronic device 20. The data 223 can include query instructions collected by the electronic device 20.

[0072] Further, the embodiment of the present application further discloses a storage medium, wherein the storage medium stores a computer program, and the computer program is loaded and executed by a processor to realize the message state query method steps disclosed by any of the foregoing embodiments.

[0073] The embodiments in the specification are described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same or similar parts of each embodiment can be referred to each other. For the device disclosed by the embodiments, since it corresponds to the method disclosed by the embodiments, the description is relatively simple, and the related parts can be referred to the method part.

[0074] Finally, it should be noted that, in this document, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0075] The message state query method, device, equipment and storage medium provided by the present application are described in detail above, and the principle and implementation manner of the present application are described by applying specific examples. The above embodiment description is only used to help understand the method and core idea of the present application; at the same time, for the general technical personnel in the art, according to the idea of the present application, the specific implementation manner and application range will be changed, and the above description should not be understood as the limitation of the present application.

Claims

1. A message status query method, characterized by, The third-party message system applied to interaction with a business system and a message middleware respectively comprises: a first state query instruction is acquired, and a first state of a business message corresponding to the first state query instruction is determined; the first state is a state corresponding to the business message recorded in the third-party message system, the first state query instruction is triggered by a delay message set by the third-party message system for the business message, the delay message is a message sent by the third-party message system to the message middleware, the delay message records an id of the business message, and the id of the business message is used to initiate a delivery state query for the business message without a determined delivery state; if the first state of the business message meets a delivery condition, the business message is delivered to the message middleware; if the first state of the business message is an unknown state or an initialization state, a second state query instruction corresponding to the business message is sent to the business system, so that the business system determines and returns a second state of the business message according to the second state query instruction; the unknown state represents that the state corresponding to the business message is not queried in the third-party message system; the second state of the business message sent by the business system is received, if the second state is a commit state, the business message is delivered to the message middleware, and if the second state of the business message is the unknown state, the operation of sending the second state query instruction corresponding to the business message to the business system is repeated to obtain a new state of the business message returned by the business system, and the business message is processed according to the new state of the business message.

2. The message status query method of claim 1, wherein, if the first state of the business message meets a delivery condition, the business message is delivered to the message middleware; if the first state of the business message is a commit state, the business message is delivered to the message middleware.

3. The message status query method of claim 2, wherein, after the first state of the business message corresponding to the first state query instruction is determined, the method further comprises: if the first state of the business message is a cancelled state or a committed state, the processing of the business message is stopped.

4. The message status query method of claim 1, wherein, the processing of the business message according to the new state of the business message comprises: when the new state of the business message is the commit state, the business message is delivered to the message middleware; when the new state of the business message is the unknown state, it is judged whether the number of times of repeating the operation of sending the second state query instruction corresponding to the business message to the business system is within a preset number range, if yes, the delay message is set for the business message again, so that the message middleware queries the state of the business message according to the delay message, and if no, the business message is stored to a database.

5. A message status query apparatus, characterized by comprising: the third-party message system applied to interaction with a business system and a message middleware respectively comprises: The acquisition module is configured to acquire a first state query instruction and determine a first state of a service message corresponding to the first state query instruction; the first state is a state corresponding to the service message recorded in the third-party message system; the first state query instruction is triggered by a delay message set by the third-party message system for the service message; the delay message is a message sent by the third-party message system to the message middleware; the delay message records an id of the service message; the id of the service message is used to initiate a delivery state query for the service message without a determined delivery state. The judgment module is configured to deliver the service message to the message middleware if the first state of the service message meets a delivery condition. The judgment module includes a third judgment unit configured to send a second state query instruction corresponding to the service message to the business system if the first state of the service message is an unknown state or an initialization state, so that the business system determines and returns a second state of the service message according to the second state query instruction; the unknown state represents that no state corresponding to the service message is found in the third-party message system. The receiving module is configured to receive the second state of the service message sent by the business system; if the second state meets the delivery condition, the service message is delivered to the message middleware. The third judgment unit is further configured to deliver the service message to the message middleware if the second state of the service message is a submission state. A fourth judgment unit is configured to repeatedly send the second state query instruction corresponding to the service message to the business system if the second state of the service message is the unknown state, to obtain a new state of the service message returned by the business system, and to perform corresponding processing on the service message according to the new state of the service message.

6. An electronic device, comprising: The electronic device includes a processor and a memory; the memory is configured to store a computer program; the computer program is loaded and executed by the processor to implement the message state query method according to any one of claims 1 to 4.

7. A computer readable storage medium characterized in that, The computer executable instructions are loaded and executed by the processor to implement the message state query method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Business state query method and device, computer equipment and storage medium

    CN107943828A