[go: up one dir, main page]

WO2022033586A1 - Message sending method and device - Google Patents

Message sending method and device Download PDF

Info

Publication number
WO2022033586A1
WO2022033586A1 PCT/CN2021/112570 CN2021112570W WO2022033586A1 WO 2022033586 A1 WO2022033586 A1 WO 2022033586A1 CN 2021112570 W CN2021112570 W CN 2021112570W WO 2022033586 A1 WO2022033586 A1 WO 2022033586A1
Authority
WO
WIPO (PCT)
Prior art keywords
service message
message
sent
local disk
sending
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.)
Ceased
Application number
PCT/CN2021/112570
Other languages
French (fr)
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.)
NetsUnion Clearing Corp
Original Assignee
NetsUnion Clearing Corp
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 NetsUnion Clearing Corp filed Critical NetsUnion Clearing Corp
Publication of WO2022033586A1 publication Critical patent/WO2022033586A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling

Definitions

  • the embodiments of the present application relate to the field of data transmission, and in particular, to a method and apparatus for sending a message.
  • Queue is a first-in, first-out data structure.
  • Distributed message queues can be regarded as deploying this data structure to an independent server.
  • Applications can use distributed message queues through remote access interfaces to perform message access operations, and then Implement distributed asynchronous calls. If the sender does not have disaster recovery means when the message sending fails, then when the distributed message queue fails, the message to be sent will be lost, which will make the application function unavailable.
  • the disaster recovery method in the face of message sending failure is usually to make a compensation at the application layer of the sender, but this will increase the workload of the sender to access the distributed message queue.
  • the embodiments of the present application provide a message sending method and device, which can overcome the problem in the related art that the disaster recovery method when the message sending fails will increase the workload of the sender accessing the distributed message queue.
  • a first aspect of an embodiment of the present application provides a message sending method, including: reading a current service message from a local disk, where the current service message is a service message to be sent pointed to by a reference identifier stored in the local disk; sending a message to a message queue cluster For the current service message, update the reference ID so that the reference ID points to the next service message to be sent after the current service message in the local disk; for the case where the current service message fails to be sent, a new service message is generated according to the current service message, and the After the new service message is stored in the local disk of all service messages to be sent, the content of the current service message is the same as that of the new service message.
  • the method further includes: returning the step of reading the current service message from the local disk;
  • the method further includes: returning to the step of reading the current service message from the local disk.
  • the method before the step of returning to the step of reading the current service message from the local disk, the method further includes: judging whether the current sending task is terminated; for the case that the current sending task is not terminated, continuing to execute the Return to the step of reading the current service message from the local disk as described above; in the case of termination of the current sending task, stop sending the service message.
  • the method before reading the current service message from the local disk, the method further includes: scanning the local disk for service messages to be sent; judging that there are service messages to be sent in the local disk, and judging the message queue cluster Is it normal? It is judged that the message queue cluster is normal, and continues to perform the steps of reading the current business message from the local disk.
  • the service message is set with a corresponding number, and the number is used to reflect the sending order of the service message; the scanning of the local disk for whether there is a service message to be sent includes: judging whether there is a number in the local disk The service message whose number is greater than the service message to be sent pointed to by the reference identifier is determined as the service message to be sent.
  • determining whether the message queue cluster is normal includes: querying whether the address of the message queue cluster exists in the routing table; determining that the message queue cluster is normal if the address of the message queue cluster exists in the routing table.
  • a message sending device including: an obtaining module, configured to read a current service message from a local disk, where the current service message is a service to be sent pointed to by a reference identifier stored in the local disk message; the sending module is used to send the current business message to the message queue cluster, and update the benchmark identifier so that the benchmark identifier points to the next business message to be sent after the current business message in the local disk; the processing module, if the current business message fails to be sent , the business message additional storage module is used to generate a new business message according to the current business message, and store the new business message in the local disk after all to-be-sent business messages, the content of the current business message and the new business message are the same.
  • a third aspect of the embodiments of the present application provides a computer device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by at least one processor.
  • a processor executes, thereby executing the message sending method provided by the first aspect of the embodiments of the present application.
  • a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a computer to execute the message sending method provided by the first aspect of the embodiments of the present application.
  • the message sending method and device provided by the embodiments of the present application read from the local disk and send the current business message pointed to by the reference identifier to the message queue cluster, and if the sending fails, assemble the current business message into a new business message and additionally store it. After all pending business messages on the local disk.
  • the embodiment of the present application provides a disaster recovery solution when the service message fails to be sent. When the service message fails to be sent, the service message that fails to be sent is stored in the local disk. On the one hand, the service message that fails to be sent can be restored Sending, avoiding the loss of business messages, on the other hand, storing business messages that fail to be sent on the local disk, so that the disaster recovery solution does not depend on other servers.
  • FIG. 1 is a flowchart of an example of a message sending method in an embodiment of the present application
  • FIG. 2 is a flowchart of another example of a message sending method in an embodiment of the present application.
  • FIG. 3 is a flowchart of another example of a message sending method in an embodiment of the present application.
  • FIG. 4 is a schematic block diagram of an example of a message sending apparatus in an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a computer device provided in an embodiment of the present application.
  • Queue is a first-in, first-out data structure.
  • Distributed message queues can be regarded as deploying this data structure to an independent server.
  • Applications can use distributed message queues through remote access interfaces to perform message access operations, and then Implement distributed asynchronous calls. When the distributed message queue fails, it will cause the message to be sent to be lost, thereby making the application function unavailable.
  • An embodiment of the present application provides a method for sending a message, which is applied to a sender, as shown in FIG. 1 , including:
  • Step S10 read the current service message from the local disk, and the current service message is the service message to be sent pointed to by the reference identifier stored in the local disk;
  • Step S20 Send the current service message to the message queue cluster, and update the reference identifier so that the reference identifier points to the next service message to be sent after the current service message in the local disk.
  • Step S30 Determine whether the current service message fails to be sent, if the sending fails, execute step S40, and if the sending is successful, return to the above-mentioned step S10.
  • the message queue cluster will send feedback information indicating the failure to send the business message to the sender. In this way, the sender receives a message indicating that the business message is sent.
  • the failure feedback information can be used to determine that the service message fails to be sent.
  • Step S40 Generate a new service message according to the current service message, and store the new service message in the local disk after all to-be-sent service messages, the content of the current service message and the new service message are the same, and return to step S10.
  • the sent service message and the service message to be sent in the local disk can be distinguished in a certain way, and assembling the service message that fails to be sent into a new service message means that according to the current local disk
  • the rule that distinguishes whether a business message has been sent in the rules assembles business messages that fail to be sent into business messages that are not sent.
  • the purpose of additionally storing the service message that fails to be sent in the local disk after all the service messages to be sent is to ensure that the service message that fails to be sent can be sent again without affecting the normal sending of other service messages.
  • an independent space may also be set aside in the local disk for storing service messages that fail to be sent. The message is sent again.
  • the message sending method provided by the embodiment of the present application reads from the local disk and sends the current service message pointed to by the reference identifier to the message queue cluster. If the sending fails, the current service message is assembled into a new service message and additionally stored locally. After all pending business messages on disk.
  • the embodiment of the present application provides a disaster recovery solution when the service message fails to be sent. When the service message fails to be sent, the service message that fails to be sent is stored in the local disk. On the one hand, the service message that fails to be sent can be restored Sending, avoiding the loss of business messages, on the other hand, storing business messages that fail to be sent on the local disk, so that the disaster recovery solution does not depend on other servers.
  • the method further includes:
  • Step S50 Determine whether the current sending task is terminated.
  • the sender completes the sending of service messages at regular intervals, performs a sending task at regular intervals, and the time for each sending task is fixed. If the current sending task is not terminated, return to step S10, if the current sending task is terminated, stop sending the service message, and end the process.
  • the message sending method provided by this embodiment of the present application further includes:
  • Step S70 Scan the local disk for service messages to be sent.
  • the messages to be sent by the sender are service messages to be sent. Therefore, when restarting the sending task, it is necessary to scan the local disk for service messages to be sent. If there is a service message to be sent in the local disk, step S80 is performed, and if there is no service message to be sent in the local disk, the current sending task is ended.
  • Step S80 Determine whether the message queue cluster is normal. Only when the message queue cluster is normal can the service message be sent successfully. Therefore, in order to avoid waste of resources, after restarting the sending task, it is necessary to first determine whether the message queue cluster is normal. If the queue cluster is normal, step S10 is performed. If the message queue cluster is abnormal, the current sending task is ended.
  • step S70 and step S80 may alternatively exist, that is, only the judgment of step S70 is performed before step S10 is performed, or only the judgment of step S80 is performed.
  • the detection of the message queue cluster can be detected only once at the beginning of the sending task, or it can be detected periodically during the execution of the sending task, or it can be detected every time before the service message to be sent is sent, but in order to complete the detection.
  • the embodiment of the present application only detects once at the beginning of the sending task, and in practical application, different detection rules can be selected according to actual requirements.
  • the service message is set with a corresponding number, and the number is used to reflect the sending order of the service message.
  • the above step S70 may include:
  • the sender extracts and sends the service messages in the order of the service message numbers. Then, the service messages whose numbers are smaller than the service messages to be sent pointed to by the reference identifier are the service messages that have been sent, and the service messages whose numbers are greater than the reference identifier are all sent.
  • the service messages that point to the service message to be sent are all unsent service messages.
  • step S30 reassembling the service messages that fail to be sent means that the service message fails to be sent.
  • a new number is distributed to the service message, which is greater than the number of all the service messages to be sent.
  • the service message to be sent includes a first identifier, and the first identifier is used to indicate that the service message has not been sent.
  • the foregoing step S70 may include:
  • reassembling the service message that fails to send means adding the first identifier to the service message that fails to send , in this way, when sending the service message, the service message that fails to be sent may be determined as the service message to be sent to be sent again.
  • step S80 may include:
  • the routing table Check whether the address of the message queue cluster exists in the routing table. If the address of the message queue cluster exists in the routing table, it is determined that the message queue cluster is normal. In one embodiment, if the IP address of a certain server exists in the routing table of the sender, it means that the sender can establish a connection with the server and complete the data transmission, but the IP address that does not exist in the routing table sends the The party cannot establish a connection with the server corresponding to the IP address. In one embodiment, when the message queue cluster is faulty, its IP address will not appear in the routing table of the sender, therefore, whether the message queue cluster is faulty can be detected by querying the routing table. It should be noted that only a simple detection of the message queue cluster can be performed through the routing table. Even if the address of the message queue cluster exists in the routing table, it cannot be guaranteed that the distributed message queue is normal, so even if there is a message queue in the routing table. The address of the cluster will still fail to send the message.
  • An embodiment of the present application provides a message sending apparatus, as shown in FIG. 4 , including:
  • the obtaining module 10 is configured to read the current service message from the local disk, where the current service message is the service message to be sent pointed to by the reference identifier stored in the local disk.
  • the current service message is the service message to be sent pointed to by the reference identifier stored in the local disk.
  • the sending module 20 is used to send the current service message to the message queue cluster, and update the reference identifier, so that the reference identifier points to the next service message to be sent after the current service message in the local disk.
  • the processing module 30 is used to generate a new business message according to the current business message in the case of failure to send the current business message, and store the new business message in the local disk after all the business messages to be sent, the current business message and the new business message.
  • the content of the message is the same, and for a detailed description, see the description of step S30 and step S40 in Embodiment 1 above.
  • the message sending device provided by this application reads the current business message pointed to by the message queue cluster reference identifier from the local disk, and if the sending fails, assembles the current business message into a new business message and additionally stores all the pending business messages in the local disk. After sending a business message.
  • the message sending device provided by the present application provides a disaster recovery solution when the service message fails to be sent. When the service message fails to be sent, the failed service message is stored in the local disk. On the one hand, the service message that fails to be sent can be stored. Sending again avoids the loss of business messages. On the other hand, business messages that fail to be sent are stored on the local disk, so that the disaster recovery solution does not depend on other servers.
  • the computer device mainly includes one or more processors 61 and a memory 62 .
  • the processors 61 is used as an example.
  • the computer equipment may also include: an input device 63 and an output device 64 .
  • the processor 61 , the memory 62 , the input device 63 and the output device 64 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 5 .
  • the processor 61 may be a central processing unit (Central Processing Unit, CPU).
  • the processor 61 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), Field Programmable Gate Array (Field Programmable Gate Array, FPGA) or other Chips such as programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above types of chips.
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 62 may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the messaging device, and the like. Additionally, memory 62 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 62 may optionally include memory located remotely from processor 61 that may be connected to the messaging device via a network.
  • the input device 63 may receive user input of computational requests (or other numerical or character information) and generate key signal input associated with the messaging device.
  • the output device 64 may include a display device such as a display screen, and is used to output the calculation result.
  • the embodiments of the present application provide a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions can execute the message sending method in any of the foregoing method embodiments .
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive) , abbreviation: HDD) or solid-state drive (Solid-State Drive, SSD), etc.; the storage medium may also include a combination of the above-mentioned types of memories.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (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)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Provided by the present application are a message sending and device. In the present application, a current service message is read from a local disk, and the current service message is sent to a message queue cluster. If the current service message fails to be sent, a new service message will be generated according to the current service message, and the new service message is added to and stored in the local disk so as to await sending again. By means of the embodiments of the present application, on the one hand, the service message that fails to be sent may be sent again, thus avoiding the loss of the service message; and on the other hand, the service message that fails to be sent is stored on a local disk, so that a disaster recovery solution does not depend on other servers.

Description

一种消息发送方法及装置A message sending method and device 技术领域technical field

本申请实施例涉及数据传输领域,具体涉及一种消息发送方法及装置。The embodiments of the present application relate to the field of data transmission, and in particular, to a method and apparatus for sending a message.

背景技术Background technique

队列是一种先进先出的数据结构,分布式消息队列可以看作将这种数据结构部署到独立的服务器上,应用程序可以通过远程访问接口使用分布式消息队列,进行消息存取操作,进而实现分布式的异步调用。如果发送方没有面对消息发送失败时的容灾手段,那么,当分布式消息队列出现故障时,会导致其所要发送的消息丢失,进而导致应用方功能不可用。相关技术中面对消息发送失败时的容灾手段通常都是在发送方的应用层做一次补偿,但是,这样会增加发送方接入分布式消息队列的工作量。Queue is a first-in, first-out data structure. Distributed message queues can be regarded as deploying this data structure to an independent server. Applications can use distributed message queues through remote access interfaces to perform message access operations, and then Implement distributed asynchronous calls. If the sender does not have disaster recovery means when the message sending fails, then when the distributed message queue fails, the message to be sent will be lost, which will make the application function unavailable. In the related art, the disaster recovery method in the face of message sending failure is usually to make a compensation at the application layer of the sender, but this will increase the workload of the sender to access the distributed message queue.

发明概述SUMMARY OF THE INVENTION

以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this article. This summary is not intended to limit the scope of protection of the claims.

本申请实施例提供一种消息发送方法及装置,能够克服相关技术中的面对消息发送失败时的容灾手段会增加发送方接入分布式消息队列的工作量的问题。The embodiments of the present application provide a message sending method and device, which can overcome the problem in the related art that the disaster recovery method when the message sending fails will increase the workload of the sender accessing the distributed message queue.

本申请实施例第一方面提供了一种消息发送方法,包括:从本地磁盘中读取当前业务消息,当前业务消息为存储在本地磁盘中基准标识指向的待发送业务消息;向消息队列集群发送当前业务消息,更新基准标识,以使基准标识指向本地磁盘中位于当前业务消息之后的下一条待发送业务消息;对于当前业务消息发送失败的情况,根据当前业务消息生成新的业务消息,并将新的业务消息存储在本地磁盘中所有待发送业务消息之后,当前业务消息与新的业务消息的内容相同。A first aspect of an embodiment of the present application provides a message sending method, including: reading a current service message from a local disk, where the current service message is a service message to be sent pointed to by a reference identifier stored in the local disk; sending a message to a message queue cluster For the current service message, update the reference ID so that the reference ID points to the next service message to be sent after the current service message in the local disk; for the case where the current service message fails to be sent, a new service message is generated according to the current service message, and the After the new service message is stored in the local disk of all service messages to be sent, the content of the current service message is the same as that of the new service message.

在一种示例性实例中,对于所述当前业务消息发送成功的情况,所述方 法还包括:返回所述从本地磁盘中读取当前业务消息的步骤;In an exemplary instance, for the situation that the current service message is successfully sent, the method further includes: returning the step of reading the current service message from the local disk;

所述将所述新的业务消息存储在所述本地磁盘中之后,所述方法还包括:返回所述从本地磁盘中读取当前业务消息的步骤。After storing the new service message in the local disk, the method further includes: returning to the step of reading the current service message from the local disk.

在一种示例性实例中,所述返回所述从本地磁盘中读取当前业务消息的步骤之前,还包括:判断当前发送任务是否终止;对于所述当前发送任务未终止的情况,继续执行所述返回所述从本地磁盘中读取当前业务消息的步骤;对于当前发送任务终止的情况,停止发送业务消息。In an exemplary example, before the step of returning to the step of reading the current service message from the local disk, the method further includes: judging whether the current sending task is terminated; for the case that the current sending task is not terminated, continuing to execute the Return to the step of reading the current service message from the local disk as described above; in the case of termination of the current sending task, stop sending the service message.

在一种示例性实例中,所述从本地磁盘中读取当前业务消息之前,还包括:扫描本地磁盘中是否存在待发送业务消息;判断出本地磁盘中存在待发送业务消息,判断消息队列集群是否正常;判断出消息队列集群正常,继续执行从本地磁盘中读取当前业务消息的步骤。In an exemplary example, before reading the current service message from the local disk, the method further includes: scanning the local disk for service messages to be sent; judging that there are service messages to be sent in the local disk, and judging the message queue cluster Is it normal? It is judged that the message queue cluster is normal, and continues to perform the steps of reading the current business message from the local disk.

在一种示例性实例中,业务消息设置有与其相对应的编号,编号用于反映业务消息的发送顺序;所述扫描本地磁盘中是否存在待发送业务消息,包括:判断本地磁盘中是否存在编号大于基准标识指向的待发送业务消息的业务消息;将编号大于基准标识指向的待发送业务消息的业务消息判定为待发送业务消息。In an exemplary example, the service message is set with a corresponding number, and the number is used to reflect the sending order of the service message; the scanning of the local disk for whether there is a service message to be sent includes: judging whether there is a number in the local disk The service message whose number is greater than the service message to be sent pointed to by the reference identifier is determined as the service message to be sent.

在一种示例性实例中,待发送业务消息包含第一标识符,第一标识符用以表征业务消息未经发送;所述扫描本地磁盘中是否存在待发送业务消息,包括:判断本地磁盘中是否存在包含第一标识符的业务消息;将包含第一标识符的业务消息判定为待发送业务消息。In an exemplary example, the service message to be sent includes a first identifier, and the first identifier is used to indicate that the service message has not been sent; the scanning whether there is a service message to be sent in the local disk includes: judging whether there is a service message in the local disk Whether there is a service message containing the first identifier; determining the service message containing the first identifier as a service message to be sent.

在一种示例性实例中,判断消息队列集群是否正常,包括:查询路由表中是否存在消息队列集群的地址;路由表中存在消息队列集群的地址,判定消息队列集群正常。In an exemplary example, determining whether the message queue cluster is normal includes: querying whether the address of the message queue cluster exists in the routing table; determining that the message queue cluster is normal if the address of the message queue cluster exists in the routing table.

本申请实施例第二方面您提供了一种消息发送装置,包括:获取模块,用于从本地磁盘中读取当前业务消息,当前业务消息为存储在本地磁盘中的基准标识指向的待发送业务消息;发送模块,用于向消息队列集群发送当前业务消息,更新基准标识,以使基准标识指向本地磁盘中位于当前业务消息之后的下一条待发送业务消息;处理模块,若当前业务消息发送失败,业务消息追加存储模块用于根据当前业务消息生成新的业务消息,并将新的业务 消息存储在本地磁盘中所有待发送业务消息之后,当前业务消息与新的业务消息的内容相同。In a second aspect of the embodiments of the present application, you provide a message sending device, including: an obtaining module, configured to read a current service message from a local disk, where the current service message is a service to be sent pointed to by a reference identifier stored in the local disk message; the sending module is used to send the current business message to the message queue cluster, and update the benchmark identifier so that the benchmark identifier points to the next business message to be sent after the current business message in the local disk; the processing module, if the current business message fails to be sent , the business message additional storage module is used to generate a new business message according to the current business message, and store the new business message in the local disk after all to-be-sent business messages, the content of the current business message and the new business message are the same.

本申请实施例第三方面提供了一种计算机设备,包括:至少一个处理器;以及与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,从而执行如本申请实施例第一方面提供的消息发送方法。A third aspect of the embodiments of the present application provides a computer device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by at least one processor. A processor executes, thereby executing the message sending method provided by the first aspect of the embodiments of the present application.

本申请实施例第四方面提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机指令,计算机指令用于使计算机执行如本申请实施例第一方面提供的消息发送方法。A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a computer to execute the message sending method provided by the first aspect of the embodiments of the present application.

本申请技术方案,具有如下优点:The technical solution of the present application has the following advantages:

本申请实施例提供的消息发送方法及装置,从本地磁盘中读取并向消息队列集群发送基准标识指向的当前业务消息,如果发送失败,则将当前业务消息组装成新的业务消息并追加存储在本地磁盘中所有待发送业务消息之后。通过本申请实施例,提供了一种业务消息发送失败时的容灾方案,在业务消息发送失败时,将发送失败的业务消息存储在本地磁盘中,一方面可以使得发送失败的业务消息被再次发送,避免了业务消息的丢失,另一方面,将发送失败的业务消息存储在本地磁盘,使得容灾方案不依赖于其他服务器。The message sending method and device provided by the embodiments of the present application read from the local disk and send the current business message pointed to by the reference identifier to the message queue cluster, and if the sending fails, assemble the current business message into a new business message and additionally store it. After all pending business messages on the local disk. The embodiment of the present application provides a disaster recovery solution when the service message fails to be sent. When the service message fails to be sent, the service message that fails to be sent is stored in the local disk. On the one hand, the service message that fails to be sent can be restored Sending, avoiding the loss of business messages, on the other hand, storing business messages that fail to be sent on the local disk, so that the disaster recovery solution does not depend on other servers.

本申请实施例的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本申请而了解。本申请的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Additional features and advantages of embodiments of the present application will be set forth in the description that follows, and in part will be apparent from the description, or may be learned by practice of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the description, claims and drawings.

在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will become apparent upon reading and understanding of the drawings and detailed description.

附图概述BRIEF DESCRIPTION OF THE DRAWINGS

此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The schematic embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the attached image:

图1为本申请实施例中消息发送方法的一种示例的流程图;FIG. 1 is a flowchart of an example of a message sending method in an embodiment of the present application;

图2为本申请实施例中消息发送方法的另一种示例的流程图;FIG. 2 is a flowchart of another example of a message sending method in an embodiment of the present application;

图3为本申请实施例中消息发送方法的又一种示例的流程图;3 is a flowchart of another example of a message sending method in an embodiment of the present application;

图4为本申请实施例中消息发送装置的一个示例的原理框图;4 is a schematic block diagram of an example of a message sending apparatus in an embodiment of the present application;

图5为本申请实施例中提供的计算机设备的组成结构示意图。FIG. 5 is a schematic structural diagram of a computer device provided in an embodiment of the present application.

详述detail

下文中将参考附图并结合实施例来详细说明本申请。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。Hereinafter, the present application will be described in detail with reference to the accompanying drawings and in conjunction with the embodiments. It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict.

下面将结合附图对本申请的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

在本申请的描述中,需要说明的是,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性。In the description of this application, it should be noted that the terms "first" and "second" are only used for description purposes, and cannot be understood as indicating or implying relative importance.

此外,下面所描述的本申请不同实施方式中所涉及的技术特征只要彼此之间未构成冲突就可以相互结合。In addition, the technical features involved in the different embodiments of the present application described below can be combined with each other as long as there is no conflict with each other.

实施例1Example 1

队列是一种先进先出的数据结构,分布式消息队列可以看作将这种数据结构部署到独立的服务器上,应用程序可以通过远程访问接口使用分布式消息队列,进行消息存取操作,进而实现分布式的异步调用。当分布式消息队列出现故障时,会导致其所要发送的消息丢失,进而导致应用方功能不可用。Queue is a first-in, first-out data structure. Distributed message queues can be regarded as deploying this data structure to an independent server. Applications can use distributed message queues through remote access interfaces to perform message access operations, and then Implement distributed asynchronous calls. When the distributed message queue fails, it will cause the message to be sent to be lost, thereby making the application function unavailable.

本申请实施例提供了一种消息发送方法,应用于发送方,如图1所示,包括:An embodiment of the present application provides a method for sending a message, which is applied to a sender, as shown in FIG. 1 , including:

步骤S10:从本地磁盘中读取当前业务消息,当前业务消息为存储在本地磁盘中基准标识指向的待发送业务消息;Step S10: read the current service message from the local disk, and the current service message is the service message to be sent pointed to by the reference identifier stored in the local disk;

步骤S20:向消息队列集群发送当前业务消息,更新基准标识,以使基准标识指向本地磁盘中位于当前业务消息之后的下一条待发送业务消息。Step S20: Send the current service message to the message queue cluster, and update the reference identifier so that the reference identifier points to the next service message to be sent after the current service message in the local disk.

在一种示例性实例中,发送方的本地磁盘中存储有多条业务消息,包括 已发送的业务消息和待发送的业务消息,每发送一次业务消息都会更新一次基准标识,使得基准标识指向下一条待发送的业务消息,可以方便在发送业务消息时准确定位下一条需要发送的业务消息,避免了业务消息的重发或漏发。In an exemplary instance, there are multiple service messages stored in the sender's local disk, including sent service messages and to-be-sent service messages, and the reference identifier is updated every time a service message is sent, so that the reference identifier points to the next A to-be-sent service message can conveniently locate the next service message to be sent when the service message is sent, thereby avoiding retransmission or omission of the service message.

步骤S30:判断当前业务消息是否发送失败,如果发送失败,则执行步骤S40,如果发送成功,返回上述步骤S10。Step S30: Determine whether the current service message fails to be sent, if the sending fails, execute step S40, and if the sending is successful, return to the above-mentioned step S10.

在一种示例性实例中,如果发送方向消息队列集群发送业务消息失败,消息队列集群会向发送方发送用于表示业务消息发送失败的反馈信息,这样,发送方接收到用于表示业务消息发送失败的反馈信息,可以判定业务消息发送失败。In an exemplary instance, if the sender fails to send a business message to the message queue cluster, the message queue cluster will send feedback information indicating the failure to send the business message to the sender. In this way, the sender receives a message indicating that the business message is sent. The failure feedback information can be used to determine that the service message fails to be sent.

步骤S40:根据当前业务消息生成新的业务消息,并将新的业务消息存储在本地磁盘中所有待发送业务消息之后,当前业务消息与新的业务消息的内容相同,返回步骤S10。Step S40: Generate a new service message according to the current service message, and store the new service message in the local disk after all to-be-sent service messages, the content of the current service message and the new service message are the same, and return to step S10.

在一种示例性实例中,本地磁盘中的已发送的业务消息和待发送的业务消息可以通过一定的方式进行区分,将发送失败的业务消息组装成新的业务消息,是指根据当前本地磁盘中区分业务消息是否已发送的规则将发送失败的业务消息组装成未发送的业务消息。In an exemplary instance, the sent service message and the service message to be sent in the local disk can be distinguished in a certain way, and assembling the service message that fails to be sent into a new service message means that according to the current local disk The rule that distinguishes whether a business message has been sent in the rules assembles business messages that fail to be sent into business messages that are not sent.

将发送失败的业务消息追加存储在本地磁盘中所有待发送业务消息之后是为了保证在不影响其他业务消息正常发送的前提下,完成对发送失败的业务消息的再次发送。在一种实施例中,也可以在本地磁盘中留出独立的空间,用于存放发送失败的业务消息,发送方可以读取并发送存储在该空间中的业务消息,以对发送失败的业务消息进行再次发送。The purpose of additionally storing the service message that fails to be sent in the local disk after all the service messages to be sent is to ensure that the service message that fails to be sent can be sent again without affecting the normal sending of other service messages. In an embodiment, an independent space may also be set aside in the local disk for storing service messages that fail to be sent. The message is sent again.

本申请实施例提供的消息发送方法,从本地磁盘中读取并向消息队列集群发送基准标识指向的当前业务消息,如果发送失败,则将当前业务消息组装成新的业务消息并追加存储在本地磁盘中所有待发送业务消息之后。通过本申请实施例,提供了一种业务消息发送失败时的容灾方案,在业务消息发送失败时,将发送失败的业务消息存储在本地磁盘中,一方面可以使得发送失败的业务消息被再次发送,避免了业务消息的丢失,另一方面,将发送失败的业务消息存储在本地磁盘,使得容灾方案不依赖于其他服务器。The message sending method provided by the embodiment of the present application reads from the local disk and sends the current service message pointed to by the reference identifier to the message queue cluster. If the sending fails, the current service message is assembled into a new service message and additionally stored locally. After all pending business messages on disk. The embodiment of the present application provides a disaster recovery solution when the service message fails to be sent. When the service message fails to be sent, the service message that fails to be sent is stored in the local disk. On the one hand, the service message that fails to be sent can be restored Sending, avoiding the loss of business messages, on the other hand, storing business messages that fail to be sent on the local disk, so that the disaster recovery solution does not depend on other servers.

在一种示例性实例中,如图2所示,本发明实施例提供的消息发送方法中,在上述返回步骤S10之前,还包括:In an exemplary example, as shown in FIG. 2 , in the message sending method provided by the embodiment of the present invention, before returning to step S10, the method further includes:

步骤S50:判断当前发送任务是否终止。在一种实施例中,为了保证资源的合理利用,发送方对业务消息的发送是定时完成的,每隔一段时间执行一次发送任务,且每次的发送任务的时间是固定的。如果当前发送任务未终止,则返回步骤S10,如果当前发送任务终止,则停止发送业务消息,结束本流程。Step S50: Determine whether the current sending task is terminated. In one embodiment, in order to ensure the rational utilization of resources, the sender completes the sending of service messages at regular intervals, performs a sending task at regular intervals, and the time for each sending task is fixed. If the current sending task is not terminated, return to step S10, if the current sending task is terminated, stop sending the service message, and end the process.

在一种示例性实例中,如图3所示,在执行上述步骤S10之前,本申请实施例提供的消息发送方法还包括:In an exemplary example, as shown in FIG. 3 , before performing the foregoing step S10, the message sending method provided by this embodiment of the present application further includes:

步骤S70:扫描本地磁盘中是否存在待发送业务消息,发送方所要发送的消息是待发送业务消息,因此在重新启动发送任务时,首先需要扫描本地磁盘中是否存在待发送业务消息。如果本地磁盘中存在待发送业务消息,执行步骤S80,如果本地磁盘中不存在待发送业务消息,结束本次发送任务。Step S70: Scan the local disk for service messages to be sent. The messages to be sent by the sender are service messages to be sent. Therefore, when restarting the sending task, it is necessary to scan the local disk for service messages to be sent. If there is a service message to be sent in the local disk, step S80 is performed, and if there is no service message to be sent in the local disk, the current sending task is ended.

步骤S80:判断消息队列集群是否正常,只有在消息队列集群正常的情况下才能使得业务消息发送成功,因此为了避免资源浪费,在重启发送任务后,还需先判断消息队列集群是否正常,如果消息队列集群正常,执行步骤S10,如果消息队列集群不正常,结束本次发送任务。Step S80: Determine whether the message queue cluster is normal. Only when the message queue cluster is normal can the service message be sent successfully. Therefore, in order to avoid waste of resources, after restarting the sending task, it is necessary to first determine whether the message queue cluster is normal. If the queue cluster is normal, step S10 is performed. If the message queue cluster is abnormal, the current sending task is ended.

在一种示例性实例中,步骤S70和步骤S80也可以择一存在,即在执行步骤S10之前只进行步骤S70的判断,或者只进行步骤S80的判断。In an exemplary example, step S70 and step S80 may alternatively exist, that is, only the judgment of step S70 is performed before step S10 is performed, or only the judgment of step S80 is performed.

需要说明的是,对消息队列集群的检测可以只在发送任务开始时检测一次,也可以在发送任务执行过程中定时检测,也可以每次对待发送业务消息发送前都进行一次检测,但是为了完成对待发送业务的快速发送,本申请实施例只在发送任务开始时检测一次,在实际应用时,可以根据实际需求选择不同检测规则。It should be noted that the detection of the message queue cluster can be detected only once at the beginning of the sending task, or it can be detected periodically during the execution of the sending task, or it can be detected every time before the service message to be sent is sent, but in order to complete the detection. For fast sending of the service to be sent, the embodiment of the present application only detects once at the beginning of the sending task, and in practical application, different detection rules can be selected according to actual requirements.

在一种示例性实例中,业务消息设置有与其相对应的编号,编号用于反映业务消息的发送顺序,上述步骤S70可以包括:In an exemplary example, the service message is set with a corresponding number, and the number is used to reflect the sending order of the service message. The above step S70 may include:

判断本地磁盘中是否存在编号大于基准标识指向的待发送业务消息的业务消息,如果存在,将编号大于基准标识指向的待发送业务消息的业务消息 判定为待发送业务消息。在一种实施例中,发送方按业务消息的编号顺序提取并发送业务消息,那么,编号小于基准标识指向的待发送业务消息的业务消息都为已发送过的业务消息,而编号大于基准标识指向的待发送业务消息的业务消息都为未发送的业务消息。Determine whether there is a service message with a number greater than the service message to be sent pointed to by the reference identifier in the local disk, and if so, determine the service message with a number greater than the service message to be sent pointed to by the reference identifier as a service message to be sent. In one embodiment, the sender extracts and sends the service messages in the order of the service message numbers. Then, the service messages whose numbers are smaller than the service messages to be sent pointed to by the reference identifier are the service messages that have been sent, and the service messages whose numbers are greater than the reference identifier are all sent. The service messages that point to the service message to be sent are all unsent service messages.

在一种示例性实例中,如果每条业务消息设置有与其相对应的编号,且编号为业务消息的发送顺序,则在步骤S30中,将发送失败的业务消息重新组装,是指为发送失败的业务消息分发新的编号,该编号大于所有待发送业务消息的编号。In an exemplary example, if each service message is set with a corresponding number, and the number is the order in which the service messages are sent, then in step S30, reassembling the service messages that fail to be sent means that the service message fails to be sent. A new number is distributed to the service message, which is greater than the number of all the service messages to be sent.

在一种示例性实例中,待发送业务消息包含第一标识符,第一标识符用以表征业务消息未经发送,上述步骤S70可以包括:In an exemplary example, the service message to be sent includes a first identifier, and the first identifier is used to indicate that the service message has not been sent. The foregoing step S70 may include:

判断本地磁盘中是否存在包含第一标识符的业务消息,如果存在,将包含第一标识符的业务消息判定为待发送业务消息。It is judged whether there is a service message containing the first identifier in the local disk, and if so, the service message containing the first identifier is judged as a service message to be sent.

在一种实施例中,如果未发送的业务消息通过第一标识符进行标识,则在步骤S30中,将发送失败的业务消息重新组装,是指在发送失败的业务消息中添加第一标识符,如此,在对业务消息发送时,可以将发送失败的业务消息判定为待发送业务消息再次发送。In an embodiment, if the unsent service message is identified by the first identifier, in step S30, reassembling the service message that fails to send means adding the first identifier to the service message that fails to send , in this way, when sending the service message, the service message that fails to be sent may be determined as the service message to be sent to be sent again.

上述两种确认待发送业务消息的方式仅为举例说明,并不用于限定本申请的保护范围,实际应用中也可以通过其他的方式区分已发送的业务消息和待发送的业务消息。The above two ways of confirming the service message to be sent are only for illustration, and are not used to limit the protection scope of the present application.

在一种示例性实例中,上述步骤S80可以包括:In an exemplary example, the above step S80 may include:

查询路由表中是否存在消息队列集群的地址,如果路由表中存在消息队列集群的地址,则判定消息队列集群正常。在一种实施例中,如果发送方的路由表中存在某一服务器的IP地址,则说明发送方可以与该服务器建立连接,并完成数据传输,但是,路由表中不存在的IP地址,发送方是无法与该IP地址对应的服务器建立连接的。在一种实施例中,当消息队列集群存在故障时,其IP地址不会出现在发送方的路由表中,因此,可以通过查询路由表检测消息队列集群是否出现故障。需要说明的是,通过路由表只能对消息队列集群进行简单的检测,即使路由表中存在消息队列集群的地址,也无法保证该分布式消息队列是正常的,因此即使路由表中存在消息队列集群的地址, 还是会出现消息发送失败的情况。Check whether the address of the message queue cluster exists in the routing table. If the address of the message queue cluster exists in the routing table, it is determined that the message queue cluster is normal. In one embodiment, if the IP address of a certain server exists in the routing table of the sender, it means that the sender can establish a connection with the server and complete the data transmission, but the IP address that does not exist in the routing table sends the The party cannot establish a connection with the server corresponding to the IP address. In one embodiment, when the message queue cluster is faulty, its IP address will not appear in the routing table of the sender, therefore, whether the message queue cluster is faulty can be detected by querying the routing table. It should be noted that only a simple detection of the message queue cluster can be performed through the routing table. Even if the address of the message queue cluster exists in the routing table, it cannot be guaranteed that the distributed message queue is normal, so even if there is a message queue in the routing table. The address of the cluster will still fail to send the message.

实施例2Example 2

本申请实施例提供了一种消息发送装置,如图4所示,包括:An embodiment of the present application provides a message sending apparatus, as shown in FIG. 4 , including:

获取模块10,用于从本地磁盘中读取当前业务消息,当前业务消息为存储在本地磁盘中的基准标识指向的待发送业务消息,详细描述见上述实施例1中对步骤S10的描述。The obtaining module 10 is configured to read the current service message from the local disk, where the current service message is the service message to be sent pointed to by the reference identifier stored in the local disk. For a detailed description, see the description of step S10 in Embodiment 1 above.

发送模块20,用于向消息队列集群发送当前业务消息,更新基准标识,以使基准标识指向本地磁盘中位于当前业务消息之后的下一条待发送业务消息,详细描述见上述实施例1中对步骤S20的描述。The sending module 20 is used to send the current service message to the message queue cluster, and update the reference identifier, so that the reference identifier points to the next service message to be sent after the current service message in the local disk. For a detailed description, see the steps in the above-mentioned embodiment 1. Description of the S20.

处理模块30,用于在当前业务消息发送失败的情况,根据当前业务消息生成新的业务消息,并将新的业务消息存储在本地磁盘中所有待发送业务消息之后,当前业务消息与新的业务消息的内容相同,详细描述见上述实施例1中对步骤S30、步骤S40的描述。The processing module 30 is used to generate a new business message according to the current business message in the case of failure to send the current business message, and store the new business message in the local disk after all the business messages to be sent, the current business message and the new business message. The content of the message is the same, and for a detailed description, see the description of step S30 and step S40 in Embodiment 1 above.

本申请提供的消息发送装置,从本地磁盘中读取并向消息队列集群基准标识指向的当前业务消息,若发送失败,则将当前业务消息组装成新的业务消息追加存储在本地磁盘中所有待发送业务消息之后。本申请提供的消息发送装置提供了一种业务消息发送失败时的容灾方案,在业务消息发送失败时,将发送失败的业务消息存储在本地磁盘中,一方面可以使得发送失败的业务消息被再次发送,避免了业务消息的丢失,另一方面,将发送失败的业务消息存储在本地磁盘,使得容灾方案不依赖于其他服务器。The message sending device provided by this application reads the current business message pointed to by the message queue cluster reference identifier from the local disk, and if the sending fails, assembles the current business message into a new business message and additionally stores all the pending business messages in the local disk. After sending a business message. The message sending device provided by the present application provides a disaster recovery solution when the service message fails to be sent. When the service message fails to be sent, the failed service message is stored in the local disk. On the one hand, the service message that fails to be sent can be stored. Sending again avoids the loss of business messages. On the other hand, business messages that fail to be sent are stored on the local disk, so that the disaster recovery solution does not depend on other servers.

实施例3Example 3

本申请实施例提供一种计算机设备,如图5所示,该计算机设备主要包括一个或多个处理器61以及存储器62,图5中以一个处理器61为例。An embodiment of the present application provides a computer device. As shown in FIG. 5 , the computer device mainly includes one or more processors 61 and a memory 62 . In FIG. 5 , one processor 61 is used as an example.

该计算机设备还可以包括:输入装置63和输出装置64。The computer equipment may also include: an input device 63 and an output device 64 .

处理器61、存储器62、输入装置63和输出装置64可以通过总线或者其他方式连接,图5中以通过总线连接为例。The processor 61 , the memory 62 , the input device 63 and the output device 64 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 5 .

处理器61可以为中央处理器(Central Processing Unit,CPU)。处理器61还可以为其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、 专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等芯片,或者上述各类芯片的组合。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。存储器62可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据消息发送装置的使用所创建的数据等。此外,存储器62可以包括高速随机存取存储器,还可以包括非暂态存储器,例如至少一个磁盘存储器件、闪存器件、或其他非暂态固态存储器件。在一些实施例中,存储器62可选包括相对于处理器61远程设置的存储器,这些远程存储器可以通过网络连接至消息发送装置。输入装置63可接收用户输入的计算请求(或其他数字或字符信息),以及产生与消息发送装置有关的键信号输入。输出装置64可包括显示屏等显示设备,用以输出计算结果。The processor 61 may be a central processing unit (Central Processing Unit, CPU). The processor 61 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), Field Programmable Gate Array (Field Programmable Gate Array, FPGA) or other Chips such as programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above types of chips. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The memory 62 may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the messaging device, and the like. Additionally, memory 62 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 62 may optionally include memory located remotely from processor 61 that may be connected to the messaging device via a network. The input device 63 may receive user input of computational requests (or other numerical or character information) and generate key signal input associated with the messaging device. The output device 64 may include a display device such as a display screen, and is used to output the calculation result.

实施例4Example 4

本申请实施例提供一种计算机可读存储介质,该计算机可读存储介质存储计算机指令,计算机存储介质存储有计算机可执行指令,该计算机可执行指令可执行上述任意方法实施例中的消息发送方法。其中,存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)、随机存储记忆体(Random Access Memory,RAM)、快闪存储器(Flash Memory)、硬盘(Hard Disk Drive,缩写:HDD)或固态硬盘(Solid-State Drive,SSD)等;存储介质还可以包括上述种类的存储器的组合。The embodiments of the present application provide a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions can execute the message sending method in any of the foregoing method embodiments . The storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive) , abbreviation: HDD) or solid-state drive (Solid-State Drive, SSD), etc.; the storage medium may also include a combination of the above-mentioned types of memories.

显然,上述实施例仅仅是为清楚地说明所作的举例,而并非对实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。而由此所引伸出的显而易见的变化或变动仍处于本申请创造的保护范围之中。Obviously, the above-mentioned embodiments are only examples for clear description, and are not intended to limit the implementation manner. For those of ordinary skill in the art, changes or modifications in other different forms can also be made on the basis of the above description. There is no need and cannot be exhaustive of all implementations here. And the obvious changes or changes derived from this are still within the scope of protection created by the present application.

以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included within the protection scope of this application.

Claims (10)

一种消息发送方法,其特征在于,包括:A message sending method, comprising: 从本地磁盘中读取当前业务消息,所述当前业务消息为存储在所述本地磁盘中基准标识指向的待发送业务消息;Read the current service message from the local disk, where the current service message is the service message to be sent pointed to by the reference identifier stored in the local disk; 向消息队列集群发送所述当前业务消息,更新所述基准标识,以使所述基准标识指向所述本地磁盘中位于所述当前业务消息之后的下一条待发送业务消息;Sending the current service message to a message queue cluster, and updating the reference identifier, so that the reference identifier points to the next service message to be sent after the current service message in the local disk; 对于所述当前业务消息发送失败的情况,根据所述当前业务消息生成新的业务消息,并将所述新的业务消息存储在所述本地磁盘中所有待发送业务消息之后,所述当前业务消息与所述新的业务消息的内容相同。In the case where the sending of the current service message fails, a new service message is generated according to the current service message, and the new service message is stored in the local disk after all the service messages to be sent. The content of the new service message is the same. 根据权利要求1所述的消息发送方法,其特征在于,The message sending method according to claim 1, wherein, 对于所述当前业务消息发送成功的情况,所述方法还包括:返回所述从本地磁盘中读取当前业务消息的步骤;For the situation that the current service message is successfully sent, the method further includes: returning to the step of reading the current service message from the local disk; 所述将所述新的业务消息存储在所述本地磁盘中之后,所述方法还包括:返回所述从本地磁盘中读取当前业务消息的步骤。After storing the new service message in the local disk, the method further includes: returning to the step of reading the current service message from the local disk. 根据权利要求2所述的消息发送方法,其特征在于,所述返回所述从本地磁盘中读取当前业务消息的步骤之前,还包括:The message sending method according to claim 2, wherein before the step of returning to the step of reading the current service message from the local disk, the method further comprises: 判断当前发送任务是否终止;Determine whether the current sending task is terminated; 对于所述当前发送任务未终止的情况,继续执行所述返回所述从本地磁盘中读取当前业务消息的步骤;For the situation that the current sending task is not terminated, continue to perform the step of returning the described reading of the current service message from the local disk; 对于所述当前发送任务终止的情况,停止发送业务消息。In the case that the current sending task is terminated, the sending of the service message is stopped. 根据权利要求1、2或3所述的消息发送方法,其特征在于,所述从本地磁盘中读取当前业务消息之前,还包括:The message sending method according to claim 1, 2 or 3, wherein before the reading the current service message from the local disk, the method further comprises: 扫描所述本地磁盘中是否存在待发送业务消息;Scan the local disk to see if there is a service message to be sent; 判断出所述本地磁盘中存在所述待发送业务消息,判断所述消息队列集群是否正常;Judging that the service message to be sent exists in the local disk, and judging whether the message queue cluster is normal; 判断出所述消息队列集群正常,继续执行所述从本地磁盘中读取当前业 务消息的步骤。It is judged that the message queue cluster is normal, and the step of reading the current service message from the local disk is continued. 根据权利要求4所述的消息发送方法,其特征在于,所述业务消息设置有与其相对应的编号,所述编号用于反映所述业务消息的发送顺序;The message sending method according to claim 4, wherein the service message is provided with a serial number corresponding to it, and the serial number is used to reflect the sending order of the service message; 所述扫描所述本地磁盘中是否存在所述待发送业务消息,包括:The scanning whether the service message to be sent exists in the local disk includes: 判断所述本地磁盘中是否存在编号大于所述基准标识指向的待发送业务消息的业务消息;Judging whether there is a service message with a number greater than the service message to be sent pointed to by the reference identifier in the local disk; 将编号大于所述基准标识指向的待发送业务消息的业务消息判定为所述待发送业务消息。A service message whose number is greater than the service message to be sent pointed to by the reference identifier is determined as the service message to be sent. 根据权利要求4所述的消息发送方法,其特征在于,所述待发送业务消息包含第一标识符,所述第一标识符用以表征业务消息未经发送;The message sending method according to claim 4, wherein the service message to be sent includes a first identifier, and the first identifier is used to indicate that the service message has not been sent; 所述扫描所述本地磁盘中是否存在所述待发送业务消息,包括:The scanning whether the service message to be sent exists in the local disk includes: 判断所述本地磁盘中是否存在包含所述第一标识符的业务消息;judging whether there is a service message containing the first identifier in the local disk; 将包含所述第一标识符的业务消息判定为所述待发送业务消息。The service message containing the first identifier is determined as the service message to be sent. 根据权利要求4所述的消息发送方法,其特征在于,所述判断所述消息队列集群是否正常,包括:The message sending method according to claim 4, wherein the judging whether the message queue cluster is normal comprises: 查询路由表中是否存在所述消息队列集群的地址;query whether the address of the message queue cluster exists in the routing table; 所述路由表中存在所述消息队列集群的地址,判定所述消息队列集群正常。The address of the message queue cluster exists in the routing table, and it is determined that the message queue cluster is normal. 一种消息发送装置,其特征在于,包括:A message sending device, comprising: 获取模块,用于从本地磁盘中读取当前业务消息,所述当前业务消息为存储在所述本地磁盘中的基准标识指向的待发送业务消息;an acquisition module, configured to read a current service message from a local disk, where the current service message is a service message to be sent pointed to by a reference identifier stored in the local disk; 发送模块,用于向消息队列集群发送所述当前业务消息,更新所述基准标识,以使所述基准标识指向所述本地磁盘中位于所述当前业务消息之后的下一条待发送业务消息;A sending module, configured to send the current service message to a message queue cluster, and update the reference identifier, so that the reference identifier points to the next service message to be sent after the current service message in the local disk; 处理模块,所述当前业务消息发送失败,所述业务消息存储模块用于根据所述当前业务消息生成新的业务消息,并将所述新的业务消息追加存储在所述本地磁盘中所有待发送业务消息之后,所述当前业务消息与所述新的业务消息的内容相同。A processing module, where the current service message fails to be sent, and the service message storage module is configured to generate a new service message according to the current service message, and additionally store the new service message in the local disk for all to-be-sent messages After the service message, the content of the current service message and the new service message is the same. 一种计算机设备,其特征在于,包括:至少一个处理器;以及与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,从而执行如权利要求1-7中任一项所述的消息发送方法。A computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the Instructions are executed by the at least one processor to perform the message sending method of any of claims 1-7. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,所述计算机指令用于使所述计算机执行如权利要求1-7中任一项所述的消息发送方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute the message sending according to any one of claims 1-7 method.
PCT/CN2021/112570 2020-08-14 2021-08-13 Message sending method and device Ceased WO2022033586A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010819845.9 2020-08-14
CN202010819845.9A CN111988391A (en) 2020-08-14 2020-08-14 Message sending method and device

Publications (1)

Publication Number Publication Date
WO2022033586A1 true WO2022033586A1 (en) 2022-02-17

Family

ID=73435491

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/112570 Ceased WO2022033586A1 (en) 2020-08-14 2021-08-13 Message sending method and device

Country Status (2)

Country Link
CN (1) CN111988391A (en)
WO (1) WO2022033586A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114629864A (en) * 2022-02-22 2022-06-14 维沃移动通信有限公司 Message sending method and device and electronic equipment
CN116266831A (en) * 2022-09-09 2023-06-20 烟台海颐软件股份有限公司 A Message Scheduling Method

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988391A (en) * 2020-08-14 2020-11-24 网联清算有限公司 Message sending method and device
CN115550450A (en) * 2022-09-20 2022-12-30 中国银行股份有限公司 A transaction message processing method and related device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105471714A (en) * 2015-12-09 2016-04-06 百度在线网络技术(北京)有限公司 Message processing method and device
CN107357526A (en) * 2017-07-03 2017-11-17 北京京东尚科信息技术有限公司 For the method and apparatus of network data, server and storage medium
KR101804822B1 (en) * 2016-07-20 2017-12-05 (주)알투비솔루션 Transaction management system for loss prevention of replication located on memory when replicating real time data of database management system
CN108965164A (en) * 2017-05-17 2018-12-07 北京京东尚科信息技术有限公司 Service request repeating method, device and readable storage medium storing program for executing based on message queue
CN110968431A (en) * 2018-09-28 2020-04-07 阿里巴巴集团控股有限公司 Message processing method, device and equipment
CN111510396A (en) * 2020-06-30 2020-08-07 腾讯科技(深圳)有限公司 Message sending method and related device
CN111988391A (en) * 2020-08-14 2020-11-24 网联清算有限公司 Message sending method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102469033B (en) * 2010-11-01 2014-08-06 阿里巴巴集团控股有限公司 Message subscription system and message sending method
US10382380B1 (en) * 2016-11-17 2019-08-13 Amazon Technologies, Inc. Workload management service for first-in first-out queues for network-accessible queuing and messaging services
CN108712501B (en) * 2018-05-28 2023-04-07 腾讯科技(北京)有限公司 Information sending method and device, computing equipment and storage medium
CN110740145B (en) * 2018-07-18 2023-08-08 北京京东尚科信息技术有限公司 Message consumption method, device, storage medium and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105471714A (en) * 2015-12-09 2016-04-06 百度在线网络技术(北京)有限公司 Message processing method and device
KR101804822B1 (en) * 2016-07-20 2017-12-05 (주)알투비솔루션 Transaction management system for loss prevention of replication located on memory when replicating real time data of database management system
CN108965164A (en) * 2017-05-17 2018-12-07 北京京东尚科信息技术有限公司 Service request repeating method, device and readable storage medium storing program for executing based on message queue
CN107357526A (en) * 2017-07-03 2017-11-17 北京京东尚科信息技术有限公司 For the method and apparatus of network data, server and storage medium
CN110968431A (en) * 2018-09-28 2020-04-07 阿里巴巴集团控股有限公司 Message processing method, device and equipment
CN111510396A (en) * 2020-06-30 2020-08-07 腾讯科技(深圳)有限公司 Message sending method and related device
CN111988391A (en) * 2020-08-14 2020-11-24 网联清算有限公司 Message sending method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114629864A (en) * 2022-02-22 2022-06-14 维沃移动通信有限公司 Message sending method and device and electronic equipment
CN114629864B (en) * 2022-02-22 2024-04-16 维沃移动通信有限公司 Message sending method, device and electronic device
CN116266831A (en) * 2022-09-09 2023-06-20 烟台海颐软件股份有限公司 A Message Scheduling Method

Also Published As

Publication number Publication date
CN111988391A (en) 2020-11-24

Similar Documents

Publication Publication Date Title
WO2022033586A1 (en) Message sending method and device
JP4637842B2 (en) Fast application notification in clustered computing systems
US10382380B1 (en) Workload management service for first-in first-out queues for network-accessible queuing and messaging services
CN109842651B (en) Uninterrupted service load balancing method and system
US9614646B2 (en) Method and system for robust message retransmission
CN106506490B (en) A kind of distributed computing control method and distributed computing system
US10243919B1 (en) Rule-based automation of DNS service discovery
CN103460203A (en) Cluster unique identifier
CN111259072A (en) Data synchronization method and device, electronic equipment and computer readable storage medium
CN104980519A (en) Multi-computer room storage system
CN110049113A (en) Service message processing method and device
CN114900449B (en) Resource information management method, system and device
CN105162879A (en) Method, device and system for realizing data consistency among plurality of machine rooms
JP2017502414A (en) System and method for supporting asynchronous calls in a distributed data grid
CN111314443A (en) Node processing method, device and device and medium based on distributed storage system
CN107678918A (en) The OSD heartbeat mechanisms method to set up and device of a kind of distributed file system
JP4612714B2 (en) Data processing method, cluster system, and data processing program
CN110674153B (en) Data consistency detection method and device and electronic equipment
CN111274047A (en) Information processing method, terminal, system, computer equipment and storage medium
CN108363618A (en) A kind of method and apparatus of process processing
US11397632B2 (en) Safely recovering workloads within a finite timeframe from unhealthy cluster nodes
CN116541461A (en) Data processing method, device, equipment and storage medium applied to database
CN114143730B (en) Signaling processing method, communication system, electronic device and storage medium
CN111901243B (en) Service request routing method, scheduler and service platform
CN115633046A (en) Kafka high-availability scheme optimization method, device, equipment and storage medium

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21855636

Country of ref document: EP

Kind code of ref document: A1