Search

CN-116089760-B - System and method for realizing long connecting pipeline based on Spring container

CN116089760BCN 116089760 BCN116089760 BCN 116089760BCN-116089760-B

Abstract

The invention provides a system and a method for realizing a long connection pipeline based on a Spring container, wherein the system comprises a flow newly-added or updated module, a short connection data receiving module, a node executing module and a long connection data receiving module, wherein the flow newly-added or updated module is used for storing flow information when the flow is newly-added or updated and pushing the flow information to the short connection data receiving module by using short connection, the short connection data receiving module is used for judging a flow state and determining whether to drive the node executing module according to the flow state, the node executing module is used for pushing the long connection data, and the long connection data receiving module is used for receiving pushing data of the node executing module and selectively calling the node executing module according to the flow information or determining whether to close the long connection management according to the flow state. The method has the advantages that the long connecting pipeline is used for carrying out data interaction among a plurality of service nodes such as a flow request party, a flow receiving party and the like and completing flow calculation, the purpose of controlling the flow progress in real time by a user is achieved through the combination of long and short connection, and server resources are reasonably utilized.

Inventors

  • YANG JINAN
  • ZHANG DAN
  • ZHU XING
  • CHENG PEI
  • WU LEI
  • Gong Letian

Assignees

  • 爱信诺征信有限公司

Dates

Publication Date
20260505
Application Date
20221225

Claims (5)

  1. 1. The method for realizing the long connecting pipeline based on the Spring container is characterized by comprising the following steps of: s1, saving flow information when a flow is newly added or updated through a flow adding or updating module, and pushing the flow information to other receivers through short connection; S2, receiving flow information pushed by short connection through a short connection data receiving module, and determining whether to drive a node executing module according to the flow state; S3, pushing long connection data through the node execution module, wherein the operation process is as follows, S31, judging whether the current node can execute, if not, saving data, ending the current node executing module service, if so, executing service processing, obtaining a calculation result, and entering step S32; S32, judging whether a calculation result is required to be pushed, if so, splicing the ip+port+flow ID to form a bean, acquiring a long connecting pipeline from a spring container, and entering a step S33; S33, pushing data by using the obtained long connecting pipeline; s4, receiving the pushed long connection data of the node execution module through the long connection data receiving module, judging whether the process is continuously executed, if so, driving the node execution module to quietly execute the whole process under the condition that the state of the process is not changed, and if not, determining whether the current data is required to be saved or whether a long connection pipeline is required to be closed according to the state of the process.
  2. 2. The method for implementing a long connection pipe based on a Spring container according to claim 1, wherein in step S2, the operation procedure of the short connection data receiving module is as follows: s21, saving flow information; S22, judging whether the flow state is a starting state, if the flow state is the starting state, driving the node execution module to end the service of the current short connection data receiving module, and if the state is a pause or termination state, directly ending the service of the current short connection data receiving module.
  3. 3. The method for realizing long connection pipelines based on Spring containers according to claim 1, wherein in step S32, when ip+port+process ID is spliced, and long connection pipelines are obtained from Spring containers, if the long connection pipelines do not exist, starting long connection clients according to ip and port and blocking, then obtaining the long connection pipelines, and registering the long connection pipelines in the Spring containers.
  4. 4. The method for implementing long connection pipes based on Spring containers according to claim 1, wherein in step S32, when there is no next node, the flow execution process is as follows: S321, changing the flow state to be an end state; S322, data pushing is carried out by using short connection, at the moment, a short connection data receiving module is driven, other participants are controlled to close long connection pipelines, and the process calculation is thoroughly finished; S323, closing the long connection channel, logging off the bean, and ending the current node executing module service.
  5. 5. The method for implementing long connection pipes based on Spring containers according to claim 1, wherein in step S4, the specific process of determining whether to save current data or to close long connection pipes according to the flow state decision is as follows: S41, if the flow state is pause, the current data is reserved, and the service of the current long connection data receiving module is ended; If the flow state is non-pause, closing the long connection, logging off the bean, and ending the service of the current long connection data receiving module.

Description

System and method for realizing long connecting pipeline based on Spring container Technical Field The invention belongs to the technical field of communication, and particularly relates to a system and a method for realizing a long connection pipeline based on a Spring container. Background At present, most websites are deployed by servers based on distributed clusters, users log in front-end pages through registered accounts, transmit own data after inputting the data to the servers, and the servers can persist the data to a database. However, the user data may involve private information, which is easy to leak if stored in other servers, increasing the security risk of the user. In technical terms, at present, communication based on http protocol, namely short link, is used, when a certain node performs the operation of establishing connection and releasing connection, which consumes network resources and time. Disclosure of Invention In view of the foregoing, the present invention aims to overcome the above-mentioned drawbacks of the prior art, and provides a system and a method for implementing a long connection pipe based on a Spring container. In order to achieve the above purpose, the technical scheme of the invention is realized as follows: A system for implementing long connection pipes based on Spring containers, comprising: The flow adding or updating module is used for saving flow information when the flow is added or updated, and pushing the flow information to the short connection data receiving module by using the short connection; The short connection data receiving module is used for judging the flow state and determining whether to drive the node executing module according to the flow state; the node execution module is used for pushing the long connection data; the long connection data receiving module is used for receiving the push data of the node executing module, selecting and calling the node executing module according to the flow information, or deciding whether to close the long connection management according to the flow state. The application also provides a method for realizing the long connecting pipeline based on the Spring container, which comprises the following steps: s1, saving flow information when a flow is newly added or updated through a flow adding or updating module, and pushing the flow information to other receivers through short connection; S2, receiving flow information pushed by short connection through a short connection data receiving module, and determining whether to drive a node executing module according to the flow state; s3, pushing long connection data through the node execution module; s4, receiving the pushed long connection data of the node execution module through the long connection data receiving module, judging whether the process is continuously executed, if so, driving the node execution module to quietly execute the whole process under the condition that the state of the process is not changed, and if not, determining whether the current data is required to be saved or whether a long connection pipeline is required to be closed according to the state of the process. Further, in step S2, the operation procedure of the short connection data receiving module is as follows: s21, saving flow information; S22, judging whether the flow state is a starting state, if the flow state is the starting state, driving the node execution module to end the service of the current short connection data receiving module, and if the state is a pause or termination state, directly ending the service of the current short connection data receiving module. Further, in step S3, the operation procedure of the node execution module is as follows: S31, judging whether the current node can execute, if not, saving data, ending the current node executing module service, if so, executing service processing, obtaining a calculation result, and entering step S32; S32, judging whether a calculation result is required to be pushed, if so, splicing the ip+port+flow ID to form a bean, acquiring a long connecting pipeline from a spring container, and entering a step S33; s33, pushing data by using the obtained long connecting pipeline. Further, in step S32, when the ip+port+flow ID is spliced and the long connection pipe is obtained from the spring container, if the long connection pipe does not exist, the long connection client is started and blocked according to the ip and the port, then the long connection pipe is obtained, and the long connection pipe is registered in the spring container. Further, in step S32, when there is no next node, the flow execution process is as follows: S321, changing the flow state to be an end state; S322, data pushing is carried out by using short connection, at the moment, a short connection data receiving module is driven, other participants are controlled to close long connection pipelines, and the process calculation is thoroughly finished; S32