CN103516580B - A kind of method and system that message sink and forwarding are realized based on message queue - Google Patents

A kind of method and system that message sink and forwarding are realized based on message queue Download PDF

Info

Publication number
CN103516580B
CN103516580B CN201210215896.6A CN201210215896A CN103516580B CN 103516580 B CN103516580 B CN 103516580B CN 201210215896 A CN201210215896 A CN 201210215896A CN 103516580 B CN103516580 B CN 103516580B
Authority
CN
China
Prior art keywords
message
queue
internal memory
message queue
forwarded
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.)
Expired - Fee Related
Application number
CN201210215896.6A
Other languages
Chinese (zh)
Other versions
CN103516580A (en
Inventor
乐以长
芦华楠
黄婷
高超霖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New Founder Holdings Development Co ltd
Peking University
Founder International Beijing Co Ltd
Original Assignee
Peking University
Founder International Beijing Co Ltd
Peking University Founder Group 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 Peking University, Founder International Beijing Co Ltd, Peking University Founder Group Co Ltd filed Critical Peking University
Priority to CN201210215896.6A priority Critical patent/CN103516580B/en
Publication of CN103516580A publication Critical patent/CN103516580A/en
Application granted granted Critical
Publication of CN103516580B publication Critical patent/CN103516580B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a kind of method and system that message sink and forwarding are realized based on message queue, it is related to field of data communication.In the external memory message queue that be saved in message to be forwarded corresponding to message sink end by data exchange server by the method first, then by the internal memory message queue corresponding to message deposit to be forwarded to message sink end, message to be forwarded in internal memory message queue is finally forwarded to the message sink end corresponding to it.After the message to be forwarded in internal memory message queue is forwarded into message sink end, successful message deletion is sent by corresponding in external memory message queue.By method and system of the present invention, data exchange server can asynchronous parallel carry out the reception and forwarding of message, improve the real-time of messaging, cooperated by two message queues, even if data exchange server is in the case of a large amount of receptions, forwarding message, data efficient, reliable transmission are also can guarantee that.

Description

A kind of method and system that message sink and forwarding are realized based on message queue
Technical field
The present invention relates to field of data communication, and in particular to a kind of side that message sink and forwarding are realized based on message queue Method and system.
Background technology
During government or enterprise application system construction and system combination, generally use message-oriented middleware handle is distributed in net The autonomous, information system of isomery is effectively integrated integrated system to network everywhere.Existing message-oriented middleware is generally used with number It is the working mechanism of data switching center according to swap server, message sending end transmits the message to data exchange server, number Forward messages to message sink end again according to swap server, the advantage is that client only needs to be interacted with server, disappear Breath transmitting terminal and message sink end need not be simultaneously online, and message sending end and message sink end need not directly be set up by connecting The transmission of row message.
In the prior art, when message is received, the message to message sink end to be forwarded is resided in data exchange server In internal memory, or message is stored in database or file system.The drawbacks of by message deposit in internal memory is memory source Always limited, data exchange server will be occupied full in a large amount of situations for receiving, forwarding message, message queue, and follow-up disappears Breath cannot be deposited into message queue and is dropped, and cause to transmit the loss of data, and if there is power down, system exception collapse Etc. emergency case, even if the message of write-in message queue can also lose.If message is stored in into database or file system In external storage system, message forwarding needs to be read from External memory equipment, because External memory equipment access speed is slow, meeting The performance bottleneck for causing message to be transmitted.
Application No. 200810239601.2, Publication No. CN101431476, it is entitled " one kind be based on message team The Chinese patent application of the data transmission method of row, server and system ",(Apply for the artificial limited public affairs of Industrial and Commercial Bank of China's share Department), disclose a kind of by receiving message queue and sending the method that message queue carries out message sink, forwarding, in the method Receive message queue and send message queue in internal memory, it is impossible to ensure the reliability of message transmission.
Application No. 200680023379.1, Publication No. CN101208671, entitled " managing message queues " Chinese patent application(Apply for artificial Initio Software Corp. AB), there is provided a kind of side for writing data into multiple queues Method, corresponding software and system, each section of wherein data are written to a corresponding queue.Although the method is by each team Row are synchronized to nonvolatile memory, but the data on nonvolatile memory are the mirror images of data in memory queue, this The ability that mode processes message is decided by memory size.
Application No. 200910092421.0, Publication No. CN102023974A, it is entitled " one kind pass through message team The Chinese patent application of the methods, devices and systems of column processing message "(Applicant China Mobile Communications Corporation), in internal memory In introduce first message queue for receiving message, introducing the second message queue is used to consume message, and message is stored in In database.This mode message sink and treatment two message queues of needs are resided in internal memory, and also rely on database Message is sent to the second message queue by trigger from first queue, and this mode is operated by database trigger, place Reason is complicated;When message is sent into second queue from first queue, it is related to data base read-write to operate, poor-performing..
Message of the other prior art in direct forwarding queue in message forwarding queue, because message forwarding speed is relied on The combination property of the computer at the network bandwidth and operation message sink end, forwarding message generally needs to take some time, and In message forwarding process, it usually needs lockout message forwarding queue, it is impossible to forwarded the need for being stored in newly toward message forwarding queue Message, this can cause system internal resources to block, cause message forwarding performance decline, influence message transmission real-time.Cause This, prior art cannot meet the demand that enterprise application system size of message is big, require data efficient, transmitting.
The content of the invention
For defect present in prior art, message is realized based on message queue it is an object of the invention to provide one kind The method and system with forwarding are received, real-time and the transmission of messaging are improve while message transmission reliability is ensured Performance.
To achieve the above object, the technical solution adopted by the present invention is as follows:
A kind of method that message sink and forwarding are realized based on message queue, is comprised the following steps:
(1)Message sending end sends a message to data exchange server;
(2)After data exchange server receives the message of message sending end, according to the routing configuration information of the message, Determine the message sink end of the message;The message sink end is one or more;
(3)The message to be forwarded that data exchange server will be received is saved in corresponding to each message sink end respectively In external memory message queue;The external memory message queue is stored in external non-volatile storage device;
(4)Internal memory message queue of the data exchange server by the message deposit to be forwarded corresponding to message sink end In;
(5)The message to be forwarded in internal memory message queue is extracted, and the message to be forwarded is transmitted to internal memory message team The corresponding message sink end of row.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, data exchange clothes For it creates internal memory message queue when business device forwards message to certain message sink end first, each message sink end correspondence is unique Internal memory message queue.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step(3)With step Suddenly(4)Between it is further comprising the steps of:
(3-4)Data exchange server judges message sink end with the presence or absence of corresponding internal memory message queue, if then entering Enter step(4)If otherwise data exchange server is to enter step after message sink end creates internal memory message queue(4).
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, is creating internal memory During message queue, the message queue capacity of internal memory message queue is set, the message queue capacity is by message number and message count Determined according to amount.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step(4)In, Before the internal memory message queue that be saved in message to be forwarded corresponding to message sink end by data exchange server, this is first determined whether Whether the internal memory message queue at message sink end is busy, if otherwise directly performing step(4)If, then one in the presence of checking whether Message sink end, if then obtaining next message sink end enters step(3)If otherwise treatment terminates.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, when internal memory message Queue full is enough to lower condition for the moment, determines that internal memory message queue is busy:
The message number actually deposited in a, internal memory message queue reaches the message number that message queue capacity is specified, i.e., really It is busy to determine internal memory message queue;
B, when message queue accounting coefficient reaches given threshold, it is determined that internal memory message queue is busy;The message team Row accounting coefficient refers to the message data volume summation and message queue capacity of all message actually deposited in internal memory message queue The ratio of the data volume specified.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step(5)In, The message to be forwarded in internal memory message queue is extracted, and the message to be forwarded is transmitted to disappearing corresponding to internal memory message queue Cease receiving terminal concrete mode be:
1)By in all message extractions in internal memory message queue to messaging list, and deleted from internal memory message queue The message of extracted mistake;
2)Check whether the messaging list is empty, if otherwise entering step 3)If then checking internal memory message queue Whether the external memory message queue corresponding to message sink end is empty, if then treatment terminates, if otherwise reading external memory message queue In message to be forwarded and in the news release to be forwarded to the internal memory message queue corresponding to message sink end and will return Step 1);
3)The message in messaging list is obtained, acquired message is transmitted to internal memory message by data exchange server one by one Message sink end corresponding to queue.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step(5)In, After message in messaging list is transmitted to message sink end by data exchange server one by one, institute is right in deleting external memory message queue The successful message of forwarding answered.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step(5)In, Internal memory message queue corresponding to message sink end creates message forwarding thread, forwards thread acquired by initiation message Message be transmitted to message sink end.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step(5)In, Only start the message forwarding thread at the message sink end that there is message to be forwarded.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step(4)In, By before message deposit to be forwarded to the corresponding internal memory message queue in message sink end, lockout message is received data exchange server The corresponding internal memory message queue in end, after message deposit to be forwarded to internal memory message queue, data exchange server is released Locking to internal memory message queue.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, the external memory is disappeared Breath queue is used to preserve the message that data exchange server is not yet transmitted to message sink end, and each message sink end correspondence is unique External memory message queue.
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step 2)In, will News release to be forwarded is to the concrete mode in internal memory message queue in external memory message queue:
One not yet reads in external memory message queue corresponding to step 1, data exchange server reading message sink end Message to be forwarded in internal memory message queue;
Step 2, locking page in memory message queue, the message to be forwarded are saved in the internal memory message queue, then Release the locking to internal memory message queue;
Step 3, check in external memory message queue whether also there is the message to be forwarded not yet read in internal memory message queue, If then return to step 1, if otherwise entering step(5).
Further, a kind of method that message sink and forwarding are realized based on message queue as described above, step(5)In, During the message to be forwarded in internal memory message queue to be forwarded to corresponding message sink end, if data exchange takes Business device receives new message, and needs also exist for being transmitted to the message at the message sink end in received new information simultaneously And the corresponding internal memory message queue in the message sink end is idle, and new information is put into the internal memory message queue at the message sink end In.
A kind of system that message sink and forwarding are realized based on message queue, including following device:
Message receiving apparatus:The to be forwarded to message sink of data exchange server is sent to for receiving message sending end The message at end;
Message routing apparatus:The routing configuration information of the message for being received according to data exchange server, it is determined that treating Forward the message sink end of message;The message sink end is one or more;
The outer cryopreservation device of message:Message to be forwarded is saved in for data exchange server outer corresponding to message sink end In depositing message queue;The external memory message queue is stored in external non-volatile storage device;
Message memory device:For data exchange server by corresponding to message deposit to be forwarded to message sink end In depositing message queue;
Message transmission device:For extracting the message to be forwarded in internal memory message queue, and the message to be forwarded is turned Issue the message sink end corresponding to internal memory message queue.
Further, a kind of system that message sink and forwarding are realized based on message queue as described above, in the message Cryopreservation device includes:
Internal memory message queue creation module:For when message sink end does not exist internal memory message queue, data exchange to take Business device is its establishment internal memory message queue;
Internal memory message queue condition judgment module:For judging whether internal memory message queue does, if then treatment terminates, if Otherwise enter external memory message processing module;
External memory message processing module:The news release to be forwarded in external memory message queue is arrived for data exchange server In corresponding internal memory message queue.
Further, a kind of system that message sink and forwarding are realized based on message queue as described above, the message is turned Transmitting apparatus include:
Message extraction module:For by all message extractions to be forwarded in internal memory message queue to messaging list, and from The message of extracted mistake is deleted in internal memory message queue;
Message capturing module:For obtaining a message to be forwarded from messaging list;
Message transmitting module:For setting up message forwarding thread for internal memory message queue, and by initiation message repeated line The message to be forwarded that message capturing module gets is forwarded to journey the message sink end corresponding to internal memory message queue;
Messaging list checks module:For checking with the presence or absence of next message to be forwarded in messaging list, if then entering Enter message capturing module, if otherwise termination messages repeating process.
Further, a kind of system that message sink and forwarding are realized based on message queue as described above, the message is turned Transmitting apparatus also include:
External memory message deletion module:Message transmitting module has been forwarded to message sink in for deleting external memory message queue The message at end.
Effect of the invention is that:A kind of method that message sink and forwarding are realized based on message queue of the present invention And system, be stored on non-volatile memory device by the message for receiving message receiving apparatus, by external memory message queue and Two message queues of internal memory message queue cooperate and realize reception and forwarding of the data exchange server to message, message forwarding Thread by during the message of forwarding in need disposably extracts the messaging list of Dispatch Unit in internal memory message queue, no Must long-time committed memory message queue, do not influence during message is forwarded to be put into new receiving toward internal memory message queue Need the message of forwarding.By method and system of the present invention, data exchange server asynchronous parallel carries out connecing for message Receive and forward, improve the real-time of messaging;In addition for the message sink end for needing to forward without message, data exchange Server is not necessarily it and starts forwarding thread, has saved memory source and cpu resource, improves the transmission of data exchange server Efficiency.
Brief description of the drawings
Fig. 1 is that the present invention is a kind of realizes that message sink is former with the overall work of the method and system of forwarding based on message queue Reason figure;
Fig. 2 is a kind of structured flowchart that message sink and the system of forwarding are realized based on message queue of the present invention;
Fig. 3 is a kind of flow chart that message sink and the method for forwarding are realized based on message queue of the present invention;
Fig. 4 is the workflow diagram of external memory message processing apparatus in implementation method;
Fig. 5 be implementation method in message transmission device realize message forwarding workflow diagram.
Specific embodiment
Core concept of the invention is:Method and system of the present invention, introduce and are stored in external non-volatile and deposit The external memory message queue of storage equipment, and message receiving apparatus and the public internal memory message queue of message transmission device, data are handed over Change server to receive the message of message sending end transmission and message is saved in external memory message queue, then again by the reception Message be stored in the internal memory message queue corresponding to message sink end;Create afterwards and initiation message forwarding thread, startup disappears Breath forwarding thread forwards messages to message sink end;After all message in having forwarded message queue, termination messages forwarding The operation of thread.By using the method for the present invention and system, data exchange server asynchronous parallel carry out message reception and Forwarding, improves the real-time of messaging;Cooperated by two message queues, data exchange server is largely connecing In the case of receipts, forwarding message, also can guarantee that data efficient, reliable transmission.
With reference to Figure of description, the present invention is described in further detail with specific embodiment.
Data exchange server 21 and message exchange client are included by can be seen that system of the invention in Fig. 1(Disappear Breath transmitting terminal 22 and message sink end 23), message sink end can be one or more.
Fig. 2 shows a kind of structured flowchart that message sink and the system of forwarding are realized based on message queue of the present invention, by As can be seen that data exchange server 21 is core of the invention in figure.The system mainly includes message receiving apparatus 211st, message routing apparatus 212, message outer cryopreservation device 213, message memory device 214 and message transmission device 215, wherein,
Message receiving apparatus 211 are used to receive message sending end and be sent to the to be forwarded of data exchange server to be connect to message The message of receiving end;
Message routing apparatus 212 are used for the routing configuration information of the message received according to data exchange server, it is determined that The message sink end of message to be forwarded;The message sink end is one or more;
Be saved in message to be forwarded corresponding to message sink end for data exchange server by the outer cryopreservation device 213 of message In external memory message queue;External memory message queue is stored in external non-volatile storage device;
Be saved in message to be forwarded corresponding to message sink end for data exchange server by message memory device 214 In internal memory message queue;The device is included being used for when message sink end does not exist internal memory message queue, data exchange server The internal memory message queue creation module of internal memory message queue is created for it;For judging whether internal memory message queue does, if then Treatment terminates, if otherwise inwardly depositing message queue is stored in message;And for data exchange server by external memory message queue News release to be forwarded to the external memory message processing module in corresponding internal memory message queue;
Message transmission device 215 is used to extracting message to be forwarded in internal memory message queue, and by the message to be forwarded It is transmitted to the message sink end corresponding to internal memory message queue;The device is included for will be all to be forwarded in internal memory message queue Message extraction deletes the message extraction module of the message of extracted mistake in messaging list from internal memory message queue;With In one message capturing module of message to be forwarded of acquisition from messaging list;For setting up message forwarding for internal memory message queue Thread, and forward thread that the message to be forwarded that message capturing module gets is forwarded into internal memory message queue by initiation message The message transmitting module at corresponding message sink end;For checking with the presence or absence of next message to be forwarded in messaging list, If then inbound message acquisition module, if the messaging list of otherwise termination messages repeating process checks module;And for deleting Message transmitting module has been forwarded to the external memory message deletion module of the message at message sink end in external memory message queue.
Fig. 3 shows that the one kind based on the system for realizing message sink and forwarding in Fig. 2 based on message queue is based on message The flow chart of message sink and the method for forwarding is realized in queue, and the method is mainly included the following steps that:
Step S31:Message sending end sends a message to data exchange server;
Data exchange server 21 is core of the invention, is used to carry out the reception and forwarding of message.Data exchange The message receiving apparatus 211 of server receive the message that message sending end sends.
Step S32:The message sink end of message to be forwarded is determined according to message routing configuration information;
Message routing apparatus 212 extract message route from the message for receiving and match somebody with somebody according to the message received in step S31 Confidence ceases, and determines the message sink end of message to be forwarded.The message sink end determined according to message routing configuration information is one Or it is multiple.
Step S33:In the external memory message queue that message to be forwarded is saved in corresponding to message sink end;Data exchange takes In the external memory message queue that be saved in message to be forwarded corresponding to message sink end by business device;The external memory message queue is stored in In external non-volatile storage device.Non-volatile memory device refers to the data energy when no power supply is supplied to storage device The equipment being enough saved.Store data in and cause in non-volatile memory device in artificial shutdown, system crash or power supply Data can be recovered in the event of failure.Such as hard disk, USB flash disk, floppy disk, storage card are non-volatile memory device.External memory disappears Breath queue can use file system or Database Systems, i.e., message is present in operating system file or in database.
Method of the present invention be carry out message sink to solve data exchange server in the prior art, at forwarding During reason, by message to be forwarded reside in internal memory and cause information drop-out and directly forwarded in message queue and The problem that the message transmission performance for causing declines, and the method that message sink and forwarding are realized based on message queue for proposing, should Method introduces the external memory message queue being stored in external non-volatile storage device, is disappeared by external memory message queue and internal memory Reception and forwarding of the data exchange server to message are realized in the collaborative work for ceasing two message queues of queue.Wherein, each disappears The breath receiving terminal unique external memory message queue of correspondence, is stored in external non-volatile storage device, is not yet forwarded for preserving To the message to be forwarded at message sink end.
Step S34:By in the internal memory message queue corresponding to message deposit to be forwarded to message sink end;
In the internal memory message queue that be saved in message to be forwarded corresponding to message sink end by data exchange server.To To before internal memory message queue, data exchange server whether there is firstly the need of judging message sink end message deposit to be forwarded Corresponding internal memory message queue, if there is step S34 is then directly carried out, if it does not, data exchange server is message Receiving terminal enters step S34 after creating corresponding internal memory message queue.Therefore, data exchange server is first to certain message It is its establishment internal memory message queue, each message sink end correspondence unique internal memory message queue during receiving terminal forwarding message. , it is necessary to set the message queue capacity of internal memory message queue, the message queue capacity is by message during establishment internal memory message queue Number and message data volume are determined.Message to be forwarded is saved in the internal memory corresponding to message sink end in data exchange server During message queue, in addition it is also necessary to which whether the internal memory message queue for judging the message sink end is busy, if otherwise directly disappearing to be forwarded Breath is saved in the internal memory message queue corresponding to message sink end;If the internal memory message queue at a certain message sink end is busy, A message sink end in the presence of then checking whether, if then obtaining next message sink end return to step S33, if in the absence of next Then treatment terminates at message sink end.Wherein, when internal memory message queue meets following condition for the moment, determine that internal memory message queue is It is busy:
The message number actually deposited in a, internal memory message queue reaches the message number that message queue capacity is specified, i.e., really It is busy to determine internal memory message queue;
B, when message queue accounting coefficient reaches given threshold, it is determined that internal memory message queue is busy;The message team Row accounting coefficient refers to the message data volume summation and message queue capacity of all message actually deposited in internal memory message queue The ratio of the data volume specified.
When message to be forwarded is forwarded to the corresponding internal memory message queue in message sink end by data exchange server, lock first Determine the internal memory message queue corresponding to message sink end, the corresponding message to be forwarded in the message sink end is then deposited into internal memory In message queue, data exchange server releases the locking to internal memory message queue after the completion of being stored in.By external memory message queue In news release to be forwarded to internal memory message queue flow chart as shown in figure 4, concrete mode is:
One not yet reads in external memory message queue corresponding to step 1, data exchange server reading message sink end Message to be forwarded in internal memory message queue;
Step 2, locking page in memory message queue, the message to be forwarded are saved in the internal memory message queue, then Release the locking to internal memory message queue;
Step 3, check in external memory message queue whether also there is the message to be forwarded not yet read in internal memory message queue, If then return to step 1, if otherwise entering step S35.
Step S35:Message to be forwarded in internal memory message queue is transmitted to corresponding message sink end.
Message to be forwarded in extraction step S34 in internal memory message queue, and to be forwarded in internal memory message queue is disappeared Breath is transmitted to corresponding message sink end.The detail flowchart of forwarding is as shown in figure 5, the concrete mode of forwarding is:
1)By in all message extractions in internal memory message queue to messaging list, and deleted from internal memory message queue The message of extracted mistake;
2)Check whether the messaging list is empty, if otherwise entering next step, if then checking that corresponding external memory disappears Whether breath queue is empty, if then treatment terminates, if otherwise reading outer corresponding to the message sink end of the internal memory message queue Deposit the message to be forwarded in message queue and the internal memory message team by the news release to be forwarded corresponding to message sink end In row;
3)The message in messaging list is obtained, acquired message is transmitted to internal memory message by data exchange server one by one Message sink end corresponding to queue.
After the message to be forwarded in messaging list is transmitted to message sink end by data exchange server one by one, delete outer Deposit the corresponding successful message of forwarding in message queue.It is the internal memory corresponding to message sink end when message is forwarded Message queue creates message forwarding thread, forwards thread that acquired message is transmitted into message sink end by initiation message. During transmission, only start the message sink end that there is corresponding message to be forwarded, for the message sink that forwarding is needed without message End, data exchange server is not necessarily its initiation message forwarding thread, memory source and cpu resource has been saved, so as to improve The efficiency of transmission of data exchange server.Message to be forwarded in internal memory message queue is being forwarded to corresponding message sink During end, if data exchange server receives new message, and needed also exist in received new information The corresponding internal memory message queue of message and the message sink end for being transmitted to the message sink end is idle, new information is put into interior Deposit in message queue, being achieved in message receiving apparatus and message transmission device asynchronous parallel carries out the reception and forwarding of message, Improve the real-time and forward efficiency of messaging.
The method of the present invention and system, data exchange server receive the message that message sending end sends and by the message It is stored in external non-volatile storage device, the message of the reception is then stored in the corresponding internal memory message in message sink end In queue;Internal memory message queue is created and starts the message transmitting module at the message sink end, and message transmitting module is from message Queue is extracted message and forwards messages to message sink end;After all message in having forwarded message queue, termination messages The operation of forwarding module.By using the method for the present invention, data exchange server asynchronous parallel carries out the reception of message and turns Hair, improves the real-time of messaging;Cooperated by two message queues, even if data exchange server is largely connecing In the case of receipts, forwarding message, also can guarantee that data efficient, reliable transmission.
Obviously, those skilled in the art can carry out various changes and modification without deviating from essence of the invention to the present invention God and scope.So, if these modifications of the invention and modification belong to the scope of the claims in the present invention and its equivalent technology Within, then the present invention is also intended to comprising these changes and modification.

Claims (16)

1. a kind of method that message sink and forwarding are realized based on message queue, is comprised the following steps:
(1) message sending end sends a message to data exchange server;
(2) after data exchange server receives the message of message sending end, according to the routing configuration information of message, it is determined that described The message sink end of message;The message sink end is one or more;
(3) message to be forwarded that data exchange server will be received is saved in the external memory corresponding to each message sink end respectively In message queue;The external memory message queue is stored in external non-volatile storage device;
(4) data exchange server is by the message deposit to be forwarded to the internal memory message queue corresponding to message sink end;
(5) message to be forwarded in internal memory message queue is extracted, and the message to be forwarded is transmitted to internal memory message queue institute Corresponding message sink end;The specific side at the message sink end message to be forwarded being transmitted to corresponding to internal memory message queue Formula is:
1) by all message extractions in internal memory message queue to messaging list, and deleted from internal memory message queue and carried The message for taking;
2) check whether the messaging list is empty, if otherwise entering step 3), if then checking disappearing for the internal memory message queue Whether the external memory message queue corresponding to breath receiving terminal is empty, if then treatment terminates, if in otherwise reading external memory message queue Message to be forwarded and the message to be forwarded is saved in the internal memory message queue corresponding to the message sink end and returned Step 1);
3) message in messaging list is obtained, acquired message is transmitted to internal memory message queue by data exchange server one by one Corresponding message sink end.
It is 2. a kind of as claimed in claim 1 that method of the message sink with forwarding is realized based on message queue, it is characterised in that:Number It is its establishment internal memory message queue, each message sink end when forwarding message to certain message sink end first according to swap server The unique internal memory message queue of correspondence.
3. a kind of as claimed in claim 1 or 2 to realize method of the message sink with forwarding based on message queue, its feature exists In:It is further comprising the steps of between step (3) and step (4):
(3-4) data exchange server judges message sink end with the presence or absence of corresponding internal memory message queue, if then entering step Suddenly (4), if otherwise data exchange server is to enter step (4) after message sink end creates internal memory message queue.
It is 4. a kind of as claimed in claim 3 that method of the message sink with forwarding is realized based on message queue, it is characterised in that: When creating internal memory message queue, the message queue capacity of internal memory message queue is set, the message queue capacity is by message number Determined with message data volume.
It is 5. a kind of as claimed in claim 4 that method of the message sink with forwarding is realized based on message queue, it is characterised in that:Step Suddenly in (4), before the internal memory message queue that be saved in message to be forwarded corresponding to message sink end by data exchange server, first Whether the internal memory message queue for judging the message sink end is busy, if otherwise directly performing step (4), if then checking whether to deposit At next message sink end, if then obtaining next message sink end into step (3), if otherwise treatment terminates.
It is 6. a kind of as claimed in claim 5 that method of the message sink with forwarding is realized based on message queue, it is characterised in that:When Internal memory message queue meets following condition for the moment, determines that internal memory message queue is busy:
The message number actually deposited in a, internal memory message queue reaches the message number that message queue capacity is specified, that is, determine interior It is busy to deposit message queue;
B, when message queue accounting coefficient reaches given threshold, it is determined that internal memory message queue is busy;The message queue is accounted for Specified with message queue capacity than the message data volume summation that coefficient refers to all message actually deposited in internal memory message queue Data volume ratio.
It is 7. a kind of as claimed in claim 1 that method of the message sink with forwarding is realized based on message queue, it is characterised in that:Step Suddenly in (5), after the message in messaging list is transmitted to message sink end by data exchange server one by one, external memory message team is deleted The successful message of forwarding corresponding in row.
It is 8. a kind of as claimed in claim 1 that method of the message sink with forwarding is realized based on message queue, it is characterised in that:Step Suddenly it is that the internal memory message queue corresponding to message sink end creates message forwarding thread in (5), thread is forwarded by initiation message Acquired message is transmitted to message sink end.
It is 9. a kind of as claimed in claim 8 that method of the message sink with forwarding is realized based on message queue, it is characterised in that:Step Suddenly in (5), the message forwarding thread at the message sink end that there is message to be forwarded is only started.
It is 10. a kind of as claimed in claim 5 that method of the message sink with forwarding is realized based on message queue, it is characterised in that: In step (4), data exchange server is locked before message deposit to be forwarded to the corresponding internal memory message queue in message sink end Determine the internal memory message queue corresponding to message sink end, after message deposit to be forwarded to internal memory message queue, data exchange Server releases the locking to internal memory message queue.
A kind of 11. methods that message sink and forwarding are realized based on message queue as claimed in claim 1, it is characterised in that: The external memory message queue is used to preserve the message that data exchange server is not yet transmitted to message sink end, each message sink The end unique external memory message queue of correspondence.
A kind of 12. methods that message sink and forwarding are realized based on message queue as claimed in claim 1, it is characterised in that: Step 2) in, it is by the concrete mode that message to be forwarded in external memory message queue is saved in internal memory message queue:
One not yet reads in internal memory in external memory message queue corresponding to step 1, data exchange server reading message sink end Message to be forwarded in message queue;
Step 2, locking page in memory message queue, the message to be forwarded is saved in the internal memory message queue, is then released Locking to internal memory message queue;
Step 3, check in external memory message queue whether also there is the message to be forwarded not yet read in internal memory message queue, if Then return to step 1, if otherwise entering step (5).
A kind of 13. methods that message sink and forwarding are realized based on message queue as claimed in claim 8, it is characterised in that: In step (5), during the message to be forwarded in internal memory message queue to be forwarded to corresponding message sink end, if Data exchange server receives new message, and needs also exist for being transmitted to the message sink in received new information Internal memory message queue corresponding to the message at end and the message sink end is idle, and new information is put into the message sink end In internal memory message queue.
A kind of 14. systems that message sink and forwarding are realized based on message queue, including following device:
Message receiving apparatus:The to be forwarded to message sink end of data exchange server is sent to for receiving message sending end Message;
Message routing apparatus:The routing configuration information of the message for being received according to data exchange server, determines to be forwarded disappearing The message sink end of breath;The message sink end is one or more;
The outer cryopreservation device of message:The external memory that message to be forwarded is saved in corresponding to message sink end is disappeared for data exchange server In breath queue;The external memory message queue is stored in external non-volatile storage device;
Message memory device:The internal memory that message to be forwarded is saved in corresponding to message sink end is disappeared for data exchange server In breath queue;
Message transmission device:For extracting the message to be forwarded in internal memory message queue, and the message to be forwarded is transmitted to Message sink end corresponding to internal memory message queue;The message transmission device includes:
Message extraction module:For by all message extractions to be forwarded in internal memory message queue to messaging list, and from internal memory The message of extracted mistake is deleted in message queue;
Message capturing module:For obtaining a message to be forwarded from messaging list;
Message transmitting module:For setting up message forwarding thread for internal memory message queue, and will by initiation message forwarding thread The message to be forwarded that message capturing module gets is forwarded to the message sink end corresponding to internal memory message queue;
Messaging list checks module:For checking with the presence or absence of next message to be forwarded in messaging list, if then enter disappearing Breath acquisition module, if otherwise termination messages repeating process.
A kind of 15. systems that message sink and forwarding are realized based on message queue as claimed in claim 14, it is characterised in that The message memory device includes:
Internal memory message queue creation module:For when message sink end do not exist internal memory message queue when, data exchange server For it creates internal memory message queue;
Internal memory message queue condition judgment module:For judging whether internal memory message queue does, if then treatment terminates, if otherwise Into external memory message processing module;
External memory message processing module:It is for data exchange server that the news release to be forwarded in external memory message queue is right to institute In the internal memory message queue answered.
A kind of 16. systems that message sink and forwarding are realized based on message queue as claimed in claim 14, it is characterised in that The message transmission device also includes:
External memory message deletion module:Message transmitting module has been forwarded to message sink end in for deleting external memory message queue Message.
CN201210215896.6A 2012-06-26 2012-06-26 A kind of method and system that message sink and forwarding are realized based on message queue Expired - Fee Related CN103516580B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210215896.6A CN103516580B (en) 2012-06-26 2012-06-26 A kind of method and system that message sink and forwarding are realized based on message queue

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210215896.6A CN103516580B (en) 2012-06-26 2012-06-26 A kind of method and system that message sink and forwarding are realized based on message queue

Publications (2)

Publication Number Publication Date
CN103516580A CN103516580A (en) 2014-01-15
CN103516580B true CN103516580B (en) 2017-06-23

Family

ID=49898652

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210215896.6A Expired - Fee Related CN103516580B (en) 2012-06-26 2012-06-26 A kind of method and system that message sink and forwarding are realized based on message queue

Country Status (1)

Country Link
CN (1) CN103516580B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105141687B (en) * 2015-08-19 2018-05-04 焦点科技股份有限公司 A kind of method for producing message
CN105068769A (en) * 2015-08-28 2015-11-18 浪潮软件股份有限公司 Message middleware based message management method and apparatus
CN105516265A (en) * 2015-11-27 2016-04-20 山东中创软件商用中间件股份有限公司 Short message transmission method and apparatus
CN106953884A (en) * 2016-01-07 2017-07-14 中移(杭州)信息技术有限公司 Middleware message treatment method, device and middleware platform
CN107231313A (en) * 2016-03-25 2017-10-03 北京京东尚科信息技术有限公司 Method of data synchronization and system based on message routing mode
CN106330766A (en) * 2016-08-16 2017-01-11 中国银联股份有限公司 Message transmitting method and apparatus
CN106850402B (en) * 2017-01-16 2020-11-03 腾讯科技(深圳)有限公司 Message transmission method and device
CN106844682B (en) * 2017-01-25 2019-08-16 北京百分点信息科技有限公司 Method for interchanging data, apparatus and system
CN106897161A (en) * 2017-02-23 2017-06-27 郑州云海信息技术有限公司 A kind of data guard method and device
CN107197015B (en) * 2017-05-23 2020-09-08 阿里巴巴集团控股有限公司 Message processing method and device based on message queue system
CN108712332B (en) 2018-05-17 2020-07-07 华为技术有限公司 Communication method, system and device
CN109194678B (en) * 2018-09-25 2021-01-15 吉林省联宇合达科技有限公司 Distributed streaming media service system based on redis message queue

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101189584A (en) * 2005-06-27 2008-05-28 起元软件有限公司 Managing memory pages
CN101459627A (en) * 2008-04-07 2009-06-17 中兴通讯股份有限公司 Message management method
CN101594299A (en) * 2009-05-20 2009-12-02 清华大学 Based on formation amortization management method in the switching network of chained list
CN103428072A (en) * 2012-05-23 2013-12-04 北京大学 Persistent message publishing method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101189584A (en) * 2005-06-27 2008-05-28 起元软件有限公司 Managing memory pages
CN101459627A (en) * 2008-04-07 2009-06-17 中兴通讯股份有限公司 Message management method
CN101594299A (en) * 2009-05-20 2009-12-02 清华大学 Based on formation amortization management method in the switching network of chained list
CN103428072A (en) * 2012-05-23 2013-12-04 北京大学 Persistent message publishing method and system

Also Published As

Publication number Publication date
CN103516580A (en) 2014-01-15

Similar Documents

Publication Publication Date Title
CN103516580B (en) A kind of method and system that message sink and forwarding are realized based on message queue
CN101877604B (en) Method and system for transmitting files
CN103428072B (en) A kind of dissemination method of persistent message and system
CN103532822B (en) The management method of message dilivery, server and system
CN103442395B (en) A kind of Big Dipper data Transmission system based on connection pool and method thereof
CN101163117B (en) Packet management method, packet resource sharing method and instant communication equipment
CN103747091A (en) Distributed data synchronization system and method for embedded equipment
CN101667976B (en) Method for determining mail push mode, pushing method, pushing device
CN104023321A (en) Safe and reliable information transmission system based on mobile network
CN101087294B (en) A method for disabling and enabling members in chat room to speak
CN100508500C (en) Interplate communicating method and interface plate
CN104618152B (en) A kind of conversational list aging method and system
CN108874555A (en) A kind of method and device for writing message to message-oriented middleware
CN104901865A (en) Mobile-end instant messaging (IM) signal synchronization method based on global monotonic serial number
CN101867619A (en) File group sending method and system thereof
US10268532B2 (en) Application message processing system, method, and application device
CN103220343A (en) Big data multi-system forwarding method
CN105471718B (en) A kind of implementation method of full duplex message queue
CN111274047A (en) Information processing method, terminal, system, computer device and storage medium
CN106027419A (en) Data structure management method and device
US11843841B2 (en) Information interaction method and apparatus, and storage medium
CN101001213A (en) Short message transmission system and method
CN115766610A (en) Message queue based on publish-subscribe
CN103731501A (en) Mobile-terminal-based multi-people cooperative management method and system for backlogs
CN105245471A (en) Message sending method and message sending device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230609

Address after: 100871 No. 5, the Summer Palace Road, Beijing, Haidian District

Patentee after: Peking University

Patentee after: New founder holdings development Co.,Ltd.

Patentee after: Founder International Co.,Ltd. (Beijing)

Address before: 100871 No. 5, the Summer Palace Road, Beijing, Haidian District

Patentee before: Peking University

Patentee before: PEKING UNIVERSITY FOUNDER GROUP Co.,Ltd.

Patentee before: Founder International Co.,Ltd. (Beijing)

TR01 Transfer of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170623