salvin francis wrote:The implementation can be a simple daemon thread running continuously in the background checking for a fresh file.
When a file is found, it can trigger an event in your code to process the file.
salvin francis wrote:
Assuming that the files have no relation with each other, a separate thread can be spawned to process each file. You can use a thread pool to reuse the threads. Your routine to read the file can depend on what constitutes a single transaction, whether it's one line per transaction or some kind of separator that separates one transaction from another. A file's read speed will depend on how fast the IO supports reading from the disk or solid state device.
salvin francis wrote:On a side note, if this system is being designed right now, don't you think it's better to use the latest java version ? Java 7 was released on 2011 and its last update was in 2014.
Vaibhav Gargs wrote:BTW, do we have some better feature in JDK8 for such problems?
Vaibhav Gargs wrote: ...Each record has a header & trailer record and in between, there can be N number of txns. So, not sure how can we solve this problem that we will read complete record using buffer and not an incomplete one....
salvin francis wrote:...yes, you can read about it here: https://docs.oracle.com/javase/tutorial/essential/io/fileio.html..
Consider Paul's rocket mass heater. |