I’m starting out with Grails and want to build a sample application.
Below is the flow of the application I’m envisioning. I’ll follow up with questions.
The flow of the app:
- User uploads a file
- controller gets the file and just sends a response back saying “uploaded”
- File is put in a JMS queue
- Java service running separately fetches the file from the queue and processes it (just reads the first word)
- Java service puts the response back (where does it put the response?)
- Grails App will read the response and present it to the user
Questions
- Where does the java service put the data after reading the file?
- How does the grails app read the data put by the java sevice?
- Is there something missing from my understanding? I plan to use grails jms plugin and ActiveMQ
- Can something be improved in this architecture? This is a prototype I’m putting together for a bigger application.
I would really appreciate any articles/tutorials on an example of a simple app like the one above…?
In you case JMS is used in a synchonous way, so it depends on your JMS provider if you can do this. If the JMS provider is able of doing synchronous communication you put the answer after the file processsing into a reply queue.
In the synchronous JMS way, the java service will wait for a response from the JMS provider so can can present the response from the service back to the controller and then to the user…
So..:
Your page could be a nice ajax page that presents the user with a processing spinner.