CN106095599A - A kind of easy expansion interface method of asynchronous long connection - Google Patents
A kind of easy expansion interface method of asynchronous long connection Download PDFInfo
- Publication number
- CN106095599A CN106095599A CN201610398545.1A CN201610398545A CN106095599A CN 106095599 A CN106095599 A CN 106095599A CN 201610398545 A CN201610398545 A CN 201610398545A CN 106095599 A CN106095599 A CN 106095599A
- Authority
- CN
- China
- Prior art keywords
- client
- message
- asynchronous
- service end
- long connection
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention provides a kind of easy expansion interface method of asynchronous long connection, comprise the following steps: request message is inserted service end message queue, after inserting successfully, client asynchronous query response message by S1, client;After S2, service end extract request message in corresponding message queue, carry out Message Processing, use asynchronously or synchronously mode to send response data to client.The invention has the beneficial effects as follows: set up client be connected with service end length, asynchronous call, treatment effeciency is very fast, and response time is shorter.
Description
Technical field
The present invention relates to interface method, particularly relate to a kind of easy expansion interface method of asynchronous long connection.
Background technology
Legacy interface, the most general http protocol interface, the short connection of general employing, synchronization call mode.Client thread
Setting up and connect, calling interface sends request to service end, simultaneously current thread should be in " time-out " state, i.e. thread can not be to
After perform, it is necessary to take service end and could perform backward to after oneself result.After service end receives client request,
Processing request, to client, client, result is received result, then current thread continues to perform backward, closes and connects.
Short connection, repeats to set up the operation connecting more TCP foundation and closing, wastes resource time.
Synchronization call, each user end to server sends request, and client call time-dependent is in the response of server
Time, block type method of calling.
Summary of the invention
In order to solve the problems of the prior art, the invention provides a kind of easy expansion interface method of asynchronous long connection.
The invention provides a kind of easy expansion interface method of asynchronous long connection, comprise the following steps:
Request message is inserted service end message queue, after inserting successfully, client asynchronous query response message by S1, client;
After S2, service end extract request message in corresponding message queue, carry out Message Processing, use asynchronously or synchronously mode
Response data is sent to client.
As a further improvement on the present invention, in step sl, obstruction is set and waits query time.
As a further improvement on the present invention, in step sl, service end message queue is the distribution realized based on Redis
Formula message queue.
The invention has the beneficial effects as follows: by such scheme, set up client be connected with service end length, asynchronous call, place
Reason efficiency is very fast, and response time is shorter.
Detailed description of the invention
Below by detailed description of the invention, the present invention is further described.
A kind of easy expansion interface method of asynchronous long connection, request message is inserted service end message queue, is inserted by client
After success, client asynchronous query response message, obstruction can be set and wait query time.Service end takes in corresponding message queue
After request message, carry out Message Processing, use asynchronously or synchronously mode to send response data to client.
This interface is typical Distributed Message Queue mode message middleware.
Distributed Message Queue is realized based on Redis.Redis is the NoSQL data of the Key-Value of a memory type
Storehouse, access speed is exceedingly fast, and uses very simple, supports the operation of List data structure, can be used for the queue service of lightweight.
Redis server can use many clustered deploy(ment)s, solves Single Point of Faliure, it is ensured that data safety, it is achieved Distributed Message Queue height
Energy, High Availabitity, expansible.
Come between reduction system by reliable asynchronous communication can be carried out between message-oriented middleware, application program or assembly
The degree of coupling, thus improve extensibility and the availability of whole system.
Realize the Distributed Message Queue message-switching technique as message-oriented middleware based on Redis, set up client with
Service end length connects, asynchronous call.
Redis caches as message, and official website test read-write can be greatly improved message queue performance to about 100,000.
Message-oriented middleware can arrange the multiple redis service clusters of connection, and system stability reliability is effectively ensured.
The one easy expansion interface method of asynchronous long connection that the present invention provides, in the middle of message based on redis message queue
Part plug-in unit, supports asynchronous call, long connection, it is easy to laterally expand.Dynamic link library method of calling, interface definition is the most semantic bright
Really, packet uses Json form, supports Linux/Windows operating system.
Above content is to combine concrete preferred implementation further description made for the present invention, it is impossible to assert
Being embodied as of the present invention is confined to these explanations.For general technical staff of the technical field of the invention,
On the premise of present inventive concept, it is also possible to make some simple deduction or replace, all should be considered as belonging to the present invention's
Protection domain.
Claims (3)
1. the easy expansion interface method of asynchronous long connection, it is characterised in that comprise the following steps:
Request message is inserted service end message queue, after inserting successfully, client asynchronous query response message by S1, client;
After S2, service end extract request message in corresponding message queue, carry out Message Processing, use asynchronously or synchronously mode
Response data is sent to client.
The easy expansion interface method of asynchronous long connection the most according to claim 1, it is characterised in that: in step sl, arrange
Block and wait query time.
The easy expansion interface method of asynchronous long connection the most according to claim 1, it is characterised in that: in step sl, service
End message queue is the Distributed Message Queue realized based on Redis.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610398545.1A CN106095599A (en) | 2016-06-07 | 2016-06-07 | A kind of easy expansion interface method of asynchronous long connection |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610398545.1A CN106095599A (en) | 2016-06-07 | 2016-06-07 | A kind of easy expansion interface method of asynchronous long connection |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106095599A true CN106095599A (en) | 2016-11-09 |
Family
ID=57228192
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610398545.1A Pending CN106095599A (en) | 2016-06-07 | 2016-06-07 | A kind of easy expansion interface method of asynchronous long connection |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106095599A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109873863A (en) * | 2019-01-18 | 2019-06-11 | 北京百度网讯科技有限公司 | The asynchronous invoking method and device of service |
CN115378857A (en) * | 2022-08-17 | 2022-11-22 | 中国银行股份有限公司 | Test method and device for asynchronous long-hanging distributed architecture |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030097455A1 (en) * | 2001-11-21 | 2003-05-22 | International Business Machines Corporation | Method for continuous I/O request processing in an asynchronous environment |
CN102469064A (en) * | 2010-11-03 | 2012-05-23 | 中兴通讯股份有限公司 | Method for implementing communication and communication equipment |
CN104378436A (en) * | 2014-11-20 | 2015-02-25 | 深圳市远行科技有限公司 | Information push system and method based on server push |
CN105049477A (en) * | 2015-05-26 | 2015-11-11 | 腾讯科技(深圳)有限公司 | Method and device for maintaining long connection |
CN105068864A (en) * | 2015-07-24 | 2015-11-18 | 北京京东尚科信息技术有限公司 | Method and system for processing asynchronous message queue |
-
2016
- 2016-06-07 CN CN201610398545.1A patent/CN106095599A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030097455A1 (en) * | 2001-11-21 | 2003-05-22 | International Business Machines Corporation | Method for continuous I/O request processing in an asynchronous environment |
CN102469064A (en) * | 2010-11-03 | 2012-05-23 | 中兴通讯股份有限公司 | Method for implementing communication and communication equipment |
CN104378436A (en) * | 2014-11-20 | 2015-02-25 | 深圳市远行科技有限公司 | Information push system and method based on server push |
CN105049477A (en) * | 2015-05-26 | 2015-11-11 | 腾讯科技(深圳)有限公司 | Method and device for maintaining long connection |
CN105068864A (en) * | 2015-07-24 | 2015-11-18 | 北京京东尚科信息技术有限公司 | Method and system for processing asynchronous message queue |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109873863A (en) * | 2019-01-18 | 2019-06-11 | 北京百度网讯科技有限公司 | The asynchronous invoking method and device of service |
CN109873863B (en) * | 2019-01-18 | 2021-10-15 | 北京百度网讯科技有限公司 | Asynchronous calling method and device of service |
CN115378857A (en) * | 2022-08-17 | 2022-11-22 | 中国银行股份有限公司 | Test method and device for asynchronous long-hanging distributed architecture |
CN115378857B (en) * | 2022-08-17 | 2024-03-26 | 中国银行股份有限公司 | Testing method and device for asynchronous long-hanging distributed architecture |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20150207904A1 (en) | System and method for single kvm client accommodating multiple different video compression technologies | |
CN109547162B (en) | Data communication method based on two sets of one-way boundaries | |
CN103888441A (en) | Information transmitting method between application and protocol stack and processing device | |
CN107682460B (en) | Distributed storage cluster data communication method and system | |
CN103699450B (en) | Linux adaptive component communication method | |
CN105635298A (en) | Service isolation principle based data acquisition equipment unified access system | |
CN107248978A (en) | A kind of message method for processing interception and system | |
CN109547524A (en) | User behavior storage method, device, equipment and storage medium based on Physical Network | |
CN106095599A (en) | A kind of easy expansion interface method of asynchronous long connection | |
CN106066877A (en) | A kind of method and system of asynchronous refresh data | |
CN105049162A (en) | Public network information high-efficiency transmission method based on Epoll model | |
CN109088918B (en) | Interaction method, client device and server device | |
CN114371935A (en) | Gateway processing method, gateway, device and medium | |
CN104753813A (en) | DMA (Direct Memory Access) message transfer method | |
CN103068052A (en) | Dynamic configuration method and system of resources and portal server | |
CN102546659A (en) | Durable TCP (transmission control protocol) connection method oriented to remote procedure call | |
CN109040086A (en) | A kind of industrial control system DDOS attack emulation mode and device | |
CN104021196A (en) | I/O multiplexing method for System V message queue | |
CN106612307B (en) | A kind of implementation method and device of always online business | |
CN105471718A (en) | Realization method of full duplex message queue | |
MX2021005653A (en) | Connection and service discovery for fine ranging applications. | |
CN105656768B (en) | A kind of method and Alljoyn gateway of the resource utilization improving Alljoyn gateway | |
CN105099645A (en) | Multi-user concurrent communication method and device based on half-duplex communication device | |
CN109766347B (en) | Data updating method, device, system, computer equipment and storage medium | |
CN103780680A (en) | Server real-time pushing system based on JMS message bus and method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20161109 |
|
RJ01 | Rejection of invention patent application after publication |