S
S
serp in2016-02-21 20:30:41
Data transfer
serp in, 2016-02-21 20:30:41

Transactional operations over the network how?

Actually, how to organize transactional data transfer over the network?
A banal example is an account replenishment operation.
Service A informs service B that the user on side A has replenished the account. And at this moment, with a successful operation on B, the answer for A about the success of the operation is lost over the network. A situation arises that A will try to replenish the account again, because. no response was received.
While I see this option, start the data transfer operation by opening a transaction with a timeout on B.
If the response from B to A is successful, service A sends a request to close transaction B for this operation.
With all unsuccessful operations, the transaction is simply closed by timeout.
Tell me what to google, what to read?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Melkij, 2016-02-21
@abacabb

Service A informs B that the user has replenished the account on the side of A, the number of this transaction is such and such.
Service B in response reports that the transaction has been processed, well, or about some kind of error in a strict format.
If service A does not receive such a message, then after a while it sends the message again with the same transaction number. If service B finds such a transaction in itself, it replies that the event has already been processed. If it does not find it, it processes it normally as a new transaction.
Service A sets the operation status "completed" only after receiving a response from B, while there is no response - the service status is "processing"

A
AntonMZ, 2016-02-21
@AntonMZ

The transaction takes place on side A (payment aggregator. example).
After performing the operation at home, it sends data to B.
If B does not respond, then A queues the sending of data to B and repeats this operation until an OK is received from B.

A
Alexander Kubintsev, 2016-02-21
@akubintsev

First, A sends a request to create an empty (unredeemed) transaction to B.
"B" returns the transaction ID in the response.
"A" sends a request to pay for the transaction with the received identifier.
If the answer from "B" did not reach "A", but the operation was completed, then when you try to pay for transaction "B" again, it will respond with the error "already paid".
Also, such a mechanism makes it possible for "A" to make a request about the status of the transaction to "B".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question