CN108228363A - A kind of message method and device - Google Patents

A kind of message method and device Download PDF

Info

Publication number
CN108228363A
CN108228363A CN201711406639.XA CN201711406639A CN108228363A CN 108228363 A CN108228363 A CN 108228363A CN 201711406639 A CN201711406639 A CN 201711406639A CN 108228363 A CN108228363 A CN 108228363A
Authority
CN
China
Prior art keywords
message
database
queue
sent
determined
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
CN201711406639.XA
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.)
China Unionpay Co Ltd
Original Assignee
China Unionpay 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 China Unionpay Co Ltd filed Critical China Unionpay Co Ltd
Priority to CN201711406639.XA priority Critical patent/CN108228363A/en
Publication of CN108228363A publication Critical patent/CN108228363A/en
Pending legal-status Critical Current

Links

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

Abstract

The invention discloses a kind of message method and devices.The method includes can:First message is obtained from message queue, and second message is obtained from first database according to second round according to the period 1;Then the first message and the second message are respectively sent to client, however, it is determined that the first message sends failure, then stores the first message to the first database.Message is sent simultaneously by message queue, first database the two different channels, so as to improve the efficiency of entire message transmission flow;Further, it is stored failure news is sent in message queue to first database, by first database be responsible for that failure news will be sent in message queue and be sent again, can avoid the problem that message in message queue in the prior art send fail after be newly stored into message queue and influence the transmission speed of remaining message in message queue.

Description

A kind of message method and device
Technical field
The present invention relates to field of communication technology more particularly to a kind of message method and devices.
Background technology
With the increase of portfolio and the diversification of business scenario, the application of existing application server deployment it is increasingly huge and It is difficult to safeguard, is simplified system architecture and raising treatment effeciency, the processing method of message queue obtains universal application.It is safeguarding Message queue mechanism in, response thread generates according to the needs of business scenario and delivers message to team when user initiates to ask Row, processing thread extracts message from queue and carries out next step business processing, so as to fulfill the decoupling of application service layer.
However, existing message queue mechanism is commonly single queue single thread processing, due to the message tune in message queue In degree method, generally use poll and first in first out, and handled according to the sequence of time of delivery, therefore, once certain disappears Breath sends failure, and the tail of the queue waiting that can only insert the message into message queue is sent again, so as to easily extend message queue In remaining message sending time.
Based on this, at present there is an urgent need for a kind of message method, for solving after message transmission fails in the prior art again The problem of remaining message sending time being caused to extend after deposit message queue.
Invention content
The embodiment of the present invention provides a kind of message method and device, to solve after breath transmission fails in the prior art again Secondary send takes the technical issues of longer.
The embodiment of the present invention provides a kind of message method, the method includes:
First message is obtained from message queue according to the period 1;
Second message is obtained from first database according to second round;The second message is disappearing of being not yet successfully transmitted Breath;
The first message and the second message are respectively sent to client;
If it is determined that the first message sends failure, then the first message is stored to the first database.
Optionally, it is described obtain first message from message queue according to the period 1 before, the method further includes:
According to the type of message of the first message, the first message is sent to the message class with the first message The corresponding message queue of type.
Optionally, the method further includes:
If it is determined that the first message, which is sent to corresponding message queue, sends failure, then by the first message store to The first database.
Optionally, it is described that second message is obtained from first database according to second round, including:
For every message in the first database, the timestamp information of the message is obtained;
According to the timestamp information, the generation time of the message is determined;The generation time is generates the message Time;
According to the generation time by elder generation to the primary message of rear ranking as the second message.
Optionally, the method further includes:
If it is determined that the second message is sent successfully, then by the second message in the first database labeled as send into Work(;
If it is determined that the second message sends failure, and the transmission times of the second message is more than first threshold, then will Second message in the first database fails labeled as transmission.
Optionally, the period 1 be less than the second round, the second round be less than second threshold, described second Threshold value is to be determined according to message queue for the retransmittal interval for sending failed message.
The embodiment of the present invention provides a kind of message sending device, and described device includes:
Acquiring unit, for obtaining first message from message queue according to the period 1;According to second round from first Second message is obtained in database;The second message is the message being not yet successfully transmitted;
Transmitting element, for the first message and the second message to be respectively sent to client;
Processing unit, for if it is determined that the first message sends failure, then storing the first message to described the One database.
Optionally, before first message is obtained from message queue according to the period 1 described in the acquiring unit, institute Transmitting element is stated to be additionally operable to:
According to the type of message of the first message, the first message is sent to the message class with the first message The corresponding message queue of type.
Optionally, the processing unit is additionally operable to:
If it is determined that the first message, which is sent to corresponding message queue, sends failure, then by the first message store to The first database.
Optionally, the acquiring unit is specifically used for:
For every message in the first database, the timestamp information of the message is obtained;
According to the timestamp information, the generation time of the message is determined;The generation time is generates the message Time;
According to the generation time by elder generation to the primary message of rear ranking as the second message.
Optionally, the processing unit is additionally operable to:
If it is determined that the second message is sent successfully, then by the second message in the first database labeled as send into Work(;
If it is determined that the second message sends failure, and the transmission times of the second message is more than first threshold, then will Second message in the first database fails labeled as transmission.
Optionally, the period 1 be less than the second round, the second round be less than second threshold, described second Threshold value is to be determined according to message queue for the retransmittal interval for sending failed message.
The embodiment of the present invention provides a kind of computer readable storage medium, and the storage medium is stored with instruction, when described When instruction is run on computers so that computer, which is realized, performs method described above.
The embodiment of the present invention provides a kind of computer equipment, including:
Memory, for storing program instruction;
Processor for calling the program instruction stored in the memory, performs described above according to the program of acquisition Method.
In the embodiment of the present invention, first message is obtained from message queue according to the period 1, and according to second round from Second message is obtained in first database;Then the first message and the second message are respectively sent to client, if It determines that the first message sends failure, then stores the first message to the first database.In the embodiment of the present invention, Information and sending is obtained from message queue and first database respectively, the two are different by message queue, first database Channel send message simultaneously, so as to improve the efficiency of entire message transmission flow;Further, it will be sent out in message queue Failure news is sent to store to first database, is responsible for that failure news progress will be sent in message queue again by first database Secondary transmission avoids the message in message queue in the prior art from being newly stored into message queue after sending failure and influence message team In row the problem of the transmission speed of remaining message, due in message queue send failure news account for it is smaller, using this Kind method, the transmission that can shorten most of message takes, and then can improve the transmitting efficiency of most of message.
Description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly introduced, it should be apparent that, the accompanying drawings in the following description is only some embodiments of the present invention, for this For the those of ordinary skill in field, without having to pay creative labor, it can also be obtained according to these attached drawings His attached drawing.
Fig. 1 is a kind of structure diagram of message transmission system provided in an embodiment of the present invention;
Fig. 2 is the flow diagram corresponding to a kind of message method provided in an embodiment of the present invention;
Fig. 3 is the correspondence figure of a kind of message queue provided in an embodiment of the present invention and sub- sending device;
Fig. 4 is the flow diagram performed by a kind of message receiving apparatus provided in an embodiment of the present invention;
Fig. 5 is the flow diagram performed by a kind of message forwarding storage device provided in an embodiment of the present invention;
Fig. 6 is the flow diagram performed by a kind of message sending device provided in an embodiment of the present invention;
Fig. 7 is the stream performed by a kind of message of message receiving apparatus processing railway parent company provided in an embodiment of the present invention Journey schematic diagram;
Fig. 8 is that a kind of message provided in an embodiment of the present invention forwards storage device to handle performed by the message of railway parent company Flow diagram;
Fig. 9 is the stream performed by a kind of message of message sending device processing railway parent company provided in an embodiment of the present invention Journey schematic diagram;
Figure 10 is a kind of flow diagram of message sending device provided in an embodiment of the present invention.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention is made below in conjunction with attached drawing into It is described in detail to one step, it is clear that the described embodiments are only some of the embodiments of the present invention rather than whole implementation Example.Based on the embodiments of the present invention, those of ordinary skill in the art are obtained without making creative work All other embodiment, shall fall within the protection scope of the present invention.
Fig. 1 illustratively shows a kind of structure diagram of message transmission system provided in an embodiment of the present invention, this is A kind of message method that system framework is provided suitable for the operation embodiment of the present invention.The system architecture includes message and generates end Equipment 101, message sink end equipment 102, message receiving apparatus 103, message storing and forwarding device 104, message sending device 105.Wherein, message generates end equipment 101 for providing message to be sent, and message receiving apparatus 103 is used to generate from message End equipment 101 obtains message, and the message got is handled;Message storing and forwarding device 104 is used for from message sink Treated message is obtained in device 103, and will be in message storage to message queue 1041 or database 1042;Message sends dress 105 are put for obtaining message from message queue 1041 or database 1042, and the message got is sent to message sink In end equipment 102.
In the embodiment of the present invention, it can be server that message, which generates end equipment,.Message sink end equipment can be client Equipment, such as laptop, smart mobile phone, tablet computer, individual PC etc..
Further, message sending device 105 can include message queue type message sending device 1051 and database type Message sending device 1052.Wherein, message queue type message sending device 1051 is used to obtain message from message queue 1041, And the message got is sent in message sink end equipment 102;Database type message sending device 1052 is used for from data Message is obtained in library 1042, and the message got is sent in message sink end equipment 102.
In the embodiment of the present invention, message transmission system as shown in Figure 1, on the one hand, due to device phase each in the system It is mutually independent, it can effectively reduce the influence to other devices when a certain device is upgraded or is transformed;On the other hand, message sink Device and message storing and forwarding device are deployed in the core space of the system, and message sending device is deployed in the direct memory of the system Access (Direct Memory Access, DMA) area so that message sink end equipment can not contact core space data, so as to carry The high safety of system.
Based on foregoing description, Fig. 2 shows the flows corresponding to a kind of message method provided in an embodiment of the present invention Schematic diagram, the flow can be performed by message sending device.As described in Figure 2, specifically comprise the following steps:
Step 201, first message is obtained from message queue according to the period 1.
Step 202, second message is obtained from first database according to second round.
Step 203, the first message and the second message are respectively sent to client.
Step 204, however, it is determined that the first message sends failure, then stores the first message to first data Library.
In the embodiment of the present invention, information and sending is obtained from message queue and first database respectively, passes through message team Row, first database the two different channels send message simultaneously, so as to improve the efficiency of entire message transmission flow; Further, failure news will be sent in message queue to store to first database, be responsible for by first database by message team Failure news is sent in row to be sent again, and the message in message queue in the prior art is avoided to be deposited again after sending failure The problem of entering in message queue and influencing the transmission speed of remaining message in message queue, due to sending failure in message queue Message accounts for smaller, and therefore, in this way, the transmission that can shorten most of message takes, and then can improve big portion Divide the transmitting efficiency of message.
Specifically, before step 201 is performed, message receiving apparatus can be according to the message of the first message got The first message is sent to message queue corresponding with the type of message of the first message by type.Wherein, type of message Including the merchant type for generating message, the name of firm for generating message, the time for generating message etc..To generate trade company's class of message For type, the division of merchant type can be determined according to Unionpay with reference to table, for example, merchant type can be divided into food and drink class, trip Shop class, jewelry, road traffic class.But the property value quantity of some type of messages is excessively huge, using generate time of message as Example, the time for generating message can be 2017-12-1 00:01:25、2017-12-1 10:25:50、2017-12-2 14: 32:The different time numerical value such as 15, it is contemplated that the data distribution range for generating the time of message is larger, to avoid data processing The time for generating message in the application, can be divided into multiple sections by complexity according to twenty four hours system, for example, will be raw Into message time [00:00:00-00:59:59] one kind is divided into, can be represented with numerical value 0, the time of message will be generated [01:00:00-01:59:59] one kind is divided into, can be represented with numerical value 1, can will generate message in this way Time is divided into 24 classifications;Can also further refine, by hour specific to minute, second etc., for example, when analysis 2:00 AM During the message generated between to 3 points, the time for generating message can be divided into one kind at regular intervals, so as to effectively simplify The time numerical value of generation message.The property value of other element of transaction can also carry out similar simplification, specifically repeat no more.
It is the correspondence example of a kind of type of message and message queue as shown in table 1 in one example.The quotient of message 1 Name in an account book is known as company A, and the name of firm of message 2 is company B, and the name of firm of message 3 is company C, then message receiving apparatus can Message 1 is sent in message queue a corresponding with company A, message 2 is sent in message queue b corresponding with company B, Message 3 is sent in message queue c corresponding with company C.
Table 1:A kind of correspondence example of type of message and message queue
Message The name of firm of message Corresponding message queue
Message 1 Company A Message queue a
Message 2 Company B Message queue b
Message 3 Company C Message queue c
In another example, it is contemplated that the message number of certain type of messages is excessively huge, type of message and message queue Between can also be one-to-many relationship.As shown in table 2, the correspondence example for another type of message and message queue, If the message number of company A is far longer than other companies, message 1, message 2, message 3, message 4, message 5 as shown in table 2, The name of firm of message 6 is company A, then can be sent to the message that a part of name of firm is company A corresponding with company A In message queue a1, message 1, message 2, message 3 are sent to message queue a1 as shown in table 2;By another part quotient The message that name in an account book is known as company A is sent in message queue a2 corresponding with company A, as shown in table 2 by message 4, disappear Breath 5, message 6 are sent to message queue a2.
Table 2:Another correspondence example of type of message and message queue
Message The name of firm of message Corresponding message queue
Message 1 Company A Message queue a1
Message 2 Company A Message queue a1
Message 3 Company A Message queue a1
Message 4 Company A Message queue a2
Message 5 Company A Message queue a2
Message 6 Company A Message queue a2
It should be noted that those skilled in the art can rule of thumb modify to table 2 with actual conditions, for example, The classification (message queue a3 such as corresponding with company A) of the corresponding message queues of company A can be increased in table 2;Alternatively, also may be used 1 corresponding message queue of message is revised as a2 in table 2, do not limit specifically.
In step 201 and step 202, first message is that message generates the message to be sent that section equipment provides;Second message Not yet to send successful message, for example, second message, which can be derived from message queue, not yet sends successful message;Or Person, second message can also derive from message forwarding storage device and not yet send successful message.
In the embodiment of the present invention, message sending device can obtain first message from message queue in real time;Alternatively, disappear Breath sending device can also periodically obtain first message from message queue, for example, message sending device was according to first week Phase obtains first message from message queue, however, it is determined that the first message is sent to corresponding message queue and sends failure, then The first message is stored to the first database, so as to mitigate system burden.Those skilled in the art can root According to experience and actual conditions sets itself period 1, do not limit specifically.
Message sending device can obtain second message from first database in real time;Alternatively, message sending device Second message can be periodically obtained from first database, for example, message sending device is counted according to second round from first According to second message is obtained in library, so as to mitigate system burden.Those skilled in the art can set the period 1 to be less than the Two cycles, to improve the transmitting efficiency of the message in message queue;Further, the second round can also be set to be less than the Two threshold values, the second threshold can be determined according to message queue for the retransmittal interval for sending failed message.
Further, message sending device can include message queue type sending device and database type sending device.Its In, message queue type sending device is used to obtain first message from message queue according to the period 1;Database type sends dress It puts to obtain second message from first database according to second round.In this way, message sending device is divided For message queue type sending device and database type sending device, disappearing in message queue is handled by message queue type sending device Breath handles the message not yet sent in database, on the one hand, message sending device can be avoided same by database type sending device When get first message and second message leads to the situation that the transmission of first message and second message sequence can not determine, and then Mitigate the operation burden of message sending device;On the other hand, when message queue type sending device breaks down, number can be passed through Message transmission is carried out according to library, when database type sending device, message queue type sending device remains able to the transmission overwhelming majority and disappears Breath, it is standby so as to realize the dual mutual calamity of message transmission system in message queue and database level, it improves message and sends system The Stability and dependability of system.
Further, message queue type sending device can include multiple sub- sending devices, every sub- sending device point The message got from corresponding message queue Yong Yu not sent.Fig. 3 illustrates provided in an embodiment of the present invention one The correspondence figure of kind message queue and sub- sending device, as shown in figure 3, each message queue corresponds to a sub- sending device, Message queue 1 as shown in Figure 3 corresponds to sub- sending device 1, and message queue 2 corresponds to sub- sending device 2, and message queue 3 corresponds to Sub- sending device 3.That is, sub- sending device 1 obtains information and sending from message queue 1, sub- sending device 2 is from message Information and sending is obtained in queue 2, sub- sending device 3 obtains information and sending from message queue 3.It should be noted that this In inventive embodiments, the correspondence between message queue and sub- sending device can be pre-set, for example, son sends dress Information and sending can only be obtained from message queue 1 by putting 1, and it is concurrent that sub- sending device 2 can only obtain message from message queue 2 It send, sub- sending device 3 can only obtain information and sending from message queue 1;Alternatively, pair between breath queue and sub- sending device Should be related to it can also is determines according to actual conditions, for example, the sub- sending device being in idle condition and message queue are noted Volume, information and sending is obtained from the message queue, is not limited specifically.
Further, the method that a kind of database type sending device provided in an embodiment of the present invention sends message, specifically Include the following steps:
Step 301, for every message in the first database, the timestamp information of the message is obtained.
Step 302, according to the timestamp information, the generation time of the message is determined;The generation time is generation The time of the message.
Step 303, according to the generation time by elder generation to the primary message of rear ranking as the second message.
Step 304, second message is obtained from first database according to second round.
In the embodiment of the present invention, obtained and disappeared from first database to the method in step 304 using above-mentioned steps 301 Breath, according to the timestamp information of every message in first database, by the message in first database according to message generation when Between sequencing be ranked up, the preceding message prioritization of generation time is sent, same message can be avoided to be repeated acquisition Situation, so as to accelerate the speed of Message Processing.
In step 203 and step 204, first message is sent to client by message queue type sending device, according to whether It sends successfully, there are following two results:(1) if it is determined that the first message is sent to client sends successfully, then will described in First message is stored to the second database, convenient for monitoring message send situation, be conducive to the message of transmission carry out statistics with Analysis;(2) if it is determined that the first message, which is sent to client, sends failure, then the first message is stored to described first Database so as to be sent again by database type sending device to sending failure news, avoids the prior art Message in middle message queue sends the transmission that remaining message in message queue is newly stored into message queue and influenced after failure The problem of speed, due to sent in message queue failure news account for it is smaller, in this way, can shorten big The transmission of part messages takes, and then can improve the transmitting efficiency of most of message.
Second message is sent to client by database type sending device, however, it is determined that the second message is sent to client It sends successfully, is then labeled as sending successfully by the second message in the first database;If it is determined that the second message is sent It sends and fails to client, and the transmission times of the second message is more than first threshold, then it will be in the first database Second message fails labeled as transmission.Wherein, the first threshold can be empirically configured with actual conditions, specifically not It limits.
Specifically, when the transmission times of second message is more than the number that first threshold limits, by the first database In second message labeled as send fail;Otherwise it just waits for retransmitting second message, until the transmission time of second message Number is more than the number that first threshold limits.
In order to preferably explain the embodiment of the present invention, implementation of the present invention is described below in conjunction with Fig. 1, Fig. 4, Fig. 5 and Fig. 6 The idiographic flow that message is sent in example.
In the embodiment of the present invention, the flow performed by message receiving apparatus is as shown in figure 4, the flow specifically includes:
Step 400, initiation message receiving thread.
Step 401, configuration information is obtained from configuration parameter;The configuration information includes the message protocol type column supported Table, field verification list of rules.
Step 402, whether the service of judging runs, if so, performing step 403;If it is not, then perform step 410.
Step 403, it is generated in end equipment from message and obtains message.
Step 404, judge whether the message supports message protocol, if so, performing step 405;If it is not, then perform step Rapid 411.
Step 405, judging the message, whether matching field verification is regular, if so, performing step 406;If it is not, it then holds Row step 411.
Step 406, according to the type of message of message, the mark of the corresponding message queue of message is determined.
Step 407, the operation of the working processes such as the mark of message queue is added to the message.
Step 408, message storing and forwarding device is sent a message to, and judges whether to send successfully, if so, performing step Rapid 409;If it is not, then perform step 411.
Step 409, message generation end equipment is returned to receive successfully.
Step 410, terminate service.
Step 411, message is abandoned, and returns to message and generate end equipment reception failure.
Above-mentioned message receiving apparatus major function is to generate section equipment from message to obtain information and sending to message storage turn Transmitting apparatus, specifically, message sink thread start, and read configuration parameter, obtain message protocol list of types, the field school of support List of rules etc. is tested, then in the case where main service remains operational, is generated from message and message is obtained in end equipment, and determined Under the premise of the message supports message protocol and matching field verification rule, according to the type of message of message, determine that message corresponds to Message queue mark and the mark of message queue is added in message field, then send a message to message and deposit Retransmission unit is stored up, if sent successfully, message generation end equipment is returned and receives successfully, if sending failure, message is lost It abandons, and returns to message and generate end equipment reception failure.
Flow performed by message forwarding storage device is as shown in figure 5, the flow specifically includes:
Step 500, initiation message forwarding storage thread.
Step 501, whether the service of judging runs, if so, performing step 502;If it is not, then perform step 507.
Step 502, the message that message receiving apparatus is sent is received.
Step 503, judge whether to include the mark of message queue in the message received, if so, performing step 504; If it is not, then perform step 508.
Step 504, according to the mark of message queue, corresponding message queue is sent the message to.
Step 505, judge whether to be successfully sent to corresponding message queue, if it is not, then performing step 506;If so, it holds Row step 509.
Step 506, the message is stored to first database, and performs step 509.
Step 507, terminate service.
Step 508, message receiving apparatus processing failure is returned.
Step 509, message receiving apparatus is returned to handle successfully.
The major function of the message storing and forwarding device is to receive the message that message receiving apparatus is sent, while to the message It is forwarded or stores, specifically, message forwarding storage thread starts, and in the case where main service remains operational, receives message The message that reception device is sent, if including the mark of message queue in the message, sends the message to corresponding message Queue, further, if the message, which fails, is sent to corresponding message queue, by message storage to the first data In library;If not including the mark of message queue in the message, message receiving apparatus processing failure is returned.
Flow performed by message sending device is as shown in fig. 6, the flow specifically includes:
Step 600, initiation message sends thread.
Step 601, the type of message sending device is obtained from configuration parameter.
Step 602, whether the type for judging message sending device is message queue type sending device, if so, performing step Rapid 603;If it is not, and for database type sending device, then perform step 610.
Step 603, it is registered to message queue.
Step 604, first message is obtained from message queue.
Step 605, message queue successful respond is returned.
Step 606, the first message is sent to message sink end equipment.
Step 607, judge that first message is sent to whether message sink end equipment sends success, if so, performing step 608;If it is not, then perform step 609.
Step 608, first message is stored to the second database.
Step 609, first message is stored to first database.
Step 610, second message is obtained from first database.
Step 611, the transmission times of second message in first database is updated, enables i=i+1.
Step 612, the second message is sent to message sink end equipment.
Step 613, judge that second message is sent to whether message sink end equipment sends success, if so, performing step 614;If it is not, then perform step 615.
Step 614, the second message in the first database is labeled as sending successfully.
Step 615, judge whether the transmission times of second message is more than first threshold, if so, performing step 616;If It is no, then return to step 610.
Step 616, the second message in the first database is failed labeled as transmission.
The major function of the message sending device is that information and sending is obtained from message queue and first database to disappearing Receiving device is ceased, specifically, message sends thread and starts, and reads configuration parameter, obtains the type of message sending device, if For message queue type sending device, after successful registration to message queue, first message is obtained from message queue, and by institute It states first message and is sent to message sink end equipment, if sending successfully, first message is stored to the second database, if sending Failure, then store first message to first database;If it is database type sending device, is obtained from first database After two message, the transmission times of second message in first database is updated, and the second message is sent to message sink End equipment if sending successfully, the second message in the first database is labeled as sending successfully;If failure is sent, and The transmission times of second message is more than first threshold, then the second message in the first database fails labeled as transmission.
Below by taking a payment notification message for handling railway parent company as an example, with reference to Fig. 1, Fig. 7, Fig. 8 and Fig. 9 to above-mentioned Described flow is illustrated, and for details, reference can be made to Fig. 7, Fig. 8, Fig. 9 and above-mentioned described content, no longer superfluous herein It states.
Based on same inventive concept, Figure 10 illustrates a kind of message sending device provided in an embodiment of the present invention Structure diagram, as shown in Figure 10, the message sending device include acquiring unit 1001, transmitting element 1002, processing unit 1003;Wherein,
Acquiring unit 1001, for obtaining first message from message queue according to the period 1;According to second round from Second message is obtained in first database;The second message is the message being not yet successfully transmitted;
Transmitting element 1002, for the first message and the second message to be respectively sent to client;
Processing unit 1003, for if it is determined that first message transmission failure, then store the first message to institute State first database.
Optionally, obtained from message queue according to the period 1 described in the acquiring unit 1001 first message it Before, the transmitting element 1002 is additionally operable to:
According to the type of message of the first message, the first message is sent to the message class with the first message The corresponding message queue of type.
Optionally, the processing unit 1003 is additionally operable to:
If it is determined that the first message, which is sent to corresponding message queue, sends failure, then by the first message store to The first database.
Optionally, the acquiring unit 1001 is specifically used for:
For every message in the first database, the timestamp information of the message is obtained;
According to the timestamp information, the generation time of the message is determined;The generation time is generates the message Time;
According to the generation time by elder generation to the primary message of rear ranking as the second message.
Optionally, the processing unit 1003 is additionally operable to:
If it is determined that the second message is sent successfully, then by the second message in the first database labeled as send into Work(;
If it is determined that the second message sends failure, and the transmission times of the second message is more than first threshold, then will Second message in the first database fails labeled as transmission.
Optionally, the period 1 be less than the second round, the second round be less than second threshold, described second Threshold value is to be determined according to message queue for the retransmittal interval for sending failed message.
The embodiment of the present invention provides a kind of computer readable storage medium, and the storage medium is stored with instruction, when described When instruction is run on computers so that computer, which is realized, performs method described above.
The embodiment of the present invention provides a kind of computer equipment, including:
Memory, for storing program instruction;
Processor for calling the program instruction stored in the memory, performs described above according to the program of acquisition Method.
In the embodiment of the present invention, first message is obtained from message queue according to the period 1, and according to second round from Second message is obtained in first database;Then the first message and the second message are respectively sent to client, if It determines that the first message sends failure, then stores the first message to the first database.In the embodiment of the present invention, Information and sending is obtained from message queue and first database respectively, the two are different by message queue, first database Channel send message simultaneously, so as to improve the efficiency of entire message transmission flow;Further, it will be sent out in message queue Failure news is sent to store to first database, is responsible for that failure news progress will be sent in message queue again by first database Secondary transmission avoids the message in message queue in the prior art from being newly stored into message queue after sending failure and influence message team In row the problem of the transmission speed of remaining message, due in message queue send failure news account for it is smaller, using this Kind method, the transmission that can shorten most of message takes, and then can improve the transmitting efficiency of most of message.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, system or computer program Product.Therefore, the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware can be used in the present invention Apply the form of example.Moreover, the computer for wherein including computer usable program code in one or more can be used in the present invention The computer program production that usable storage medium is implemented on (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of product.
The present invention be with reference to according to the method for the embodiment of the present invention, the flow of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagram The combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be provided The processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that the instruction performed by computer or the processor of other programmable data processing devices is generated for real The device of function specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction generation being stored in the computer-readable memory includes referring to Enable the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram or The function of being specified in multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps are performed on calculation machine or other programmable devices to generate computer implemented processing, so as in computer or The instruction offer performed on other programmable devices is used to implement in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know basic creation Property concept, then additional changes and modifications may be made to these embodiments.So appended claims be intended to be construed to include it is excellent It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art God and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (14)

1. a kind of message method, which is characterized in that the method includes:
First message is obtained from message queue according to the period 1;
Second message is obtained from first database according to second round;The second message is the message being not yet successfully transmitted;
The first message and the second message are respectively sent to client;
If it is determined that the first message sends failure, then the first message is stored to the first database.
2. according to the method described in claim 1, it is characterized in that, is obtained from message queue according to the period 1 described Before one message, the method further includes:
According to the type of message of the first message, the first message is sent to the type of message pair with the first message The message queue answered.
3. according to the method described in claim 2, it is characterized in that, the method further includes:
If it is determined that the first message, which is sent to corresponding message queue, sends failure, then the first message is stored to described First database.
4. according to the method described in claim 1, it is characterized in that, described obtain according to second round from first database Two message, including:
For every message in the first database, the timestamp information of the message is obtained;
According to the timestamp information, the generation time of the message is determined;The generation time be the generation message when Between;
According to the generation time by elder generation to the primary message of rear ranking as the second message.
5. according to the method described in claim 1, it is characterized in that, the method further includes:
If it is determined that the second message is sent successfully, then the second message in the first database is labeled as sending successfully;
If it is determined that the second message sends failure, and the transmission times of the second message is more than first threshold, then by described in Second message in first database fails labeled as transmission.
6. the method according to any one of claims 1 to 5, it is characterized in that, the period 1 is less than described second Period, the second round are less than second threshold, and the second threshold is for the weight for sending failed message according to message queue Hair time interval determines.
7. a kind of message sending device, which is characterized in that described device includes:
Acquiring unit, for obtaining first message from message queue according to the period 1;According to second round from the first data Second message is obtained in library;The second message is the message being not yet successfully transmitted;
Transmitting element, for the first message and the second message to be respectively sent to client;
Processing unit, for if it is determined that first message transmission failure, then store the first message to the described first number According to library.
8. device according to claim 7, which is characterized in that described in the acquiring unit according to the period 1 from message Before obtaining first message in queue, the transmitting element is additionally operable to:
According to the type of message of the first message, the first message is sent to the type of message pair with the first message The message queue answered.
9. device according to claim 8, which is characterized in that the processing unit is additionally operable to:
If it is determined that the first message, which is sent to corresponding message queue, sends failure, then the first message is stored to described First database.
10. device according to claim 7, which is characterized in that the acquiring unit is specifically used for:
For every message in the first database, the timestamp information of the message is obtained;
According to the timestamp information, the generation time of the message is determined;The generation time be the generation message when Between;
According to the generation time by elder generation to the primary message of rear ranking as the second message.
11. device according to claim 7, which is characterized in that the processing unit is additionally operable to:
If it is determined that the second message is sent successfully, then the second message in the first database is labeled as sending successfully;
If it is determined that the second message sends failure, and the transmission times of the second message is more than first threshold, then by described in Second message in first database fails labeled as transmission.
12. the device according to any one of claim 6 to 11, which is characterized in that the period 1 is less than described the Two cycles, the second round are less than second threshold, and the second threshold is for transmission failed message according to message queue What retransmittal interval determined.
13. a kind of computer readable storage medium, which is characterized in that the storage medium is stored with instruction, when described instruction exists When being run on computer so that computer realizes that perform claim requires the method described in any one of 1 to 6.
14. a kind of computer equipment, which is characterized in that including:
Memory, for storing program instruction;
Processor, for calling the program instruction stored in the memory, according to acquisition program perform as claim 1 to Method described in 6 any claims.
CN201711406639.XA 2017-12-22 2017-12-22 A kind of message method and device Pending CN108228363A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711406639.XA CN108228363A (en) 2017-12-22 2017-12-22 A kind of message method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711406639.XA CN108228363A (en) 2017-12-22 2017-12-22 A kind of message method and device

Publications (1)

Publication Number Publication Date
CN108228363A true CN108228363A (en) 2018-06-29

Family

ID=62647848

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711406639.XA Pending CN108228363A (en) 2017-12-22 2017-12-22 A kind of message method and device

Country Status (1)

Country Link
CN (1) CN108228363A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109120713A (en) * 2018-09-21 2019-01-01 中国建设银行股份有限公司 Message sends the processing method and system, device and storage medium of failure
CN109783258A (en) * 2019-02-21 2019-05-21 北京奇艺世纪科技有限公司 A kind of message treatment method, device and server
CN109800096A (en) * 2019-01-08 2019-05-24 深圳市买买提信息科技有限公司 A kind of method and system that message block is retransmitted
CN109918213A (en) * 2019-02-21 2019-06-21 北京奇艺世纪科技有限公司 A kind of message treatment method, device and server
CN110413425A (en) * 2019-07-24 2019-11-05 深圳乐信软件技术有限公司 Third party's message callback method, device, server and storage medium
CN111371892A (en) * 2020-03-05 2020-07-03 中国银行股份有限公司 High-concurrency distributed message pushing system and method
CN112532681A (en) * 2020-10-16 2021-03-19 深圳市科漫达智能管理科技有限公司 Parking lot software data exception handling method and device
CN112948349A (en) * 2020-09-29 2021-06-11 深圳市明源云科技有限公司 Data processing method and device of system cooperation platform
CN113422739A (en) * 2021-06-21 2021-09-21 上海哔哩哔哩科技有限公司 Data transmission method, sending end and data transmission system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102469033A (en) * 2010-11-01 2012-05-23 阿里巴巴集团控股有限公司 Message subscription system and message sending method
CN103209115A (en) * 2013-04-07 2013-07-17 北京京东世纪贸易有限公司 Message sending system
CN103428072A (en) * 2012-05-23 2013-12-04 北京大学 Persistent message publishing method and system
CN103532822A (en) * 2012-07-02 2014-01-22 北京神州泰岳软件股份有限公司 Management method for message delivery, server and system thereof
CN105472042A (en) * 2016-01-15 2016-04-06 中煤电气有限公司 WEB terminal controlled message middleware system and data transmission method thereof
CN105933369A (en) * 2015-12-24 2016-09-07 中国银联股份有限公司 Message forwarding method and device
CN106330766A (en) * 2016-08-16 2017-01-11 中国银联股份有限公司 Message transmitting method and apparatus
CN106850402A (en) * 2017-01-16 2017-06-13 腾讯科技(深圳)有限公司 The transmission method and device of message

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102469033A (en) * 2010-11-01 2012-05-23 阿里巴巴集团控股有限公司 Message subscription system and message sending method
CN103428072A (en) * 2012-05-23 2013-12-04 北京大学 Persistent message publishing method and system
CN103532822A (en) * 2012-07-02 2014-01-22 北京神州泰岳软件股份有限公司 Management method for message delivery, server and system thereof
CN103209115A (en) * 2013-04-07 2013-07-17 北京京东世纪贸易有限公司 Message sending system
CN105933369A (en) * 2015-12-24 2016-09-07 中国银联股份有限公司 Message forwarding method and device
CN105472042A (en) * 2016-01-15 2016-04-06 中煤电气有限公司 WEB terminal controlled message middleware system and data transmission method thereof
CN106330766A (en) * 2016-08-16 2017-01-11 中国银联股份有限公司 Message transmitting method and apparatus
CN106850402A (en) * 2017-01-16 2017-06-13 腾讯科技(深圳)有限公司 The transmission method and device of message

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109120713A (en) * 2018-09-21 2019-01-01 中国建设银行股份有限公司 Message sends the processing method and system, device and storage medium of failure
CN109800096A (en) * 2019-01-08 2019-05-24 深圳市买买提信息科技有限公司 A kind of method and system that message block is retransmitted
CN109783258A (en) * 2019-02-21 2019-05-21 北京奇艺世纪科技有限公司 A kind of message treatment method, device and server
CN109918213A (en) * 2019-02-21 2019-06-21 北京奇艺世纪科技有限公司 A kind of message treatment method, device and server
CN109783258B (en) * 2019-02-21 2021-02-23 北京奇艺世纪科技有限公司 Message processing method and device and server
CN110413425A (en) * 2019-07-24 2019-11-05 深圳乐信软件技术有限公司 Third party's message callback method, device, server and storage medium
CN111371892A (en) * 2020-03-05 2020-07-03 中国银行股份有限公司 High-concurrency distributed message pushing system and method
CN112948349A (en) * 2020-09-29 2021-06-11 深圳市明源云科技有限公司 Data processing method and device of system cooperation platform
CN112532681A (en) * 2020-10-16 2021-03-19 深圳市科漫达智能管理科技有限公司 Parking lot software data exception handling method and device
CN113422739A (en) * 2021-06-21 2021-09-21 上海哔哩哔哩科技有限公司 Data transmission method, sending end and data transmission system

Similar Documents

Publication Publication Date Title
CN108228363A (en) A kind of message method and device
US10785345B2 (en) Information processing method, client, server and computer-readable storage medium
CN106411777A (en) Method and system for processing high concurrent data
CN108268372A (en) Mock test processing methods, device, storage medium and computer equipment
CN104243405B (en) A kind of request processing method, apparatus and system
CN110443695A (en) Data processing method and its device, electronic equipment and medium
CN106603262A (en) Method and system of distribution of customer service modes
CN110310034A (en) A kind of service orchestration applied to SaaS, business flow processing method and apparatus
CN107979525A (en) A kind of red packet distribution method, equipment and medium
CN108197912A (en) A kind of transaction processing system and method
CN106407021A (en) Queue-based business request processing method
JP2019121358A (en) Logistics data transmitting system and method thereof
CN107730314A (en) Information acquisition method, device, electronic equipment and computer-readable recording medium
CN110796545A (en) Batch processing method, equipment and storage medium for blockchain transaction
CN111092814B (en) Service handling request message distribution method and equipment
CN111008800B (en) Data processing method, device, server and storage medium for distribution task
CN109474902A (en) Message message accounting, method, terminal and system
WO2021038945A1 (en) Digital currency exchange device, digital currency exchange method, and digital currency exchange system
CN110071952A (en) The control method and device of service call amount
CN109388482A (en) Dispatching method, device and the storage medium of task
CN105787791B (en) Service request processing method and device
CN105225153A (en) Data processing method and device
CN105205905B (en) The method, apparatus and system that a kind of business hall is called out the numbers
CN107277088B (en) High-concurrency service request processing system and method
CN110516922B (en) Method and device for distributing data processing objects

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20180629

RJ01 Rejection of invention patent application after publication