We have a system that receive payment information for invoices from the bank system. It works like that:
- Invoice is created in our system
- Payer pays for the invoice from system of Bank
- Bank connects to our system and obtain information on invoice
- Our system returns the invoice details
- Bank system go through payment process, and sends details of the payment to our system and it will wait for for confirm message 30 seconds. 6. If the bank system does not receive confirm message within 30 seconds, bank cancels the payment but does not inform our system about cancellation.
- Our system receives the payment info, and saves the payment. Then sends the confirm message to bank. But sometimes, because of network or system issue, confirm message won't be delivered within 30 seconds and we became unaware of cancelled message status.
Message exchange is through SOAP protocol. And bank does not change their system like to inform us about the issue but they provided a method to check payment status by payment id.
I have developed a solution which check each payment after 30 seconds if the payment is successful. Tasks are executed separate threads using thread pool of Spring framework. But I am afraid that it is not the best solution as there is a risk of being full of thread pool when network failure happens.
What solutions would you recommend? Can we use RabbitMQ for this issue?