JMS Vs Java Pure Threads
I am building a server in J2EE environment which needs to do following tasks continously.
1. Detect files uploaded to a directory
2. Move files to a temperory working directory(FIFO order)
3. Read files and Validate records(FIFO order)
4. Read & Process files that have successfully gone through validation.(Order of processing- Priority set by business rules.)
5. Package and Move Output files to an output directory(FIFO order).
6. Send Emails.
To speed up processing I need tasks 2, 3, 4 & 5 to be done parallely with a limit on maximum number of files to be processed at a time set.
I have the luxury of utilizing a database to communicate back to main server. All database access will all be made through respecitive Entity Beans.
I have 2 options infront (May be you can suggest more).
1. Use Java Threads :
Initiate a thread (not more than x at a time) whenever 2, 3 ,5 tasks comes up.
Initiate a process(not more than x at a time) whenever task 4 comes up.
2. Use JMS :
JMS Queue PTP for tasks 2, 3, 5
JMS Topics for task 4 (This is because we have diferent types of files which has to be processed in different manner. For each type of file a seperate Topic will be created)
Note :-
A file will be of typically no more than 20MB (1,80,000 lines).
Number of files to be processed concurrently (Tasks 4) will be of the order five to eight.
My thought is like - JMS will be better in terms of maintainability and ease of design.
Performance , Reliability ?
All your suggestions are welcome to help me to decide on which method to go for.

