We are developing the following customization:
Webapp rails allow users to make requests for tasks that are passed to the Scala backend for completion, which can take up to 10 seconds or more. While this is happening, the page that the user used for the request periodically exchanges rails using AJAX to find out if the task is completed, and if so returns the result.
From the user's point of view, the request is synchronous, except that their browser does not freeze and they get a nice direct thing.
The input required for the backend is large and has a complex structure, as is the output. My initial plan was to just have two applications sharing the same database (this would be MongoDB), so the rails application could just write the identifier to the "jobs" table, which would be captured by the Scala backend, acting as a daemon, but the more I think about it, the more I worry that there may be many potential errors in this approach.
The two things that concern me the most are duplicating model code in two different languages that need to be synchronized, and the complexity of working with this when deploying. What other potential issues should I consider when evaluating this approach?
Some other features I'm looking at are 1) creating a Scala backend of a RESTful service, or 2) implementing a message queue. However, I am not completely convinced that both options will require more development work, and it seems to me that in both cases the model code is effectively duplicated in any case either as part of the RESTful API or as a message for the queue message - am I mistaken? If one of these options is better, what is a good way to get closer to it?
source
share