Requests are sent in the wrong order or too fast?

hey guys. i have a question with java spring app. right now i have this situation: I have cron job that sends request to the bank (gwService.sendCurrentDayStatementRequest()). this request does a call to /account-statements endpoint. then bank does some stuff, and later i can make requests to get my statement. then im calling gwService.getBankStatementResponse() which calls /message endpoint. and finally i call gwService.deleteBankStatement() which deletes the statement from /messages endpoint. its like a queue type of thing.
@Scheduled(cron = "${currentDayStatementCron}")
public void sendCurrentDayStatementRequestScheduled(){
gwService.sendCurrentDayStatementRequest();
}
@Scheduled(cron = "${currentDayStatementCron}")
public void importStatementScheduled(){
importStatement();
}
public void importStatement(){
for (BankAccount bankAccount : bankAccountConfig.getBankAccounts()) {
ResponseEntity<String> accountStatementResponse = gwService.getBankStatementResponse();
if (accountStatementResponse.getStatusCode().value() == 200) {
//some code
gwService.deleteBankStatement();
//some other code
}
}
}
@Scheduled(cron = "${currentDayStatementCron}")
public void sendCurrentDayStatementRequestScheduled(){
gwService.sendCurrentDayStatementRequest();
}
@Scheduled(cron = "${currentDayStatementCron}")
public void importStatementScheduled(){
importStatement();
}
public void importStatement(){
for (BankAccount bankAccount : bankAccountConfig.getBankAccounts()) {
ResponseEntity<String> accountStatementResponse = gwService.getBankStatementResponse();
if (accountStatementResponse.getStatusCode().value() == 200) {
//some code
gwService.deleteBankStatement();
//some other code
}
}
}
but i noticed that it doesnt work as it should. the bank support told me this:
Seems like you send delete message at the same time you send new request. Check the table bellow. Something is off with your delete message implementation. Message is not yet deleted wen you are requesting new statement.
Request ID IN OUT Delete (received)
876627de39ae47369e5a2fe5697eb947 17:00:02 17:00:05 17:25:00
382bab0f14244816b1dab371d69efb8a 17:25:00 17:25:03 21:00:00
9f542a0a697a48b58af682e5e78d0532 21:00:02 21:00:04
Seems like you send delete message at the same time you send new request. Check the table bellow. Something is off with your delete message implementation. Message is not yet deleted wen you are requesting new statement.
Request ID IN OUT Delete (received)
876627de39ae47369e5a2fe5697eb947 17:00:02 17:00:05 17:25:00
382bab0f14244816b1dab371d69efb8a 17:25:00 17:25:03 21:00:00
9f542a0a697a48b58af682e5e78d0532 21:00:02 21:00:04
what can be the causes of this? i tried having two separate cron jobs for creating statement and importing it (with 10 minutes apart), but the issue persists. would it be a good idea to delay gwService.deleteBankStatement() call? does anybody have any ideas?
1 Reply
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @bambizas19! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?