CN112559223A - Message sending method, device, equipment and computer readable storage medium - Google Patents

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

Info

Publication number
CN112559223A
CN112559223A CN202011551966.6A CN202011551966A CN112559223A CN 112559223 A CN112559223 A CN 112559223A CN 202011551966 A CN202011551966 A CN 202011551966A CN 112559223 A CN112559223 A CN 112559223A
Authority
CN
China
Prior art keywords
message
service
state
middleware
operation result
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.)
Pending
Application number
CN202011551966.6A
Other languages
Chinese (zh)
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.)
JD Digital Technology Holdings Co Ltd
Original Assignee
JD Digital Technology Holdings 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 JD Digital Technology Holdings Co Ltd filed Critical JD Digital Technology Holdings Co Ltd
Priority to CN202011551966.6A priority Critical patent/CN112559223A/en
Publication of CN112559223A publication Critical patent/CN112559223A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/546Message passing systems or structures, e.g. queues
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/547Messaging middleware
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a message sending method, a message sending device, message sending equipment and a computer readable storage medium. The method comprises the following steps of applying and executing on the active side: transmitting the service message to the message middleware; receiving a message storage result returned by the message middleware; and when the message storage result is that the message storage is successful, executing the next service operation and sending the operation result to the message middleware. The method is executed in message middleware and comprises the following steps: receiving a service message from an active side application; storing the service message into a message queue; returning a message storage result of the service message to the active side application; and receiving an operation result returned by the application of the active party, and delivering the service message to the application of the passive party when the operation result is successful. In the process of using the message middleware to transmit the message, the invention adds a feedback mechanism, and avoids the problem of inconsistent information of each party caused by the unequal information of each party in the message transmission process.

Description

Message sending method, device, equipment and computer readable storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a message sending method, device, apparatus, and computer readable storage medium.
Background
At present, in order to achieve decoupling between multiple application systems, MQ (Message Queue) middleware is mostly adopted to send messages between the application systems. In particular, an active application (i.e., the party that sent the message) sends the message to the MQ middleware, which stores the message in a message queue from which a passive application (i.e., the party that used the message) that needs the message can consume the message without the active application sending the message to the passive application that needs the message separately.
However, there is no feedback mechanism for the message transfer process through the MQ middleware, such as: whether the active application successfully sends the message, whether the operation executed by the active application for the message is successful, and whether the MQ middleware successfully stores the message, no feedback is performed, so that the information consistency between the active application and the passive application cannot be guaranteed.
For example: a user receives a required material in a material receiving system, the material receiving system generates a material receiving message, the material receiving message is sent to an MQ middleware, and a receiving success record is generated according to the material receiving message; the MQ middleware stores the material receiving message in the message queue, and the material management system acquires the material receiving message from the message queue and modifies the inventory quantity of the material; and the financial management system acquires the material receiving message from the message queue to generate enterprise cost information. In the process, if the material receiving system does not successfully generate the receiving success record, but the material management system and the financial management system already perform corresponding operations, the information of the material receiving system, the material management system and the financial management system is inconsistent. If the MQ middleware fails to be stored, the material management system and the financial management system cannot operate correspondingly, but the material receiving system is successfully received, and information of the material receiving system, the material management system and the financial management system is inconsistent.
Disclosure of Invention
Embodiments of the present invention mainly aim to provide a message sending method, a device, and a computer readable storage medium, so as to solve the problem that there is no feedback mechanism in the process of message transmission through MQ middleware in the prior art.
In view of the above technical problems, the embodiments of the present invention are solved by the following technical solutions:
the embodiment of the invention also provides a message sending method, which is applied and executed at the active side and comprises the following steps: transmitting a service message to a message middleware so that the message middleware stores the service message in a message queue; receiving a message storage result returned by the message middleware; and when the message storage result is that the message storage is successful, executing the next service operation corresponding to the service message, and sending the operation result of the next service operation to the message middleware, so that the message middleware delivers the service message to the passive application when the operation result is that the operation is successful.
Wherein the transmitting the service message to the message middleware comprises: transmitting the service message with the message state of the first state to message middleware so that the message middleware stores the service message in the message queue and sets the message state of the service message to the first state; wherein, the first state represents that the operation result of the next service operation is to be confirmed; the sending the operation result of the next service operation to the message middleware comprises: when the operation result of the next service operation is successful, sending an operation success message to the message middleware, so that the message middleware adjusts the message state of the service message from the first state to a second state according to the operation success message; wherein the second state indicates that the service message is to be sent.
Wherein the method further comprises: receiving message query information from the message middleware; the message query information is used for querying an operation result corresponding to the service message in the message queue, wherein the message state of the service message is a first state; and inquiring an operation result corresponding to the service message with the first state in the message queue according to the message inquiry information, and returning the operation result corresponding to the service message with the first state in the message queue to the message middleware.
Wherein the sending the operation result of the next service operation to the message middleware comprises: and when the operation result of the next service operation is operation failure, sending an operation failure message to the message middleware, so that the message middleware deletes the service message from a message storage device according to the operation failure message.
Wherein after receiving the message storage result returned by the message middleware, the method further comprises: and when the message storage result is that the message storage fails, prohibiting the next service operation corresponding to the service message from being executed.
The embodiment of the invention also provides a message sending method, which is executed in the message middleware and comprises the following steps: receiving a service message from an active side application; storing the service message into a message queue; returning a message storage result of the service message to the active application, so that the active application executes the next service operation corresponding to the service message when the message storage result is that the message storage is successful, and returning an operation result of the next service operation; and receiving the operation result returned by the active side application, and delivering the service message to the passive side application when the operation result is successful.
Wherein, the receiving the service message from the master application includes: the message state of the service message is a first state; wherein, the first state represents that the operation result of the next service operation is to be confirmed; the storing the service message into a message queue includes: storing the service message in the message queue and setting the message state of the service message to a first state; after the receiving of the operation result returned by the master application, the method further includes: when the operation result is that the operation is successful, adjusting the message state of the service message from a first state to a second state; wherein the second state represents that the service message is to be sent; the delivering the service message to the passive application comprises: and delivering the service message with the message state of the second state in the message queue to the passive side application.
Wherein the method further comprises: sending message query information to the active side application aiming at the service message of which the message state in the message queue is the first state; the message query information is used for querying an operation result corresponding to the service message in the message queue, wherein the message state of the service message is a first state; receiving an operation result corresponding to the service message with the message state of the first state in the message queue returned by the active side application; and when the operation result returned by the active side application is successful, adjusting the message state of the service message from the first state to the second state in the message queue so as to deliver the service message adjusted to the second state to the passive side application.
Wherein the method further comprises: and after the operation result returned by the active application is received, deleting the service message from the message queue when the operation result is operation failure.
Wherein the method further comprises: and when the service message storage fails, sending a message storage result corresponding to the message storage failure to the active side application, so that the active side application forbids to execute the next service operation corresponding to the service message.
The embodiment of the present invention further provides a message sending apparatus, which is configured to be applied in an active side, and includes: the transmission module is used for transmitting the service message to the message middleware so that the message middleware can store the service message into a message queue; the first receiving module is used for receiving a message storage result returned by the message middleware; and the execution module is used for executing the next service operation corresponding to the service message and sending the operation result of the next service operation to the message middleware when the message storage result is that the message storage is successful, so that the message middleware delivers the service message to the passive application when the operation result is that the operation is successful.
The embodiment of the present invention further provides a message sending apparatus, which is arranged in a message middleware, and includes: the second receiving module is used for receiving the service message from the active side application; the storage module is used for storing the service message into a message queue; the sending module is used for returning a message storage result of the service message to the active application, so that the active application executes the next service operation corresponding to the service message when the message storage result is that the message storage is successful, and returns an operation result of the next service operation; and the receiving and delivering module is used for receiving the operation result returned by the active side application and delivering the service message to the passive side application when the operation result is successful.
An embodiment of the present invention further provides a message sending device, where the message sending device includes: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the message sending method described above as being performed in any of the master applications or implementing the steps of the message sending method described above as being performed in any of the message middleware.
An embodiment of the present invention further provides a computer-readable storage medium, where a message sending program is stored on the computer-readable storage medium, and the message sending program, when executed by a processor, implements the steps of the message sending method described in any one of the above-mentioned executing methods in the master application, or implements the steps of the message sending method described in any one of the above-mentioned executing methods in the message middleware.
The embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, in the process of transmitting the message by using the message middleware, a feedback mechanism is added, after the active side application sends the service message to the message middleware, the message middleware can inform the active side application whether the service message is successfully stored, the active side application only executes the next service operation under the condition that the message is successfully stored, the active side application also informs the message middleware of the operation result of the next service operation, and the message middleware delivers the service message only under the condition that the operation result is successful, so that the problem of inconsistent information of all parties in the message sending process is avoided.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a flowchart of a message sending method performed at a master application according to an embodiment of the present invention;
fig. 2 is a flowchart of a message sending method performed in message middleware according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a message sending method according to an embodiment of the present invention;
fig. 4 is a detailed flowchart of a message sending method executed in a master application according to an embodiment of the present invention;
fig. 5 is a detailed flowchart of a message sending method performed in message middleware according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a point of failure occurrence according to an embodiment of the present invention;
FIG. 7 is a schematic illustration of a troubleshooting step according to an embodiment of the invention;
FIG. 8 is a flow chart of troubleshooting steps according to an embodiment of the invention;
fig. 9 is a structural diagram of a message transmitting apparatus provided at a master application according to an embodiment of the present invention;
fig. 10 is a block diagram of a message transmission apparatus provided in message middleware according to an embodiment of the present invention;
fig. 11 is a block diagram of a message transmission apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings and specific embodiments.
According to an embodiment of the present invention, there is provided a message transmission method performed at an active side application. The master application is deployed in a master application host or a master application host cluster.
Fig. 1 is a flowchart of a message sending method executed by an active application according to an embodiment of the present invention.
Step S110, transmitting the service message to the message middleware, so that the message middleware stores the service message in a message queue.
The message middleware, also called MQ middleware, is used for storing the business message from the active application into the message queue and delivering the business message to the passive application through the message queue.
The service message refers to a message for instructing or requesting the passive application to perform an operation.
In this embodiment, the service message may be transmitted to a preset message middleware host, or transmitted to one message middleware in a message middleware cluster. Further, if a service message is transmitted to a message middleware in a message middleware cluster, the service message can be randomly sent to the message middleware; or, determining a message middleware with the minimum load through a load balancing algorithm, and transmitting the service message to the message middleware with the minimum load.
If the service message is transmitted to a random message middleware, the host information, such as a network address, of the message middleware in the message middleware cluster can be obtained in advance, and the service message is transmitted to the message middleware according to the host information of the randomly selected message middleware.
If a load balancing algorithm is used to transmit the service message, the load balancing algorithm may be set in a preset master device in the message middleware cluster, and the master device is connected with a plurality of message middleware.
And step S120, receiving a message storage result returned by the message middleware.
A message store result comprising: message storage success and message storage failure.
The message storage success means that the service message is successfully stored in the message queue by the message middleware.
The message storage failure means that the service message is not successfully stored in the message queue by the message middleware.
For example: when the message body of the service message is not consistent with the message body supported by the message queue, the service message will have a storage failure result.
Step S130, when the message storage result is that the message storage is successful, executing the next service operation corresponding to the service message, and sending the operation result of the next service operation to the message middleware, so that the message middleware delivers the service message to the passive application when the operation result is that the operation is successful.
And when the message storage result is that the message storage fails, prohibiting the next service operation corresponding to the service message from being executed.
The next service operation corresponding to the service message refers to the next service operation of the service message generating operation, and the service message generating operation is used for generating the service operation. For example: the service message is a material receiving message, and the next service operation corresponding to the service message is a receiving success record. For another example: the service message is an online shopping order message, and the next service operation corresponding to the service message is a logistics generation operation.
The operation result of the next business operation comprises the following steps: operation success and operation failure. For example: in case of network failure, it is easy to cause failure of the next operation of business.
And the message middleware delivers the service message to the passive application when the operation result is successful. And the message middleware deletes the service message from the message queue when the operation result is operation failure.
In the embodiment of the invention, in the process of transmitting the message by using the message middleware, a feedback mechanism is added, after the active side application sends the service message to the message middleware, the message middleware can inform the active side application whether the service message is successfully stored, the active side application only executes the next service operation under the condition that the message is successfully stored, the active side application also informs the message middleware of the operation result of the next service operation, and the message middleware delivers the service message only under the condition that the operation result is successful, so that the problem of inconsistent information of all parties in the message sending process is avoided, and the reliability of sending the service message is improved.
For example: a user receives the required materials in the material receiving system, the material receiving system generates material receiving messages and sends the material receiving messages to the MQ middleware; the MQ middleware stores the material receiving message in the message queue and returns a storage result to the material receiving system; the material receiving system generates a receiving success record aiming at the material receiving information only under the condition that the storage result is successful, and sends whether the receiving success record is generated successfully to the MQ middleware; and the MQ middleware delivers the material receiving information to the material management system and the financial management system only under the condition that the receiving success record is successfully generated. The material management system obtains the material receiving information and modifies the stock quantity of the material; the financial management system obtains the material receiving information and generates enterprise cost information. In the process, if the MQ middleware fails to store the material receiving message, the material receiving system cannot generate a receiving success record; if the material receiving system does not successfully generate the receiving success record (including the condition that the receiving success record is not generated), the MQ middleware cannot deliver the material receiving information to the material management system and the financial management system, and the information consistency of the material receiving system, the material management system and the financial management system is ensured.
For the above message sending method executed in the active side application, an embodiment of the present invention further provides a message sending method executed in the message middleware. The message middleware is deployed in a message middleware host or a cluster of message middleware hosts.
Fig. 2 is a flowchart of a message sending method executed in message middleware according to an embodiment of the present invention.
Step S210, receiving a service message from the master application.
Step S220, storing the service message in a message queue.
And persistently storing the service message into a message queue, and not delivering the service message to the passive application.
Multiple message queues may be preset, with each message queue corresponding to a message Topic (Topic). The number of message queues can be expanded. And storing the service message into a message queue corresponding to the message theme according to the message theme of the service message.
Step S230, returning a message storage result of the service message to the active application, so that when the message storage result of the active application is a message storage success, the active application executes a next service operation corresponding to the service message, and returns an operation result of the next service operation.
Step S240, receiving the operation result returned by the active application, and delivering the service message to the passive application when the operation result is successful.
The result of the operation, including: operation success and operation failure.
And when the operation result is successful, delivering the service message to the passive application. Wherein the passive side application is an application that consumes (needs to process) the service message. The passive application is deployed in a passive application host or a cluster of passive application hosts.
And when the operation result is operation failure, deleting the service message from the message queue.
In the embodiment of the invention, in the process of transmitting the message by using the message middleware, a feedback mechanism is added, after the active side application sends the service message to the message middleware, the message middleware can inform the active side application whether the service message is successfully stored, the active side application only executes the next service operation under the condition that the message is successfully stored, the active side application also informs the message middleware of the operation result of the next service operation, and the message middleware delivers the service message only under the condition that the operation result is successful, so that the service message is prevented from being delivered to the passive side application under the condition that the operation of the active side application fails.
The message sending method of the embodiment of the invention can be independently deployed and expanded, can reduce the coupling between the service system and the message system, and can ensure the final consistency on the premise of reliable data.
In order to make the present invention clearer, the following further describes the message sending method executed in the active application, and then further describes the message sending method executed in the message middleware, based on fig. 3 being a schematic diagram of the message sending method according to an embodiment of the present invention.
Fig. 4 is a specific flowchart of a message sending method executed by an active application according to an embodiment of the present invention.
Step S410, transmitting the service message with the message state being the first state to the message middleware; wherein the first state represents that an operation result of the next business operation is to be confirmed.
Step S420, receiving a message storage result returned by the message middleware.
Step S430, determining whether the message storage result is successful message storage; if yes, go to step S440; if not, S470 is performed.
Step S440, when the message storage result is that the message storage is successful, executing the next service operation corresponding to the service message, when the operation result is that the operation is successful, executing step S450, and when the operation result is that the operation is failed, executing step S460.
Step S450, when the operation result of the next service operation is successful, an operation success message is sent to the message middleware, so that the message middleware adjusts the message state of the service message from the first state to a second state according to the operation success message; wherein the second state indicates that the service message is to be sent.
Step S460, when the operation result of the next service operation is operation failure, sending an operation failure message to the message middleware, so that the message middleware deletes the service message from the message storage device according to the operation failure message.
Step S470, when the message storage result is that the message storage fails, prohibiting the execution of the next service operation corresponding to the service message, and ending the process.
Fig. 5 is a specific flowchart of a message sending method executed in message middleware according to an embodiment of the present invention.
Step S510, receiving a service message from the application of the active side; wherein, the message state of the service message is a first state; the first state represents that an operation result of the next business operation is to be confirmed.
Step S520, storing the service message in the message queue, and setting the message status of the service message to a first status.
Step S530, returning a message storage result of the service message to the active application.
Step S540, determining whether the message storage result is successful; if so, go to step S550; if not, the flow is ended.
And when the message storage result is that the message storage is successful, the active side application executes the next service operation corresponding to the service message and returns the operation result of the next service operation.
And when the message storage result of the active application is message storage failure, prohibiting the next service operation corresponding to the service message from being executed.
And step S550, receiving the operation result returned by the master application.
Step S560, judging whether the operation result is successful; if so, go to step S570; if not, step S590 is performed.
Step S570, when the operation result is that the operation is successful, adjusting the message status of the service message from the first status to the second status; wherein the second state indicates that the service message is to be sent.
Step S580, the service message in the message queue whose message state is the second state is delivered to the passive application.
In step S590, when the operation result is operation failure, the service message is deleted from the message queue.
Aiming at the message sending process, the embodiment of the invention also provides a fault coping strategy. For example: the failure of sending the service message, the failure of storing the service message, the failure of feeding back the result of storing the message, the failure of the next service operation, and the failure of feeding back the operation result of the next service operation, and the failure of processing the service message according to the operation result, which may cause the failure of sending the service message, may occupy the storage space of the message queue, and therefore, the failure removal needs to be performed through the failure handling policy of this embodiment.
Fig. 6 is a schematic diagram of a point of occurrence of a fault according to an embodiment of the present invention. FIG. 7 is a schematic diagram of a troubleshooting procedure according to an embodiment of the invention. FIG. 8 is a flow chart of troubleshooting steps according to an embodiment of the invention.
Step S810, the message middleware sends message query information to the active side application aiming at the service message in the message queue, wherein the message state of the service message is the first state; the message query information is used for querying an operation result corresponding to the service message in the message queue, wherein the message state of the service message is the first state.
The message middleware inquires the service message in the first state in the message queue; and generating message query information according to the service message in the first state. And carrying the information of each service message in the first state in the message query information. The information of the service message is for example an identification of the service message.
Step S820, the active application receives the message query information from the message middleware; the message query information is used for querying an operation result corresponding to the service message in the message queue, wherein the message state of the service message is the first state.
The active side application queries the operation result corresponding to each service message in the first state, that is, the operation result of the next service operation corresponding to the service message, according to the information of each service message in the first state carried in the message query information.
And if the operation result corresponding to the service message in the first state cannot be inquired, the active side application does not execute the next service operation. Reasons why the active application does not perform this next business operation include, but are not limited to: the service message transmission fails, the service message storage fails and the message storage result feedback fails.
If the operation result corresponding to the service message in the first state can be inquired, it indicates that the active application has executed the next service operation.
Step S830, the active side application inquires the operation result corresponding to the service message with the first state in the message queue according to the message inquiry information, and returns the operation result corresponding to the service message with the first state in the message queue to the message middleware.
Step 840, the message middleware receives the operation result corresponding to the service message in the first state in the message queue returned by the active application.
Step S850, the message middleware determines whether the operation result is successful; if yes, go to step S860; if not, step S870 is performed.
If the operation result corresponding to the service message in the first state is found to be successful, the operation result feedback is failed, so that the message state of the service message is not adjusted from the first state to the second state.
Step S860, when the operation result returned by the active application is successful, the message middleware adjusts the message status of the service message from the first status to the second status in the message queue, so as to deliver the service message adjusted to the second status to the passive application.
Step S870, when the operation result returned by the active application is an operation failure, the message middleware deletes the service message from the message queue.
If the operation result corresponding to the service message in the first state is found to be operation failure, it indicates that the service message has not been processed according to the operation result of the next service operation, and at this time, the service message may be deleted from the message queue so as to stop the sending of the service message.
The embodiment of the invention also provides a message sending device arranged on the active side. Fig. 9 is a block diagram of a message transmission apparatus provided in an application on the master according to an embodiment of the present invention.
The message sending device arranged on the active side application comprises: a transmission module 910, a first receiving module 920 and an execution module 930.
A transmission module 910, configured to transmit a service message to a message middleware, so that the message middleware stores the service message in a message queue.
A first receiving module 920, configured to receive a message storage result returned by the message middleware.
An executing module 930, configured to execute a next service operation corresponding to the service message when the message storage result is that the message storage is successful, and send an operation result of the next service operation to the message middleware, so that the message middleware delivers the service message to a passive application when the operation result is that the operation is successful.
The functions of the apparatus according to the embodiment of the present invention have been described in the above method embodiments, so that reference may be made to the related descriptions in the foregoing embodiments for details which are not described in the embodiment of the present invention, and further details are not described herein.
The embodiment of the invention also provides a message sending device arranged in the message middleware. Fig. 10 is a block diagram of a message transmission apparatus provided in message middleware according to an embodiment of the present invention.
The message sending device arranged in the message middleware comprises: a second receiving module 1010, a storing module 1020, a sending module 1030 and a receiving and delivering module 1040.
A second receiving module 1010, configured to receive a service message from the master application.
A storage module 1020, configured to store the service message in a message queue.
The sending module 1030 is configured to return a message storage result of the service message to the active application, so that when the message storage result of the active application is that message storage is successful, the active application executes the next service operation corresponding to the service message, and returns an operation result of the next service operation.
The receiving and delivering module 1040 is configured to receive the operation result returned by the active side application, and deliver the service message to the passive side application when the operation result is successful.
The functions of the apparatus according to the embodiment of the present invention have been described in the above method embodiments, so that reference may be made to the related descriptions in the foregoing embodiments for details which are not described in the embodiment of the present invention, and further details are not described herein.
The present embodiment provides a message transmission apparatus. Fig. 11 is a block diagram of a message transmitting apparatus according to an embodiment of the present invention.
In this embodiment, the message sending device includes, but is not limited to: a processor 1110, and a memory 1120.
The processor 1110 is configured to execute a message sending program stored in the memory 1120 to implement the message sending method executed in the active application or the message sending method executed in the message middleware.
The processor 1110 is configured to execute a messaging program stored in the memory 1120 for execution by the master application to perform the following steps: transmitting a service message to a message middleware so that the message middleware stores the service message in a message queue; receiving a message storage result returned by the message middleware; and when the message storage result is that the message storage is successful, executing the next service operation corresponding to the service message, and sending the operation result of the next service operation to the message middleware, so that the message middleware delivers the service message to the passive application when the operation result is that the operation is successful.
Wherein the transmitting the service message to the message middleware comprises: transmitting the service message with the message state of the first state to message middleware so that the message middleware stores the service message in the message queue and sets the message state of the service message to the first state; wherein, the first state represents that the operation result of the next service operation is to be confirmed; the sending the operation result of the next service operation to the message middleware comprises: when the operation result of the next service operation is successful, sending an operation success message to the message middleware, so that the message middleware adjusts the message state of the service message from the first state to a second state according to the operation success message; wherein the second state indicates that the service message is to be sent.
Wherein the method further comprises: receiving message query information from the message middleware; the message query information is used for querying an operation result corresponding to the service message in the message queue, wherein the message state of the service message is a first state; and inquiring an operation result corresponding to the service message with the first state in the message queue according to the message inquiry information, and returning the operation result corresponding to the service message with the first state in the message queue to the message middleware.
Wherein the sending the operation result of the next service operation to the message middleware comprises: and when the operation result of the next service operation is operation failure, sending an operation failure message to the message middleware, so that the message middleware deletes the service message from a message storage device according to the operation failure message.
Wherein after receiving the message storage result returned by the message middleware, the method further comprises: and when the message storage result is that the message storage fails, prohibiting the next service operation corresponding to the service message from being executed.
The processor 1110 is configured to execute a messaging program stored in the memory 1120 for execution in messaging middleware to perform the following steps: receiving a service message from an active side application; storing the service message into a message queue; returning a message storage result of the service message to the active application, so that the active application executes the next service operation corresponding to the service message when the message storage result is that the message storage is successful, and returning an operation result of the next service operation; and receiving the operation result returned by the active side application, and delivering the service message to the passive side application when the operation result is successful.
Wherein, the receiving the service message from the master application includes: the message state of the service message is a first state; wherein, the first state represents that the operation result of the next service operation is to be confirmed; the storing the service message into a message queue includes: storing the service message in the message queue and setting the message state of the service message to a first state; after the receiving of the operation result returned by the master application, the method further includes: when the operation result is that the operation is successful, adjusting the message state of the service message from a first state to a second state; wherein the second state represents that the service message is to be sent; the delivering the service message to the passive application comprises: and delivering the service message with the message state of the second state in the message queue to the passive side application.
Wherein the method further comprises: sending message query information to the active side application aiming at the service message of which the message state in the message queue is the first state; the message query information is used for querying an operation result corresponding to the service message in the message queue, wherein the message state of the service message is a first state; receiving an operation result corresponding to the service message with the message state of the first state in the message queue returned by the active side application; and when the operation result returned by the active side application is successful, adjusting the message state of the service message from the first state to the second state in the message queue so as to deliver the service message adjusted to the second state to the passive side application.
Wherein the method further comprises: and after the operation result returned by the active application is received, deleting the service message from the message queue when the operation result is operation failure.
Wherein the method further comprises: and when the service message storage fails, sending a message storage result corresponding to the message storage failure to the active side application, so that the active side application forbids to execute the next service operation corresponding to the service message.
The embodiment of the invention also provides a computer readable storage medium. The computer-readable storage medium herein stores one or more programs. Among other things, computer-readable storage media may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When the one or more programs in the computer-readable storage medium are executable by the one or more processors to implement the above-described messaging method performed in the master application or the above-described messaging method performed in the message middleware. Since the message sending method executed in the active side application and the message sending method executed in the message middleware are already described in detail above, detailed description thereof is omitted here.
The above description is only an example of the present invention, and is not intended to limit the present invention, and it is obvious to those skilled in the art that various modifications and variations can be made in the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (14)

1. A method for sending a message, wherein the steps performed at an active application comprise:
transmitting a service message to a message middleware so that the message middleware stores the service message in a message queue;
receiving a message storage result returned by the message middleware;
and when the message storage result is that the message storage is successful, executing the next service operation corresponding to the service message, and sending the operation result of the next service operation to the message middleware, so that the message middleware delivers the service message to the passive application when the operation result is that the operation is successful.
2. The method of claim 1,
the transmitting the service message to the message middleware comprises:
transmitting the service message with the message state of the first state to message middleware so that the message middleware stores the service message in the message queue and sets the message state of the service message to the first state; wherein, the first state represents that the operation result of the next service operation is to be confirmed;
the sending the operation result of the next service operation to the message middleware comprises:
when the operation result of the next service operation is successful, sending an operation success message to the message middleware, so that the message middleware adjusts the message state of the service message from the first state to a second state according to the operation success message; wherein the second state indicates that the service message is to be sent.
3. The method of claim 2, further comprising:
receiving message query information from the message middleware; the message query information is used for querying an operation result corresponding to the service message in the message queue, wherein the message state of the service message is a first state;
and inquiring an operation result corresponding to the service message with the first state in the message queue according to the message inquiry information, and returning the operation result corresponding to the service message with the first state in the message queue to the message middleware.
4. The method according to any one of claims 1 to 3, wherein the sending the operation result of the next business operation to the message middleware comprises:
and when the operation result of the next service operation is operation failure, sending an operation failure message to the message middleware, so that the message middleware deletes the service message from a message storage device according to the operation failure message.
5. The method according to any one of claims 1-3, wherein after receiving the message storage result returned by the message middleware, the method further comprises:
and when the message storage result is that the message storage fails, prohibiting the next service operation corresponding to the service message from being executed.
6. A message sending method, characterized in that steps executed in message middleware comprise:
receiving a service message from an active side application;
storing the service message into a message queue;
returning a message storage result of the service message to the active application, so that the active application executes the next service operation corresponding to the service message when the message storage result is that the message storage is successful, and returning an operation result of the next service operation;
and receiving the operation result returned by the active side application, and delivering the service message to the passive side application when the operation result is successful.
7. The method of claim 6,
the receiving of the service message from the active application includes:
the message state of the service message is a first state; wherein, the first state represents that the operation result of the next service operation is to be confirmed;
the storing the service message into a message queue includes:
storing the service message in the message queue and setting the message state of the service message to a first state;
after the receiving of the operation result returned by the master application, the method further includes:
when the operation result is that the operation is successful, adjusting the message state of the service message from a first state to a second state; wherein the second state represents that the service message is to be sent;
the delivering the service message to the passive application comprises:
and delivering the service message with the message state of the second state in the message queue to the passive side application.
8. The method of claim 7, further comprising:
sending message query information to the active side application aiming at the service message of which the message state in the message queue is the first state; the message query information is used for querying an operation result corresponding to the service message in the message queue, wherein the message state of the service message is a first state;
receiving an operation result corresponding to the service message with the message state of the first state in the message queue returned by the active side application;
and when the operation result returned by the active side application is successful, adjusting the message state of the service message from the first state to the second state in the message queue so as to deliver the service message adjusted to the second state to the passive side application.
9. The method according to any one of claims 6 to 8, further comprising:
and after the operation result returned by the active application is received, deleting the service message from the message queue when the operation result is operation failure.
10. The method according to any one of claims 6 to 8, further comprising:
and when the service message storage fails, sending a message storage result corresponding to the message storage failure to the active side application, so that the active side application forbids to execute the next service operation corresponding to the service message.
11. A message transmission apparatus, provided in an active application, comprising:
the transmission module is used for transmitting the service message to the message middleware so that the message middleware can store the service message into a message queue;
the first receiving module is used for receiving a message storage result returned by the message middleware;
and the execution module is used for executing the next service operation corresponding to the service message and sending the operation result of the next service operation to the message middleware when the message storage result is that the message storage is successful, so that the message middleware delivers the service message to the passive application when the operation result is that the operation is successful.
12. A message transmission apparatus provided in a message middleware, comprising:
the second receiving module is used for receiving the service message from the active side application;
the storage module is used for storing the service message into a message queue;
the sending module is used for returning a message storage result of the service message to the active application, so that the active application executes the next service operation corresponding to the service message when the message storage result is that the message storage is successful, and returns an operation result of the next service operation;
and the receiving and delivering module is used for receiving the operation result returned by the active side application and delivering the service message to the passive side application when the operation result is successful.
13. A message transmission device, characterized in that the message transmission device comprises: memory, processor and computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method of transmitting a message according to any one of claims 1 to 5 or implementing the steps of the method of transmitting a message according to any one of claims 6 to 10.
14. A computer-readable storage medium, having stored thereon a messaging program which, when executed by a processor, implements the steps of a messaging method according to any one of claims 1 to 5, or implements the steps of a messaging method according to any one of claims 6 to 10.
CN202011551966.6A 2020-12-24 2020-12-24 Message sending method, device, equipment and computer readable storage medium Pending CN112559223A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011551966.6A CN112559223A (en) 2020-12-24 2020-12-24 Message sending method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011551966.6A CN112559223A (en) 2020-12-24 2020-12-24 Message sending method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN112559223A true CN112559223A (en) 2021-03-26

Family

ID=75033604

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011551966.6A Pending CN112559223A (en) 2020-12-24 2020-12-24 Message sending method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112559223A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377557A (en) * 2021-07-01 2021-09-10 挂号网(杭州)科技有限公司 Service processing method and system and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040177111A1 (en) * 2003-01-24 2004-09-09 International Business Machines Corporation Non-persistent service support in transactional application support environments
US20120278815A1 (en) * 2011-04-26 2012-11-01 Sap Ag High-load business process scalability
US20150040140A1 (en) * 2013-08-01 2015-02-05 International Business Machines Corporation Consuming Ordered Streams of Messages in a Message Oriented Middleware
CN110147287A (en) * 2019-04-24 2019-08-20 珠海市珠澳跨境工业区好易通科技有限公司 A kind of message queue receive-transmit system and method
US20200142759A1 (en) * 2018-11-01 2020-05-07 Sap Se Rest gateway for messaging
CN111538600A (en) * 2020-02-25 2020-08-14 远景智能国际私人投资有限公司 Message processing method and device, computer equipment and storage medium
CN111666162A (en) * 2020-04-30 2020-09-15 平安科技(深圳)有限公司 Distributed message transmission method, device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040177111A1 (en) * 2003-01-24 2004-09-09 International Business Machines Corporation Non-persistent service support in transactional application support environments
US20120278815A1 (en) * 2011-04-26 2012-11-01 Sap Ag High-load business process scalability
US20150040140A1 (en) * 2013-08-01 2015-02-05 International Business Machines Corporation Consuming Ordered Streams of Messages in a Message Oriented Middleware
US20200142759A1 (en) * 2018-11-01 2020-05-07 Sap Se Rest gateway for messaging
CN110147287A (en) * 2019-04-24 2019-08-20 珠海市珠澳跨境工业区好易通科技有限公司 A kind of message queue receive-transmit system and method
CN111538600A (en) * 2020-02-25 2020-08-14 远景智能国际私人投资有限公司 Message processing method and device, computer equipment and storage medium
CN111666162A (en) * 2020-04-30 2020-09-15 平安科技(深圳)有限公司 Distributed message transmission method, device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377557A (en) * 2021-07-01 2021-09-10 挂号网(杭州)科技有限公司 Service processing method and system and electronic equipment
CN113377557B (en) * 2021-07-01 2024-07-02 挂号网(杭州)科技有限公司 Service processing method, system and electronic equipment

Similar Documents

Publication Publication Date Title
CN108449410B (en) Message management method, system and related device in cloud platform
US8165041B2 (en) Peer to multi-peer routing
US7530078B2 (en) Certified message delivery and queuing in multipoint publish/subscribe communications
CN111711697A (en) Message pushing method, device, equipment and storage medium
CN101184055A (en) Method and device of delivering, receiving, transmitting off-line files
CN111083193A (en) Long connection message sending method, server and storage medium
KR20040086583A (en) Message delivery with configurable assurances and features between two endpoints
CN112788074A (en) Data transmitting method, processing method, receiving method and equipment and storage medium
CN101272337B (en) Service data processing method and service data processing system
CN108512930B (en) Shared file management method, device, server and storage medium
CN105991752B (en) A kind of data block update method and equipment
US20080263221A1 (en) System and method for store-and-forward for highly available message production
CN105959346A (en) Data processing system and data processing method based on server cluster
CN103685357A (en) Account multi-open message processing method and system
CN112559223A (en) Message sending method, device, equipment and computer readable storage medium
CN103200214A (en) Method and system for processing off-line messages in centralized mode
CN113206877A (en) Session keeping method and device
WO2020252724A1 (en) Log processing method and device, and computer-readable storage medium
US20100325640A1 (en) Queueing messages related by affinity set
CN111984388A (en) Method, device and medium for coordinating data consistency in distributed transactions of cloud environment
CN111835797A (en) Data processing method, device and equipment
CN115665175B (en) Distributed gateway system and transaction processing method thereof
CN112615901A (en) Method for sending user request by client and storage system
CN116414628A (en) Transaction request processing method and device in new and old system switching process
CN112100556B (en) Method and system for optimizing message pushing mode

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Jingdong Technology Holding Co.,Ltd.

Address before: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant before: Jingdong Digital Technology Holding Co., Ltd