CN110287046A - Business service message method and system based on queue - Google Patents

Business service message method and system based on queue Download PDF

Info

Publication number
CN110287046A
CN110287046A CN201910594528.9A CN201910594528A CN110287046A CN 110287046 A CN110287046 A CN 110287046A CN 201910594528 A CN201910594528 A CN 201910594528A CN 110287046 A CN110287046 A CN 110287046A
Authority
CN
China
Prior art keywords
message
business service
queue
business
recipient
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
CN201910594528.9A
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.)
Inspur Cloud Information Technology Co Ltd
Original Assignee
Inspur Cloud Information Technology 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 Inspur Cloud Information Technology Co Ltd filed Critical Inspur Cloud Information Technology Co Ltd
Priority to CN201910594528.9A priority Critical patent/CN110287046A/en
Publication of CN110287046A publication Critical patent/CN110287046A/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
    • 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/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

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

Abstract

The invention discloses a kind of business service message method and system based on queue, belong to business service message and sends field, technical problems to be solved are how to avoid the message between business service missing on the way, are avoided because of the inconsistent situation of service caused by network failure and host node failure.Method includes: that message to be sent is put into corresponding message transmit queue;Judge whether message transmit queue is empty by timed task, if not, message in message transmit queue is sent to business service recipient, received message is stored in database by business service recipient;After message is sent to business service recipient, query messages are sent to business service recipient by timed task;According to query result, the message sent is removed from message transmit queue by timed task.System includes business service end management module and message queue management module.

Description

Business service message method and system based on queue
Technical field
The present invention relates to business service message to send field, specifically a kind of business service message hair based on queue Delivery method and system.
Background technique
In the epoch that this current information is packed, software application become greatly, using data communication complexity, data Storage complexity and data computation complexity all show geometric growth.Traditional centralized software application system by Step exits the stage of software systems, and is captured comprehensively by distributed software application system.
Distributed structure/architecture system is as shown in Figure 1, its advantage is as follows:
1, improving performance and concurrent, operation is distributed to different fragments, independently of each other
2, the availability of lifting system, even if part fragment cannot be used, other fragments are unaffected
3, system can expand to have obtained very big malleability, and system performance is reliable
Disadvantage is as follows:
1, the machine and network of isomery, the machine configuration in distributed system is different, and the service run thereon may also It is realized by different language, framework, therefore processing capacity is also different, by being connected to the network between node, and different network operations The bandwidth for the network that quotient provides, delay, packet loss are again different;
Although 2, the probability of malfunction of individual node is lower, interstitial content reaches certain scale, and out of order probability just becomes Gao Liao, when distributed system needs to guarantee that failure occurs, system is still available, this just needs to monitor the shape of node The responsible calculating of the node, store tasks are transferred to other nodes in the case where node failure by state;
3, be to be communicated by network, and network is insecure between node, it is understood that there may be network problem include: Network segmentation, delay, packet loss, random ordering etc., all can cause the operation between each business service inconsistent, it may occur however that server The case where providing but not charged.
To sum up, in entire distributed system architecture, when service, is most important, is also most complicated a part.And it is entire Service is general to split into many business Service again, is communicated between them by various message-oriented middlewares.But due to dividing The shortcomings that cloth framework itself, insecure network will cause the missing of related communication message;And installation message middleware, Need to increase host node, node, which sends failure, can also occur the missing of message.If service business and receipts in a system Expense business is separated, if that user has obtained service, and related collection of charges message, it is being sent to charge operation During server, lack.
How to avoid the message between business service missing on the way, avoids because caused by network failure and host node failure Inconsistent situation is serviced, is the technical issues that need to address.
Summary of the invention
Technical assignment of the invention is against the above deficiency, to provide a kind of business service message method based on queue And system avoids to solve how to avoid the message between business service missing on the way because of network failure and host node failure The problem of caused service inconsistent situation.
In a first aspect, the present invention provides a kind of business service message method based on queue, for realizing distribution The transmission of business service in system, comprising:
Message to be sent is put into corresponding message transmit queue by business service sender;
Judge whether message transmit queue is sky by timed task, if not, message in message transmit queue is sent To business service recipient, business service recipient by received message be stored in database, if message queue be sky, stop to Business service recipient sends message;
After message is sent to business service recipient, inquiry is sent to business service recipient by timed task and is disappeared Breath, business service recipient respond query messages and return to query result;
According to query result, the message sent is removed from message transmit queue by timed task.
Preferably, being each equipped with message data table in each business service, message data table is for storing message mark Will, when message flag includes message flag ID, message body information, business service sender, business service recipient and sends Between.
Preferably, being each equipped with REST interface in each business service, REST interface is corresponding with REST interface calling Address, REST interface address and REST interface polls address;
When business service sender sends message, the REST interface address of business service recipient is called, by message When message is sent to business service recipient in transmit queue;
After business service sender sends message, the REST interface of business service recipient is called to look by message flag ID Address is ask, sender sends query messages and obtains query result.
Preferably, REST interface is only corresponding with REST interface call address when transmitting message between single business service With REST interface polls address;
When transmitting message between multiple business services, by each business service corresponding REST interface address and REST Interface polls address is configured in file, by the corresponding REST interface call address of business service recipient and REST interface tune It is put into message body information with address, the timed task that message is sent is passed in a manner of variable.
Preferably, being inquired from database after business service recipient receives query messages according to message flag ID Message, and query result is returned into message transmit queue.
More preferably, health examination interface is each equipped in each business service;
Whether business service sender can be used by the related service of health examination interface polls.
Second aspect, the present invention provide a kind of business service message transmission system based on queue, comprising:
Business service end management module, business service sender by business service end management module by message to be sent It is put into corresponding message transmit queue, received message is stored in number by business service end management module by business service recipient According to library;
Message queue management module, the message queue management are the module with following function:
For judging whether message transmit queue is sky by timed task, if not, by message in message transmit queue It is sent to business service recipient, if message queue is sky, stops sending message to business service recipient;
For being sent and being inquired to business service recipient by timed task after message is sent to business service recipient Message, and query result is returned by business service recipient response query messages, to message transmit queue;
For the message sent being removed from message transmit queue by timed task according to query result.
Preferably, business service end management module is used to configure message data table, message data for each business service For table for storing message flag, message flag includes message flag ID, message body information, business service sender, business service Recipient and sending time.
Preferably, business service end management module is used to configure REST interface, REST interface pair for each business service Should there are REST interface call address, REST interface address and REST interface polls address;
When business service sender sends message, the REST interface address of business service recipient is called, by message When message is sent to business service recipient in transmit queue;
After business service sender sends message, the REST interface of business service recipient is called to look by message flag ID Address is ask, sender sends query messages and obtains query result.
More preferably, business service end management module is used for be each equipped with health examination interface in each business service;Industry Whether business service sender can be used by the related service of health examination interface polls.
Of the invention business service message method and system based on queue have the advantage that using database, Queue and timed task cycle through message, and whether confirmation message receives, so as to be avoided well because of network failure It sends and lacks with host node failure bring message, and the midway that sends of very good solution message is missing problem, avoids The loss of the inconsistent band of message between each business service, and message sink is avoided to fail.
Detailed description of the invention
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to required in being described in embodiment The attached drawing used is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those skilled in the art, without creative efforts, it can also be obtained according to these attached drawings His attached drawing.
The following further describes the present invention with reference to the drawings.
Attached drawing 1 is the structural block diagram of distributed structure/architecture system;
Attached drawing 2 is the flow diagram of business service message method of the embodiment 1 based on queue;
Specific embodiment
The present invention will be further explained below with reference to the attached drawings and specific examples, so that those skilled in the art can be with It more fully understands the present invention and can be practiced, but illustrated embodiment is not as a limitation of the invention, the case where not conflicting Under, the technical characteristic in the embodiment of the present invention and embodiment can be combined with each other.
The embodiment of the present invention provides business service message method and system based on queue, how to avoid for solving Message between business service is missing on the way, avoids because of the inconsistent situation of service caused by network failure and host node failure Technical problem.
Embodiment 1:
Business service message method based on queue of the invention, for realizing business service in distributed system It sends, includes the following steps:
Message to be sent is put into corresponding message transmit queue by S100, business service sender;
S200, timing judge whether message transmit queue is sky, if not, message in message transmit queue is sent to industry Received message is stored in database, if message queue is sky, stopped to business by business service recipient, business service recipient It services recipient and sends message;
After message is sent to business service recipient, query messages are sent to business service recipient, business service connects Debit responds query messages and returns to query result;
S300, according to query result, periodically the message sent is removed from message transmit queue, and execute step S200。
Wherein, message data table is each equipped in each business service, message data table disappears for storing message flag Breath mark includes message flag ID, message body information, business service sender, business service recipient and sending time.
REST interface is each equipped in each business service, REST interface is corresponding with REST interface call address, REST Interface address and REST interface polls address.When business service sender sends message, call business service recipient's Message in message transmit queue is sent to business service recipient by REST interface address;Business service sender sends After message, by message flag ID call business service recipient REST interface polls address, sender send query messages, And query result is obtained, to send one end of message, according to the quick search such as message flag ID recipient either with or without receiving phase Close message.
When transmitting message between single business service, REST interface is only corresponding with REST interface call address and REST interface Inquire address;
When transmitting message between multiple business services, by each business service corresponding REST interface address and REST Interface polls address is configured in file, by the corresponding REST interface call address of business service recipient and REST interface tune It is put into message body information with address, the timed task that message is sent is passed in a manner of variable.
In step S200, after business service recipient receives query messages, looked into from database according to message flag ID Message is ask, and query result is returned into message transmit queue.
Health examination interface is each equipped in each business service;Business service sender is looked by health examination interface Ask whether related service can be used.
The process of business service message method based on the application based on queue is for example as shown in Fig. 2, business service A As sender, as recipient, sender only needs to write a timed task and goes to cycle through message and look into business service B It askes and whether receives message;When sending message later, it is only necessary to which the message of transmission is put into queue.
Embodiment 2:
A kind of business service message transmission system based on queue of the invention, including business service end management module and disappear Cease queue management module.
Business service end management module is the module with following function:
Business service sender by business service end management module by message to be sent be put into corresponding message and send Queue;
Received message is stored in database by business service end management module by business service recipient;
For configuring message data table for each business service, message data table is for storing message flag, message flag Including message flag ID, message body information, business service sender, business service recipient and sending time;
For to be each equipped with health examination interface in each business service, business service sender to be connect by health examination Whether mouth inquiry related service can be used;
For configuring REST interface for each business service, REST interface is corresponding with REST interface call address, REST connects Mouth receives address and REST interface polls address.
Wherein, when business service sender sends message, the REST interface address of business service recipient is called, it will When message is sent to business service recipient in message transmit queue;After business service sender sends message, pass through message mark Will ID calls the REST interface polls address of business service recipient, and sender sends query messages and obtains query result.
In the specific implementation, when transmitting message between single business service, REST interface is only corresponding with REST interface calling Address and REST interface polls address;When transmitting message between multiple business services, the corresponding REST of each business service is connect Mouth receives address and REST interface polls address is configured in file, and the corresponding REST interface of business service recipient is called Address and REST interface call address are put into message body information, and the timed task that message is sent is passed in a manner of variable.
Message queue management module is the module with following function:
For judging whether message transmit queue is sky by timed task, if not, by message in message transmit queue It is sent to business service recipient, if message queue is sky, stops sending message to business service recipient;
For being sent and being inquired to business service recipient by timed task after message is sent to business service recipient Message, and query result is returned by business service recipient response query messages, to message transmit queue;
For the message sent being removed from message transmit queue by timed task according to query result.
Business service end management module is used to configure message data table for each business service, and message data table is for storing Message flag, message flag include message flag ID, message body information, business service sender, business service recipient and Sending time.
Business service end management module is used to be each equipped with information query interface in each business service;
After business service sender sends message, information query interface is called to send to business service by message flag ID Side sends query messages and obtains query result.
The industry based on queue disclosed in embodiment 1 can be performed in business service message transmission system based on queue of the invention Business service message sending method.
Embodiment described above is only to absolutely prove preferred embodiment that is of the invention and being lifted, protection model of the invention It encloses without being limited thereto.Those skilled in the art's made equivalent substitute or transformation on the basis of the present invention, in the present invention Protection scope within.Protection scope of the present invention is subject to claims.

Claims (10)

1. the business service message method based on queue, it is characterised in that for realizing business service in distributed system It sends, comprising:
Message to be sent is put into corresponding message transmit queue by business service sender;
Judge whether message transmit queue is sky by timed task, if not, message in message transmit queue is sent to industry Received message is stored in database, if message queue is sky, stopped to business by business service recipient, business service recipient It services recipient and sends message;
After message is sent to business service recipient, query messages, industry are sent to business service recipient by timed task Business service recipient responds query messages and returns to query result;
According to query result, the message sent is removed from message transmit queue by timed task.
2. the business service message method according to claim 1 based on queue, it is characterised in that in each business Message data table is each equipped in service, for storing message flag, message flag includes message flag ID, disappears message data table Cease body information, business service sender, business service recipient and sending time.
3. the business service message method according to claim 2 based on queue, it is characterised in that in each business REST interface is each equipped in service, REST interface is corresponding with REST interface call address, REST interface address and REST Interface polls address;
When business service sender sends message, the REST interface address of business service recipient is called, message is sent When message is sent to business service recipient in queue;
After business service sender sends message, with calling the REST interface polls of business service recipient by message flag ID Location, sender send query messages and obtain query result.
4. the business service message method according to claim 3 based on queue, it is characterised in that single business clothes When transmitting message between business, REST interface is only corresponding with REST interface call address and REST interface polls address;
When transmitting message between multiple business services, by each business service corresponding REST interface address and REST interface Inquiry address is configured in file, calls ground for the corresponding REST interface call address of business service recipient and REST interface Location is put into message body information, and the timed task that message is sent is passed in a manner of variable.
5. the business service message method according to claim 2 based on queue, it is characterised in that business service connects After debit receives query messages, according to message flag ID from database query messages, and by query result return message hair Send queue.
6. according to claim 1, the business service message method described in 2,3,4 or 5 based on queue, it is characterised in that Health examination interface is each equipped in each business service;
Whether business service sender can be used by the related service of health examination interface polls.
7. the business service message transmission system based on queue, characterized by comprising:
Business service end management module, business service sender by business service end management module by message to be sent be put into Received message is stored in data by business service end management module by corresponding message transmit queue, business service recipient Library;
Message queue management module, the message queue management are the module with following function:
For judging whether message transmit queue is sky by timed task, if not, message in message transmit queue is sent Stop sending message to business service recipient to business service recipient if message queue is sky;
For sending inquiry to business service recipient by timed task and disappearing after message is sent to business service recipient Breath, and query result is returned by business service recipient response query messages, to message transmit queue;
For the message sent being removed from message transmit queue by timed task according to query result.
8. the business service message transmission system according to claim 7 based on queue, it is characterised in that business service end Management module is used to configure message data table for each business service, and message data table is for storing message flag, message flag Including message flag ID, message body information, business service sender, business service recipient and sending time.
9. the business service message transmission system according to claim 8 based on queue, it is characterised in that business service end Management module is used to configure REST interface for each business service, and REST interface is corresponding with REST interface call address, REST connects Mouth receives address and REST interface polls address;
When business service sender sends message, the REST interface address of business service recipient is called, message is sent When message is sent to business service recipient in queue;
After business service sender sends message, with calling the REST interface polls of business service recipient by message flag ID Location, sender send query messages and obtain query result.
10. the business service message transmission system according to claim 6,7,8 or 9 based on queue, it is characterised in that industry Business server-side management module is used to be each equipped with health examination interface in each business service;
Whether business service sender can be used by the related service of health examination interface polls.
CN201910594528.9A 2019-07-03 2019-07-03 Business service message method and system based on queue Pending CN110287046A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910594528.9A CN110287046A (en) 2019-07-03 2019-07-03 Business service message method and system based on queue

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910594528.9A CN110287046A (en) 2019-07-03 2019-07-03 Business service message method and system based on queue

Publications (1)

Publication Number Publication Date
CN110287046A true CN110287046A (en) 2019-09-27

Family

ID=68020430

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910594528.9A Pending CN110287046A (en) 2019-07-03 2019-07-03 Business service message method and system based on queue

Country Status (1)

Country Link
CN (1) CN110287046A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306655A (en) * 2020-10-29 2021-02-02 平安信托有限责任公司 Task auditing method and device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1956421A (en) * 2005-10-26 2007-05-02 北京航空航天大学 Reliable transmission method for web service message
CN102023974A (en) * 2009-09-14 2011-04-20 中国移动通信集团公司 Method, device and system for processing message by message queue
CN108965457A (en) * 2018-08-02 2018-12-07 郑州云海信息技术有限公司 A kind of message delivery method of distributed cluster system, device, equipment and medium
CN109298957A (en) * 2018-10-18 2019-02-01 大唐网络有限公司 A kind of information management method with high reliability for supporting to regularly send
US20190158990A1 (en) * 2013-09-06 2019-05-23 Zeta Global Corp. Messaging service application programming interface

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1956421A (en) * 2005-10-26 2007-05-02 北京航空航天大学 Reliable transmission method for web service message
CN102023974A (en) * 2009-09-14 2011-04-20 中国移动通信集团公司 Method, device and system for processing message by message queue
US20190158990A1 (en) * 2013-09-06 2019-05-23 Zeta Global Corp. Messaging service application programming interface
CN108965457A (en) * 2018-08-02 2018-12-07 郑州云海信息技术有限公司 A kind of message delivery method of distributed cluster system, device, equipment and medium
CN109298957A (en) * 2018-10-18 2019-02-01 大唐网络有限公司 A kind of information management method with high reliability for supporting to regularly send

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306655A (en) * 2020-10-29 2021-02-02 平安信托有限责任公司 Task auditing method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2021088641A1 (en) Data transmission method, data processing method, data reception method and device, and storage medium
CN109873736A (en) A kind of micro services monitoring method and system
CN108449410A (en) Information management method, system and relevant apparatus in a kind of cloud platform
US20090080432A1 (en) System and method for message sequencing in a broadband gateway
CN105338086A (en) Distributed message forwarding method
CN101674255B (en) Method, server and system for forwarding messages of enterprise service bus
CN101360309B (en) Execution method, apparatus and system for service open command
CN110677462B (en) Access processing method, system, device and storage medium for multi-block chain network
CN102880475A (en) Real-time event handling system and method based on cloud computing in computer software system
CN111212085A (en) Internet of things platform synchronous calling method, Internet of things system and network equipment
CN103795569A (en) Server connection method and device based on connection pool
CN105635083A (en) Service processing method and service processing system based on server and client architecture
CN114253748A (en) Message processing system and message processing method
CN1973282A (en) System and method for managing a change to a cluster configuration
CN109600324A (en) Video communication method, device, computer equipment and storage medium
CN104052677A (en) Soft load balancing method and apparatus of single data source
CN109348434A (en) A kind of sending method of scene information, sending device and terminal device
CN110287046A (en) Business service message method and system based on queue
CN110442464A (en) Method for processing business, business processing device, electronic equipment and medium
CN1972276B (en) A management method and system for protocol access
CN114710571A (en) Data packet processing system
CN101159972B (en) Traffic processing method and system and traffic control point
US20090172122A1 (en) Message Transmission Method, Message Transmission Device, and Storage Medium Recorded with Message Transmission Program
CN111400028B (en) Load balancing processing method for train management
US9438693B2 (en) System and method for message retry in a broadband gateway

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

Application publication date: 20190927