Unable to design a solution
posted 3 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I am new to Java world. Here is my scenario:
I have to keep checking for a creation of a file of certain format say <file-name>.ppt in predefined directory. And it has to happen continuously. Once it gets created then I have to update the status in a table. Updating in a table is fine. But I don't know what is the good way to keep checking in a path for this file. The requirement is to check for the file existence continuously for 1 hour with 30 seconds of interval. Once it gets created within that time, then it is fine (where I update the table with 'COMPLETED' status). Else, it is a time out (and I will update same table with 'FAILURE').
I request forum veterans here to guide me to proceed with good way to achieve this.
I am on Java 8 and using SpringBoot
Regards,
Ranagal
I have to keep checking for a creation of a file of certain format say <file-name>.ppt in predefined directory. And it has to happen continuously. Once it gets created then I have to update the status in a table. Updating in a table is fine. But I don't know what is the good way to keep checking in a path for this file. The requirement is to check for the file existence continuously for 1 hour with 30 seconds of interval. Once it gets created within that time, then it is fine (where I update the table with 'COMPLETED' status). Else, it is a time out (and I will update same table with 'FAILURE').
I request forum veterans here to guide me to proceed with good way to achieve this.
I am on Java 8 and using SpringBoot
Regards,
Ranagal
posted 3 years ago
-
2 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
Take a look at A Guide to WatchService by baeldung and see if it helps.
posted 3 years ago
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
I would also consider whether Spring Boot is needed for such a small application. I propose not.
Tim Driven Development | Test until the fear goes away
Ranagal Adapla
Ranch Hand
Posts: 40
1
posted 3 years ago
This requirement is part of bigger application. I am just handling one of the many requirements. I just told what I am using so that experts offering solutions will know what I am using.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Tim Cooke wrote:I would also consider whether Spring Boot is needed for such a small application. I propose not.
This requirement is part of bigger application. I am just handling one of the many requirements. I just told what I am using so that experts offering solutions will know what I am using.
posted 3 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Definitely consider Ron's suggestion before trying to roll your own solution which is probably going to be inferior to WatchService.
posted 3 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Oh yea I second what Junilu says. Definitely do not try and implement your own solution when you have utilities built in such as WatchService.
Tim Driven Development | Test until the fear goes away
Ranagal Adapla
Ranch Hand
Posts: 40
1
posted 3 years ago
Thanks for guiding me in the right direction. I am considering this.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Ron McLeod wrote:Take a look at A Guide to WatchService by baeldung and see if it helps.
Thanks for guiding me in the right direction. I am considering this.
| What are you doing in my house? Get 'em tiny ad! Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |









