CN115665175B - Distributed gateway system and transaction processing method thereof - Google Patents

Distributed gateway system and transaction processing method thereof Download PDF

Info

Publication number
CN115665175B
CN115665175B CN202211672977.9A CN202211672977A CN115665175B CN 115665175 B CN115665175 B CN 115665175B CN 202211672977 A CN202211672977 A CN 202211672977A CN 115665175 B CN115665175 B CN 115665175B
Authority
CN
China
Prior art keywords
transaction
state
processing module
request
message processing
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.)
Active
Application number
CN202211672977.9A
Other languages
Chinese (zh)
Other versions
CN115665175A (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.)
Jiangsu Suning Bank Co Ltd
Original Assignee
Jiangsu Suning Bank 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 Jiangsu Suning Bank Co Ltd filed Critical Jiangsu Suning Bank Co Ltd
Priority to CN202211672977.9A priority Critical patent/CN115665175B/en
Publication of CN115665175A publication Critical patent/CN115665175A/en
Application granted granted Critical
Publication of CN115665175B publication Critical patent/CN115665175B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention provides a distributed gateway system and a transaction processing method thereof, wherein the system comprises: the message processing module records the checking transaction association relation corresponding to each transaction and configures a response information template; the lease management module is responsible for providing leases to the message processing module and managing the number of issued leases, the waiting time and the holding time limit; the state management module comprises a transaction state storage unit and a transaction message storage unit, wherein the transaction state storage unit records a temporary transaction acceptance state between receipt of a transaction request and return of a response, and records a temporary virtual transaction acceptance state when a checking request is received but related transaction data is not found, and the transaction message storage unit persistently stores the transaction request and the content of the returned response message after a gateway successfully acquires a lease or the waiting time is overtime. The invention can reduce the peak period response failure rate of the business service system and the probability of the data loss from the sending to the first due to network jitter, and improve the reliability of the service.

Description

Distributed gateway system and transaction processing method thereof
Technical Field
The invention relates to the field of computer information processing, in particular to a distributed gateway system and a transaction processing method thereof.
Background
At present, information interaction between computer systems is basically performed in a client-server mode, wherein a server mainly comprises a gateway system and a service system, a client sends a request message to the server through a network, and then the server generates a response and returns the response to the client to complete an interaction process.
In a typical business scenario, a transaction is first composed of a transaction request and a transaction response. Because a part of transactions need to be processed for a long time, the transactions are made into an asynchronous mode, namely, transaction responses do not directly return the final results of the transactions (except failure conditions such as system abnormity and the like), the transaction verification requests are initiated after the client is needed, and the server returns the transaction verification responses according to the actual states of the corresponding transactions.
The gateway system of the server is usually deployed in a distributed manner, that is, a plurality of nodes form a cluster, so as to improve overall stability and throughput. The gateway system, as a pre-posed system of the business service system, generally needs to be responsible for performing general security check on a request sent by a client and distributing the request to a correct business service system according to the content of the request.
Most gateway systems also have a flow control function, and reject excessive requests which cannot be borne by a back-end business service system when the request amount is too large, and this way can ensure that the business service system is kept within a safe load range, but for some clients, the reject of the requests causes poor user experience, and in most cases, the clients retry, which further aggravates congestion.
In addition, due to the influence of network fluctuation, the time consumption for transmitting the request message of the client to the server sometimes fluctuates greatly, so that the later-sent request arrives at the server earlier than the earlier-sent request, that is, the later-sent first-arrived request. After the first-come request arrives and before the first-come request does not arrive, if the client requests the server to inquire the transaction state of the first-come request, the server can only reply the response without transaction data, but the server still normally accepts and constructs the transaction when the corresponding request arrives at the server. At the moment, the client already judges the pre-sent request as transaction failure, the transaction states of the two communication parties are out of synchronization, and the subsequent problems of account checking inequality and the like are caused in the industries such as finance and the like.
Disclosure of Invention
In view of the above problems, the present invention provides a distributed gateway system and a transaction processing method thereof, which reduce the peak response failure rate of a service system and the probability of data loss after transmission and before transmission caused by network jitter, and improve the reliability of service.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows: a distributed gateway system is interactively arranged between a client and a business service system, and comprises: the message processing module records the checking transaction association relation corresponding to each transaction and configures a response information template according to the style of the business service system, wherein the response information template comprises transaction state fields with the values of [ processing ], [ processing failure ] and [ checking no transaction ]; the lease management module is responsible for providing leases to the message processing module and managing the number of issued leases, waiting time and holding time limit; the state management module comprises a transaction state storage unit and a transaction message storage unit, wherein the transaction state storage unit is used for recording a temporary transaction acceptance state in a time period between the receipt of a transaction request and the return of a response and recording a temporary virtual transaction acceptance state when a checking request is received but related transaction data is not found, and the transaction message storage unit is used for persistently storing the contents of the transaction request and the returned response message after a gateway successfully acquires a lease or the waiting time is overtime.
As a preferred scheme, the transaction state includes [ request buffering ], [ invoked service system ], and [ buffering failure ]; preferentially judging according to the temporary transaction acceptance state in the transaction state storage unit, if the record is found, representing that the transaction is buffered at present, is processing, and is displayed as [ in request buffering ] to the client; if no record is checked, further checking whether a record transaction request exists in the transaction message storage unit, and if so, displaying the record transaction request as a called service system to the client; if not, checking whether a virtual transaction acceptance state of the transaction is reserved in the transaction state storage unit, if not, immediately creating a record in the transaction state storage unit, and displaying the record as [ request buffer ] to the client; if the virtual transaction acceptance state is checked, checking whether the creating time exceeds the preset time limit of the transaction from the current time, if so, displaying [ buffer failure ] to the client, and if not, displaying [ request in buffer ].
Preferably, the managing the number of issued leases, the waiting time and the holding time limit includes: the method ensures that leases are issued according to a first-come-first-come fair sequence, and the leases issued at the same time do not exceed a preset number, so that excessive requests can be directly rejected; controlling the upper limit of the waiting time of each transaction lease, and after the transaction lease is overtime, the message processing module gives up waiting and returns a response message of overtime system processing to the client; the lease of each transaction type is provided with a maximum holding time limit, and if the message processing module holds the lease and does not return after the lease is overtime, the lease appointment is regenerated in the lease management module.
As a preferred scheme, the service system is responsible for processing the transaction request forwarded by the gateway system, and generating a response message according to the service logic and transmitting the response message back to the gateway system.
As a preferred scheme, when the lease management module is unavailable, all transaction requests are immediately forwarded to a service system, the queue buffer function is degraded to be not buffered, but the later-sent first-arrived prevention function is still available; when the state management module is unavailable, all transaction requests and response messages are not subjected to state maintenance, related checking requests are directly routed to a service system, and when the condition that the transaction requests are sent later and arrive first is found, and the transaction requests buffered in a queue are checked, a transaction state field with the value of [ checking no transaction ] is returned, the whole system is degraded into a synchronous request response mode, but the buffering function is still available; when the lease management module and the state management module are both unavailable, the whole system is degraded into a synchronous forwarding gateway mode, buffering is not performed, and the processing and then forwarding can not be performed.
The invention also provides a transaction processing method of the distributed gateway system, which comprises the following steps: the client sends a transaction request to a message processing module; the message processing module responds to the transaction request and inquires the transaction state from the state management module; the state management module returns a transaction state of [ request in buffer ]; the message processing module tries to acquire a lease to the lease management module, all the leases are issued at the moment, and queue buffering is carried out; the message processing module returns a preset transaction state field with a value of [ processing ] to the client; after receiving the state field, the client initiates a checking request to a message processing module, wherein the checking request comprises a unique identifier of the corresponding transaction; the message processing module responds to the checking request and inquires a transaction state from the state management module, and the state management module inquires that the transaction state is in a request buffer according to the unique identifier and returns; the message processing module returns a preset transaction state field with a value of [ processing ] to the client according to the response information template; before waiting for timeout, the message processing module releases and allocates a lease to the current transaction; the message processing module forwards the transaction request to a business service system; the business service system processes the transaction request and returns a transaction response message to the message processing module; and the message processing module sends the transaction response message to the client.
The invention also provides a transaction processing method of the distributed gateway system, which comprises the following steps: the client sends a transaction request to a message processing module; the message processing module responds to the transaction request and inquires the transaction state from the state management module; the state management module returns a transaction state of [ request in buffer ]; the message processing module tries to acquire a lease from the lease management module, and the transaction quantity of the buffer queue reaches the upper limit at the moment; the message processing module returns a preset transaction state field with a value of [ processing failure ] to the client; the message processing module informs a state management module of transaction request buffering failure, and the state management module records a unique identifier of the transaction request and a corresponding [ buffering failure ] transaction state; after receiving the state field, the client initiates a checking request to a message processing module, wherein the checking request comprises a unique identifier of the corresponding transaction; the message processing module responds to the checking request, inquires the transaction state from the state management module, and the state management module inquires that the transaction state is [ buffer failure ] according to the unique identifier and returns; and the message processing module returns a preset transaction state field with a value of [ processing failure ] to the client according to the response information template.
The invention also provides a transaction processing method of the distributed gateway system, which comprises the following steps: the client sends a transaction request to a message processing module, and the transaction request is transmitted to a network delay; if the client does not obtain a response within the set time, initiating a transaction verification request; the message processing module receives a transaction checking request when the network is recovered to normal, and inquires a corresponding recharging transaction state from the state management module according to the unique identifier; if the state management module fails to inquire the transaction record and the verification record, a virtual transaction state [ in request buffer ] corresponding to the unique identifier is created, and a state is returned to the message processing module; the message processing module returns a preset transaction state field with a value of [ processing ] to the client; after receiving the transaction state field, the client initiates a transaction checking request again after a period of time; the message processing module responds to the checking request and inquires the transaction state from the state management module; the state management module inquires that the transaction state is [ buffer failure ] according to the unique identifier and returns the transaction state to the message processing module; the message processing module returns a preset transaction state field with a value of [ processing failure ] to the client according to the response information template; the message processing module receives a transaction request and inquires a transaction state from the state management module; the state management module returns that the transaction state is [ buffer failure ]; and the message processing module returns a preset transaction state field with a value of [ processing failure ] to the client according to the response information template.
The invention also provides a transaction processing method of the distributed gateway system, which comprises the following steps: the client sends a transaction request to a message processing module; the message processing module responds to the transaction request and inquires the transaction state from the state management module; the state management module returns a transaction state of [ request buffer ]; the message processing module acquires a lease corresponding to the transaction from a lease management module; the message processing module forwards the transaction request to a business service system; the message processing module informs a state management module of the unique transaction identifier and the state of the business service system, and the state management module records the unique transaction identifier and the state of the business service system; the business service system processes the transaction business and returns a transaction response message to the message processing module; the message processing module sends the transaction state field to the client; after receiving the state field, the client initiates a checking request to a message processing module, wherein the checking request comprises a unique identifier of the corresponding transaction; the message processing module responds to the checking request and inquires a transaction state from the state management module, and the state management module inquires that the transaction state is [ a called service system ] according to the unique identifier and returns; the message processing module forwards a transaction verification request of a client to a business service system, the business service system finds corresponding actual transaction data through the unique identifier and returns a transaction state field to the message processing module, and the transaction state field is in a [ success ] or [ failure ] state; and the message processing module returns a verification response message received from the business service system to the client.
The invention also provides a transaction processing method of the distributed gateway system, which comprises the following steps: the client sends a transaction request to a message processing module; when the lease management module fails and is not available, the message processing module directly informs the state management module of the state of the transaction registration request, and records the state as [ a called service system ]; the message processing module forwards the transaction request to a business service system; the business service system returns a transaction response message to the message processing module, if the system is overloaded at the moment, the response contains system busy information, and if the system is normal at the moment, the response contains recharging success or failure state information; the message processing module sends a transaction response message to the client; a new transaction request is sent to the message processing module; the lease management module and the state management module are unavailable, and the message processing module directly forwards the transaction request to a service system; the business service system processes the transaction business and returns a transaction business response; the message processing module forwards the transaction state field to the client; after receiving the state field, the client initiates a checking request to a message processing module, wherein the checking request comprises a unique identifier of the corresponding transaction; the message processing module forwards the checking request to a service system; the business service system searches a transaction record according to the unique identifier and returns a transaction state field; the message processing module forwards the transaction state field to the client; the client newly sends a transaction request to the message processing module, and message transmission is greatly delayed due to network failure; the client judges that the transaction request is overtime and immediately initiates a transaction checking request; the transaction state management module is unavailable, and the message processing module directly forwards the checking request to the service system; if the business service system can not find the transaction record corresponding to the serial number, returning a transaction state field as [ checking no transaction record ]; the message processing module forwards the transaction state field to a client, and the client records the transaction as a failure state; when the recharging request reaches the message processing module, the message processing module directly forwards the transaction request to a business service system for normal processing; the business service system successfully transacts and returns a transaction state field; the message processing module forwards the transaction state field to the client, and because the client is overtime, the message processing module cannot transmit the transaction state field to the client, and at the moment, the transaction is in different states between the client and the service system, and an exception is reported.
Compared with the prior art, the invention has the beneficial effects that: by integrating fair queuing logic into the processing of transaction requests, excess requests are allowed to be buffered under certain timeliness and total capacity, and smooth transmission is performed according to the maximum throughput of a business service system at the back end of the gateway. Meanwhile, in order to avoid data loss of two communication parties caused by sending later and arriving first, a virtual processing state in a period of time is established for the transaction in the checking type, so that the condition that the transaction does not exist when the checking request is directly returned before the transaction request arriving later is received is ensured, and the service can be normally carried out as long as the transaction request arriving later reaches the service end in the period of time.
The invention utilizes the consistency and reliability of distributed transaction state storage, reads and writes lease information and transaction state information according to transaction dimensions, instructs a gateway to buffer/send received transaction requests to a service system, and returns correct transaction states to check requests. The invention protects a fragile service system, improves the overall message throughput, reduces the probability of service rejection when surge occurs, avoids the desynchronization of transaction states of both communication parties caused by the first transmission after transaction and verification due to network jitter, and can still keep the system with the minimum function when partial modules are in failure by the modularized design of the service end, thereby maintaining the gateway forwarding capability of the core. On the whole, the invention can reduce the peak period response failure rate of the business service system and the probability of the data loss from the sending to the sending first due to the network jitter, and improve the reliability of the service.
Drawings
The disclosure of the present invention is illustrated with reference to the accompanying drawings. It is to be understood that the drawings are designed solely for the purposes of illustration and not as a definition of the limits of the invention. In the drawings, like reference numerals are used to refer to like parts. Wherein:
fig. 1 is a schematic structural diagram of a distributed gateway system according to an embodiment of the present invention;
FIG. 2 is a timing diagram illustrating the execution of buffered transaction requests according to an embodiment of the present invention;
FIG. 3 is a timing diagram illustrating transaction processing at system full capacity according to an embodiment of the present invention;
FIG. 4 is a timing diagram illustrating a prior-to-transaction request after a verification request according to an embodiment of the present invention;
FIG. 5 is a timing diagram illustrating a transaction request being forwarded in a normal manner according to an embodiment of the present invention;
FIG. 6 is a timing diagram of transaction processing during a module exception according to an embodiment of the present invention.
Detailed Description
It is easily understood that according to the technical solution of the present invention, a person skilled in the art can propose various alternative structures and implementation ways without changing the spirit of the present invention. Therefore, the following detailed description and the accompanying drawings are merely illustrative of the technical aspects of the present invention, and should not be construed as all of the present invention or as limitations or limitations on the technical aspects of the present invention.
An embodiment according to the present invention is shown in connection with fig. 1. A distributed gateway system is interactively arranged between a client and a business service system, and the gateway system and the business service system are collectively called as a server. The business service system is responsible for processing the transaction request forwarded by the gateway system and generating a response message according to the business logic and transmitting the response message back to the gateway system.
The gateway system comprises a message processing module, a lease management module and a state management module, wherein the functions of the modules are as follows:
(1) And the message processing module records the checking transaction association relation corresponding to each transaction, and configures a response information template according to the style of the business service system, wherein the response information template comprises transaction state fields with the values of [ processing ], [ processing failure ] and [ checking no transaction ]. Specifically, the response information template includes a response information template of an original transaction failure and a response information template of a verified transaction. For the transaction which is successfully processed, the business service system directly returns the verification result, and the gateway system does not need to intervene.
After receiving the transaction request, the message processing module firstly calls the state management module, if the transaction state is found to be [ buffer failure ], the client checks the transaction before, and the maximum time limit of the virtual buffer is exceeded, so that the transaction is delayed for too long due to network jitter and the like, the client possibly judges that the transaction fails, the server gives up processing the transaction, and returns a preset transaction response message to the client, wherein the transaction response message comprises [ processing failure ] fields.
If the transaction status is [ request buffered ], an attempt is made to acquire the lease to the lease management module. Waiting for a lease to be issued may take a certain amount of time, up to and including the lease acquisition timeout time, i.e., the time limit requirement for request buffering, for the corresponding transaction configuration. After the lease is successfully acquired, the message processing module immediately orders the state management module to write the request information into a transaction message storage unit (the transaction state is changed into a called service system), and then sends the request to a back-end service system for processing and waits for response.
If the lease is completely issued (i.e. the transaction buffer queue has reached the limit) or the lease is waited for overtime, the message processing module needs to instruct the status management module to write a [ processing failure ] field (with a special error code) into the transaction message storage unit according to the response message template.
When the message processing module receives the checking request, firstly, the transaction unique identifier (ID or serial number) is used for checking the state management module, and the obtained state is [ request buffering ]/[ called service system ]/[ buffering failure ]. Wherein, the preset response message with the processing state is returned under the state of the [ request buffering ]; the method comprises the following steps that a relevant verification interface of a business service system is called under a called business system state, and a response returned by the business service system is returned to a client initiating verification; returning a preset response message with a processing failure state in a buffering failure state; checking transaction record returns the preset response message with checking transaction response code.
When the message is buffered, the gateway system can construct an accurate checking result without depending on a service system by maintaining the templated checking response, and directly return the response in the message processing to the client.
(2) And the lease management module is responsible for providing leases to the message processing module and managing the release quantity, waiting time and holding time limit of the leases.
Specifically, managing the number of leases issued, the waiting time and the holding time limit includes: it is ensured that leases are issued in a first-come-last-come fair order and that no more than a predetermined number of leases (i.e., the maximum amount of concurrency for controlling gateway message processing) are issued at the same time, and that excessive requests are directly denied. And controlling the upper limit of the waiting time of each transaction lease, and after the time is out, the message processing module gives up waiting and returns a response message of the overtime processing of the system to the client. After the lease is issued, the message processing module needs to return so that the lease management module can issue the returned lease to other requests. The lease for each transaction type is provided with a maximum hold time limit, and if the message processing module holds the lease for timeout (usually due to software or hardware exception) and does not return, the lease is regenerated at the lease management module.
The invention combines the typical fair reentry distributed lock principle of the lease management module with distributed storage, realizes the buffer and processing state of precise management transaction, and can support the client to inquire the current progress of the transaction at any time.
(3) The state management module comprises a transaction state storage unit and a transaction message storage unit, wherein the transaction state storage unit is used for recording a temporary transaction acceptance state in a time period between receipt of a transaction request and response return and recording a temporary virtual transaction acceptance state when a checking request is received but relevant transaction data is not found, and the transaction message storage unit is used for persistently storing the transaction request and the content of a returned response message after a gateway successfully acquires a lease or the waiting time is overtime. The virtual transaction acceptance state prevents the checking request from falling into the air within a certain time.
The transaction states include [ request in buffer ], [ invoked service system ], and [ buffer failed ]. The state of a transaction needs to be judged according to the temporary transaction accepting state in the transaction state storage unit according to priority, if the record is found, the transaction is currently buffered and processed, and the transaction is displayed as [ in request buffering ] to the client. If no record is checked, whether a record transaction request exists in the transaction message storage unit is further checked, and if the record transaction request exists in the transaction message storage unit, the record transaction request is displayed as the called service system to the client. If not, checking whether the virtual transaction acceptance state of the transaction is reserved in the transaction state storage unit, if not, immediately creating a record (including creation time) in the transaction state storage unit, and displaying the record as [ request buffer ] to the client. If the virtual transaction acceptance state is checked, checking whether the creating time exceeds the preset time limit of the transaction from the current time, if so, displaying [ buffer failure ] to the client, and if not, displaying [ request in buffer ].
The invention is based on the service degradation strategy, and uses the message processing module as the core to carry out the modularized design of the service end, so that the system can still keep the minimum function when part of the modules are in failure, and the gateway forwarding capability of the core is maintained. The details are as follows:
when the lease management module is unavailable, all transaction requests are immediately forwarded to the service system, the queue buffering function is degraded to be not buffered, but the prevention function of the subsequent transmission and the first arrival is still available. When the state management module is unavailable, all transaction requests and response messages are not subjected to state maintenance, related check requests are directly routed to the service system, a transaction state field with the value of [ check no transaction ] is returned when the transaction requests are sent first after the occurrence of the condition, a transaction state field with the value of [ check no transaction ] is returned when the transaction requests waiting for lease (queue buffering) are checked, the system is degraded into a synchronous request response mode as a whole, but the buffering function is still available. When the lease management module and the state management module are not available, the whole system is degraded into the simplest synchronous forwarding gateway mode, buffering is not carried out, and the system cannot be processed and then sent first.
The invention realizes low coupling between modules through a multi-module architecture which can be partially degraded, and ensures the maximum availability of the system.
The following explains a transaction processing method of a distributed gateway system according to a main scenario by taking bank account recharge as an example:
referring to FIG. 2, a timing diagram for executing buffered transaction requests according to an embodiment of the present invention is shown. Which comprises the following steps:
1.1, the client sends a transaction request to the message processing module. The transaction request is a recharge request.
1.2, the message processing module responds to the transaction request and inquires the transaction state from the state management module.
1.3, the status management module returns the transaction status as [ in request buffer ].
1.4, the message processing module tries to acquire the lease to the lease management module, and all the leases are issued at this time to perform queue buffering.
And 1.5, the message processing module returns a preset transaction state field with the value of [ processing ] to the client.
And 1.6, after receiving the state field, the client initiates a checking request to the message processing module, wherein the checking request comprises the unique identifier of the corresponding transaction.
1.7, the message processing module responds to the checking request, inquires the transaction state from the state management module, and the state management module inquires that the transaction state is in a request buffer according to the unique identifier and returns.
And 1.8, returning a preset transaction state field to the client by the message processing module according to the response information template, wherein the value of the transaction state field is [ processing ].
1.9, before waiting for the timeout, the message processing module has a lease released and assigned to the current transaction.
1.10, the message processing module forwards the transaction request to the business service system.
1.11, the business service system processes the transaction request and returns a transaction response message to the message processing module.
1.12, the message processing module sends the transaction response message to the client.
Referring to fig. 3, a timing diagram of a full transaction process according to an embodiment of the invention is shown. Which comprises the following steps:
2.1, the client sends a transaction request to the message processing module.
2.2, the message processing module responds to the transaction request and inquires the transaction state from the state management module.
2.3, the status management module returns the transaction status as [ in request buffer ].
2.4, the message processing module attempts to acquire a lease to the lease manager module, at which point the number of transactions in the buffer queue has reached an upper limit.
And 2.5, the message processing module returns a preset transaction state field to the client, wherein the value of the transaction state field is [ processing failure ].
2.6, the message processing module informs the state management module of the transaction request buffer failure, and the state management module records the unique identifier of the transaction request and the corresponding [ buffer failure ] transaction state.
And 2.7, after receiving the state field, the client side initiates a checking request to the message processing module, wherein the checking request comprises the unique identifier of the corresponding transaction.
2.8, the message processing module responds to the checking request, inquires the transaction state from the state management module, and the state management module inquires that the transaction state is buffer failure according to the unique identifier and returns.
And 2.9, returning a preset transaction state field to the client by the message processing module according to the response information template, wherein the value of the transaction state field is [ processing failure ].
Referring to fig. 4, a timing diagram illustrating a prior transmission of a verification request and a transaction request according to an embodiment of the invention is shown. Which comprises the following steps:
3.1, the client sends the transaction request to the message processing module, and the transaction request is transmitted with network delay. The transaction request is a recharge request.
3.2, if the client does not obtain a response within the set time, initiating a transaction verification request.
And 3.3, the message processing module receives the transaction checking request when the network is recovered to be normal, and inquires the corresponding recharging transaction state from the state management module according to the unique identifier.
3.4, if the state management module fails to inquire the transaction record and the verification record, a virtual transaction state [ in request buffer ] corresponding to the unique identifier is created, and the state is returned to the message processing module.
And 3.5, the message processing module returns the preset transaction state field with the value of [ processing ] to the client.
And 3.6, after receiving the transaction state field, the client initiates a transaction verification request again after a period of time.
And 3.7, the message processing module responds to the checking request and inquires the transaction state from the state management module.
3.8, the state management module inquires that the transaction state is buffer failure according to the unique identifier and returns the transaction state to the message processing module.
And 3.9, returning a preset transaction state field to the client by the message processing module according to the response information template, wherein the transaction state field takes a value of [ processing failure ].
3.10, the message processing module receives the transaction request and inquires the transaction state from the state management module.
3.11, the status management module returns the transaction status as [ buffer failed ].
And 3.12, the message processing module returns a preset transaction state field to the client according to the response information template, and at the moment, the transaction state field takes the value of [ processing failure ].
Note: if the initial recharging request reaches the message processing module in time in the step 3.6, the transaction state of the recharging request is [ request buffer ], the message processing module can normally acquire a lease and forward the request to the service system, the recharging transaction is normally accepted, and the state is smoothly changed into [ called service system ]. And then, the recharging verification request initiated by the client is routed to the service system for processing, and a response of success or failure is returned.
Referring to fig. 5, a timing diagram of a transaction request forwarded normally according to an embodiment of the invention is shown. The method comprises the following steps:
4.1, the client sends a transaction request to the message processing module. The transaction request is a recharge request.
And 4.2, the message processing module responds to the transaction request and inquires the transaction state from the state management module.
4.3, the status management module returns the transaction status as [ in request buffer ].
And 4.4, the message processing module acquires the lease corresponding to the transaction from the lease management module.
4.5, the message processing module forwards the transaction request to a business service system.
And 4.6, the message processing module informs the state management module of the unique transaction identifier and the state of the business service system, and the state management module records the unique transaction identifier and the state of the business service system.
4.7, the business service system processes the transaction business and returns a transaction response message to the message processing module.
And 4.8, the message processing module sends the transaction state field to the client.
And 4.9, after receiving the state field, the client side initiates a checking request to the message processing module, wherein the checking request comprises the unique identifier of the corresponding transaction.
And 4.10, the message processing module responds to the checking request and inquires the transaction state from the state management module, and the state management module inquires that the transaction state is [ the called service system ] according to the unique identifier and returns.
4.11, the message processing module forwards the transaction verification request of the client to the service system, the service system finds out the corresponding actual transaction data through the unique identifier and returns a transaction state field to the message processing module, and the transaction state field is in a [ success ] or [ failure ] state.
4.12, the message processing module returns the verification response message received from the business service system to the client.
Note that: the same response would be if steps 4.8-4.12 occurred between steps 4.4 and 4.5.
Referring to fig. 6, a timing diagram of transaction processing when a module is abnormal according to an embodiment of the present invention is shown. Which comprises the following steps:
and 5.1, the client sends a transaction request to the message processing module. The transaction request is a recharge request.
And 5.2, when the lease management module fails and is unavailable, the message processing module directly informs the state management module of the state of the transaction registration request, and records the state as the [ invoked service system ].
And 5.3, the message processing module forwards the transaction request to a business service system.
And 5.4, the business service system returns a transaction response message to the message processing module, if the system is overloaded at the moment, the response contains system busy information, and if the system is normal at the moment, the response contains recharging success or failure state information.
And 5.5, the message processing module sends the transaction response message to the client.
5.6, a new transaction request is sent to the message processing module.
5.7, the lease management module and the state management module are not available, and the message processing module directly forwards the transaction request to the business service system.
And 5.8, the business service system processes the transaction business and returns a transaction business response.
5.9, the message processing module forwards the transaction status field to the client.
And 5.10, after receiving the state field, the client side initiates a checking request to the message processing module, wherein the checking request comprises the unique identifier of the corresponding transaction.
And 5.11, the message processing module forwards the checking request to the business service system.
5.12, the business service system searches the transaction record according to the unique identifier and returns a transaction state field.
5.13, the message processing module forwards the transaction status field to the client.
5.14, the client sends a new transaction request to the message processing module, and the message transmission is greatly delayed due to network failure.
5.15, the client judges the transaction request is overtime and immediately initiates a transaction checking request.
5.16, the transaction state management module is unavailable, and the message processing module directly forwards the checking request to the business service system.
5.17, if the business service system can not find the transaction record corresponding to the serial number, returning to the transaction state field, wherein the value of the transaction state field is [ checking no transaction record ].
5.18, the message processing module forwards the transaction status field to the client, and the client records the transaction as a failure status.
5.19, when the recharging request of step 5.13 reaches the message processing module, the message processing module directly forwards the transaction request to the service system for normal processing.
5.20, the business service system successfully transacts and returns a transaction status field.
5.21, the message processing module forwards the transaction status field to the client, and because the client is overtime, the message processing module cannot transmit the transaction status field to the client, and at this time, the transaction is in different states between the client and the service system, which causes error account and abnormal report.
In summary, the beneficial effects of the invention include: by integrating fair queuing logic into the processing of transaction requests, excess requests are allowed to be buffered under certain timeliness and total capacity, and smooth transmission is performed according to the maximum throughput of a business service system at the back end of the gateway. Meanwhile, in order to avoid data loss of two communication parties caused by sending later and arriving first, a virtual processing state in a period of time is established for the transaction in the checking type, so that the condition that the transaction does not exist when the checking request is directly returned before the transaction request arriving later is received is ensured, and the service can be normally carried out as long as the transaction request arriving later reaches the service end in the period of time.
The invention reads and writes lease information and transaction state information according to transaction dimension by utilizing the consistency and reliability of distributed storage, instructs the gateway to buffer/send the received transaction request to a service system, and returns a correct transaction state to the checking request. The invention protects a fragile service system, improves the overall message throughput, reduces the probability of service rejection when surge occurs, avoids the desynchronization of transaction states of both communication parties caused by the first transmission after transaction and verification due to network jitter, and can still keep the system with the minimum function when partial modules are in failure by the modularized design of the service end, thereby maintaining the gateway forwarding capability of the core. On the whole, the invention can reduce the peak period response failure rate of the business service system and the probability of the data loss from the sending to the sending first due to the network jitter, and improve the reliability of the service.
It should be understood that the integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The technical scope of the present invention is not limited to the above description, and those skilled in the art can make various changes and modifications to the above-described embodiments without departing from the technical spirit of the present invention, and such changes and modifications should fall within the protective scope of the present invention.

Claims (9)

1. A distributed gateway system is interactively arranged between a client and a business service system, and is characterized by comprising:
the message processing module records the checking transaction association relation corresponding to each transaction and configures a response information template according to the style of the business service system, wherein the response information template comprises transaction state fields with the values of [ processing ], [ processing failure ] and [ checking no transaction ];
the lease management module is responsible for providing leases to the message processing module and managing the number of issued leases, waiting time and holding time limit;
the state management module comprises a transaction state storage unit and a transaction message storage unit, wherein the transaction state storage unit is used for recording a temporary transaction acceptance state in a time period between receipt of a transaction request and return of a response and recording a temporary virtual transaction acceptance state when a checking request is received but relevant transaction data is not found, and the transaction message storage unit is used for persistently storing contents of the transaction request and the returned response message after a gateway successfully acquires a lease or the waiting time is overtime;
wherein the transaction states include [ request in buffering ], [ invoked service system ], and [ buffering failed ]; preferentially judging according to the temporary transaction acceptance state in the transaction state storage unit, if a record is found, representing that the transaction is buffered at present and is being processed, and showing the transaction as [ in request buffering ] to the client; if no record is checked, further checking whether a record transaction request exists in the transaction message storage unit, and if so, displaying the record transaction request as a [ called service system ] to the client; if not, checking whether a virtual transaction acceptance state of the transaction is reserved in the transaction state storage unit, if not, immediately creating a record in the transaction state storage unit, and showing the record as [ request buffer ] to the client; and if the virtual transaction acceptance state is checked, checking whether the creating time exceeds the preset transaction time limit from the current time, if so, displaying [ buffer failure ] to the client, and if not, displaying [ request in buffer ].
2. The distributed gateway system of claim 1, wherein said managing the number of issues, wait time, and hold time limits for said lease comprises:
the method ensures that leases are issued according to a first-come-first-come fair sequence, and the leases issued at the same time do not exceed a preset number, so that excessive requests can be directly rejected;
controlling the upper limit of the waiting time of each transaction lease, and after the transaction lease is overtime, the message processing module gives up waiting and returns a response message of overtime system processing to the client;
and the lease of each transaction type is provided with a maximum holding time limit, and if the lease held by the message processing module is overtime and is not returned, the lease appointment is regenerated in the lease management module.
3. The distributed gateway system of claim 1, wherein the business service system is responsible for processing transaction requests forwarded by the gateway system and generating response messages back to the gateway system according to business logic.
4. The distributed gateway system of claim 1, wherein when the lease management module is unavailable, all transaction requests are immediately forwarded to the business service system, the queue buffering function is degraded to no buffering, but the back-to-front prevention function is still available;
when the state management module is unavailable, all transaction requests and response messages are not subjected to state maintenance, related checking requests are directly routed to a service system, and when the condition that the transaction requests are sent later and arrive first is found, and the transaction requests buffered in a queue are checked, a transaction state field with the value of [ checking no transaction ] is returned, the whole system is degraded into a synchronous request response mode, but the buffering function is still available;
when the lease management module and the state management module are both unavailable, the whole system is degraded into a synchronous forwarding gateway mode, buffering is not performed, and the processing and then forwarding can not be performed.
5. A transaction processing method for a distributed gateway system according to any one of claims 1 to 4, comprising the steps of:
the client sends a transaction request to a message processing module;
the message processing module responds to the transaction request and inquires the transaction state from the state management module;
the state management module returns a transaction state of [ request in buffer ];
the message processing module tries to acquire a lease to the lease management module, all the leases are issued at the moment, and queue buffering is carried out;
the message processing module returns a preset transaction state field with a value of [ processing ] to the client;
after receiving the transaction state field, the client initiates a verification request to a message processing module, wherein the verification request comprises a unique identifier of the corresponding transaction;
the message processing module responds to the checking request, inquires the transaction state from the state management module, and the state management module inquires that the transaction state is [ in request buffer ] according to the unique identifier and returns;
the message processing module returns a preset transaction state field with a value of [ processing ] to the client according to the response information template;
before waiting for the timeout, the message processing module releases the lease and distributes the lease to the current transaction;
the message processing module forwards the transaction request to a business service system;
the business service system processes the transaction request and returns a transaction response message to the message processing module;
and the message processing module sends the transaction response message to the client.
6. A transaction processing method for a distributed gateway system according to any one of claims 1 to 4, comprising the steps of:
the client sends a transaction request to a message processing module;
the message processing module responds to the transaction request and inquires the transaction state from the state management module;
the state management module returns a transaction state of [ request in buffer ];
the message processing module tries to acquire a lease from the lease management module, and the transaction quantity of the buffer queue reaches the upper limit at the moment;
the message processing module returns a preset transaction state field with a value of [ processing failure ] to the client;
the message processing module informs a state management module of transaction request buffering failure, and the state management module records a unique identifier of the transaction request and a corresponding [ buffering failure ] transaction state;
after receiving the transaction state field, the client initiates a checking request to a message processing module, wherein the checking request comprises a unique identifier of the corresponding transaction;
the message processing module responds to the checking request, inquires the transaction state from the state management module, and the state management module inquires that the transaction state is [ buffer failure ] according to the unique identifier and returns;
and the message processing module returns a preset transaction state field with a value of [ processing failure ] to the client according to the response information template.
7. A transaction processing method for a distributed gateway system according to any one of claims 1 to 4, comprising the steps of:
the client sends a transaction request to a message processing module, and the transaction request is transmitted to a network delay;
if the client does not obtain a response within the set time, initiating a transaction verification request;
the message processing module receives a transaction checking request when the network is recovered to be normal, and inquires a corresponding transaction state from the state management module according to the unique identifier;
if the state management module fails to inquire the transaction record and the verification record, a virtual transaction state [ in request buffer ] corresponding to the unique identifier is created, and a state is returned to the message processing module;
the message processing module returns a preset transaction state field with a value of [ processing ] to the client;
after receiving the transaction state field, the client initiates a transaction checking request again after a period of time;
the message processing module responds to the checking request and inquires the transaction state from the state management module;
the state management module inquires that the transaction state is [ buffer failure ] according to the unique identifier and returns the transaction state to the message processing module;
the message processing module returns a preset transaction state field with a value of [ processing failure ] to the client according to the response information template;
the message processing module receives the delayed transaction request and inquires the transaction state from the state management module;
the state management module returns that the transaction state is [ buffer failure ];
and the message processing module returns a preset transaction state field with a value of [ processing failure ] to the client according to the response information template.
8. A transaction processing method for a distributed gateway system according to any one of claims 1 to 4, comprising the steps of:
the client sends a transaction request to a message processing module;
the message processing module responds to the transaction request and inquires the transaction state from the state management module;
the state management module returns a transaction state of [ request buffer ];
the message processing module acquires a lease corresponding to the transaction from a lease management module;
the message processing module forwards the transaction request to a business service system;
the message processing module informs a state management module of the unique transaction identifier and the state of the business service system, and the state management module records the unique transaction identifier and the state of the business service system;
the business service system processes the transaction business and returns a transaction response message to the message processing module;
the message processing module sends a transaction response message to the client;
after receiving the transaction response message, the client initiates a verification request to the message processing module, wherein the verification request comprises a unique identifier of the corresponding transaction;
the message processing module responds to the checking request, inquires the transaction state from the state management module, and the state management module inquires that the transaction state is [ a used service system ] according to the unique identifier and returns;
the message processing module forwards a checking request of a client to a business service system, the business service system finds corresponding actual transaction data through the unique identifier and returns a transaction checking response message to the message processing module, and the transaction checking response message comprises a transaction state field with a value of success or failure;
and the message processing module returns a transaction verification response message received from the business service system to the client.
9. A transaction processing method for a distributed gateway system according to any one of claims 1 to 4, comprising the steps of:
the client sends a transaction request to a message processing module;
when the lease management module fails and is unavailable, the message processing module directly informs the state management module of the state of the transaction registration request, and records the state as a called service system;
the message processing module forwards the transaction request to a business service system;
the business service system returns a transaction response message to the message processing module, if the system is overloaded at the moment, the response contains system busy information, and if the system is normal at the moment, the response contains recharging success or failure state information;
the message processing module sends a transaction response message to the client;
a new transaction request is sent to the message processing module;
the lease management module and the state management module are unavailable, and the message processing module directly forwards the transaction request to a service system;
the business service system processes the transaction business and returns a transaction business response;
the message processing module forwards the transaction state field to the client;
after receiving the state field, the client initiates a checking request to a message processing module, wherein the checking request comprises a unique identifier of the corresponding transaction;
the message processing module forwards the checking request to a service system;
the business service system searches a transaction record according to the unique identifier and returns a transaction state field;
the message processing module forwards the transaction state field to the client;
the client newly sends a transaction request to the message processing module, and message transmission is greatly delayed due to network failure;
the client judges that the transaction request is overtime and immediately initiates a transaction checking request;
the transaction state management module is unavailable, and the message processing module directly forwards the checking request to the service system;
if the business service system can not find the transaction record corresponding to the serial number, returning a transaction state field as [ checking no transaction record ];
the message processing module forwards the transaction state field to a client, and the client records the transaction as a failure state;
when the transaction request reaches the message processing module, the message processing module directly forwards the transaction request to a service system for normal processing;
the business service system successfully transacts and returns a transaction state field;
the message processing module forwards the transaction state field to the client, and because the client is overtime, the message processing module cannot transmit the transaction state field to the client, and at the moment, the transaction is in different states between the client and the service system, and an exception is reported.
CN202211672977.9A 2022-12-26 2022-12-26 Distributed gateway system and transaction processing method thereof Active CN115665175B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211672977.9A CN115665175B (en) 2022-12-26 2022-12-26 Distributed gateway system and transaction processing method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211672977.9A CN115665175B (en) 2022-12-26 2022-12-26 Distributed gateway system and transaction processing method thereof

Publications (2)

Publication Number Publication Date
CN115665175A CN115665175A (en) 2023-01-31
CN115665175B true CN115665175B (en) 2023-03-31

Family

ID=85022709

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211672977.9A Active CN115665175B (en) 2022-12-26 2022-12-26 Distributed gateway system and transaction processing method thereof

Country Status (1)

Country Link
CN (1) CN115665175B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114066476A (en) * 2021-11-30 2022-02-18 武汉众邦银行股份有限公司 Method, device and storage medium for solving issue-first issue of distributed application transaction

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112383486A (en) * 2020-11-05 2021-02-19 北京同有飞骥科技股份有限公司 Lease-based distributed object storage service quality assurance method and system
CN114037535A (en) * 2021-11-16 2022-02-11 中国农业银行股份有限公司深圳市分行 Financial transaction exception handling method, system and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9635135B1 (en) * 2008-04-21 2017-04-25 United Services Automobile Association (Usaa) Systems and methods for handling replies to transaction requests
CN111752970B (en) * 2020-06-26 2024-01-30 武汉众邦银行股份有限公司 Distributed query service response method based on cache and storage medium
CN112905556B (en) * 2021-02-09 2022-11-15 山东英信计算机技术有限公司 Directory lease management method, device, equipment and storage medium for distributed system
CN114066476A (en) * 2021-11-30 2022-02-18 武汉众邦银行股份有限公司 Method, device and storage medium for solving issue-first issue of distributed application transaction

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112383486A (en) * 2020-11-05 2021-02-19 北京同有飞骥科技股份有限公司 Lease-based distributed object storage service quality assurance method and system
CN114037535A (en) * 2021-11-16 2022-02-11 中国农业银行股份有限公司深圳市分行 Financial transaction exception handling method, system and storage medium

Also Published As

Publication number Publication date
CN115665175A (en) 2023-01-31

Similar Documents

Publication Publication Date Title
US10601754B2 (en) Message delivery system using message metadata
AU2021200535B2 (en) Exactly-once transaction semantics for fault tolerant FPGA based transaction systems
US6889244B1 (en) Method and apparatus for passing messages using a fault tolerant storage system
KR100725066B1 (en) A system server for data communication with multiple clients and a data processing method
RU2363040C2 (en) Message delivery between two terminal points with configurable warranties and features
US20040205770A1 (en) Duplicate message elimination system for a message broker
US7734782B2 (en) Method and system for controlling computer in system
CN115665175B (en) Distributed gateway system and transaction processing method thereof
CN105338086A (en) Distributed message forwarding method
EP2335153B1 (en) Queue manager and method of managing queues in an asynchronous messaging system
US20060200456A1 (en) System, method and circuit for responding to a client data service request
US7395314B2 (en) Systems and methods for governing the performance of high volume electronic mail delivery
US20030158883A1 (en) Message processing
EP1177670B1 (en) File transfer system and method
US20060155894A1 (en) Asynchronous messaging in storage area network
CN116633875B (en) Time order-preserving scheduling method for multi-service coupling concurrent communication
EP2979196B1 (en) System and method for network provisioning
US7924844B1 (en) System and method for communicating messages among components in a computing environment
CN112632093A (en) Work order processing method, device, system, storage medium and program product
CN111339059A (en) NAS storage system based on distributed storage system Ceph
CN113254226B (en) Asymmetric distributed lock system for asymmetric service scene and implementation method
CN116402510B (en) Non-inductive payment method, medium and equipment based on high concurrency network service
CN116483920A (en) Data synchronization method, system and data center
CN117768855A (en) Short message sending method, device, equipment and storage medium
CN114095487A (en) Remote task execution method and device and storage medium

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
GR01 Patent grant
GR01 Patent grant