This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

How JMS can be used in this scenario  RSS feed

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't used JMS before and hence trying to understand its usage in the following scenario.

I've a springboot webapp. It's WAR is deployed on the RHEL server. Client side is HTML,CSS and JavaScript.

Scenario Description:

There is a download button on the UI. When a user clicks on it, I might want it to save it in CSV or XSLS format on the RHEL server. The problem is that this download could take one or two days starting from the time user hits download button. In this scenario, I might want to display the user a message that they would need to come back after 1 day or whenever that download completes so that they could see the downloaded results.I am planning to display these downloaded results on the UI once the download is finished and file is saved somewhere on the RHEL server.


1) In order to use JMS here, do I need to setup ActiveMQ on the tomcat 8 server that I am using on the RHEL server?

2) How can I use it with my spring boot application with my web service that I am already using ?

2) How JMS messaging works, is it going to send messages via email to the user? If yes, then, do I need to have SMTP configured on my RHEL server which could be used by JMS?

3) Since the download is going to take long time, is there something in the JMS that would precompute the time in advance so that user would see the message as soon as a button is clicked? I mean is user going to see how long it is going to take OR the sole purpose of sending a message to the user after the process is completed is to avoid this per-computing step?

4)I guess saving the huge file in CSV or XSLS format once the download is completed has nothing to do with JMS, right? I mean, JMS won't have any functionality to handle these things, right?

Let me know if I can answer qny question. Thanks !
 
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not clear what are you hoping that JMS will do in this scenario/use-case.

Also, when you say download, do you mean transferring from client (browser?) to server, or server to client?

 
Jack Tauson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:It's not clear what are you hoping that JMS will do in this scenario/use-case.

Also, when you say download, do you mean transferring from client (browser?) to server, or server to client?



Yes, when I say download, I mean  transferring from client (browser) to server.  Please let me know if I can answer more questions. Thanks
 
Ron McLeod
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jack Tauson wrote:.. I say download, I mean  transferring from client (browser) to server.


Ok - that is normally referred to as upload.

Jack Tauson wrote:Please let me know if I can answer more questions.


What are you hoping that JMS will do in this scenario/use-case?
 
Jack Tauson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Jack Tauson wrote:.. I say download, I mean  transferring from client (browser) to server.


Ok - that is normally referred to as upload.

Jack Tauson wrote:Please let me know if I can answer more questions.


What are you hoping that JMS will do in this scenario/use-case?



So, when a user hits the download button, since the download is going to take long time, how JMS will come into play in this scenario. I am trying to understand this. I was hoping that there would be some pre computing step within JMS and that will send message to the user letting them know how long it's going to
take for download? Secondly, how does messages reach user, via email or via browser, UI?
 
Ron McLeod
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JMS is an interface to a message queue which provides an loosely-coupled asynchronous mechanism for communications between applications or software components.  Providers (senders) place messages in a queue, and consumers (receivers) take messages from the queue.  JMS doesn't perform any kind of calculations/computing, and does not itself support SMTP (email) or HTTP (browser) protocols.

I don't see it can help with providing the user an hint at the amount of time it will take to complete the upload the file, or provide an indication of the progress of the upload.

Probably the best approach would be to solve this with client-side scripting, using a framework/library such as jQuery or Bootstrap.
 
Jack Tauson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:JMS is an interface to a message queue which provides an loosely-coupled asynchronous mechanism for communications between applications or software components.  Providers (senders) place messages in a queue, and consumers (receivers) take messages from the queue.  JMS doesn't perform any kind of calculations/computing, and does not itself support SMTP (email) or HTTP (browser) protocols.

I don't see it can help with providing the user an hint at the amount of time it will take to complete the upload the file, or provide an indication of the progress of the upload.

Probably the best approach would be to solve this with client-side scripting, using a framework/library such as jQuery or Bootstrap.



Thank you for your valuable inputs. Do you think that JMS could be useful in the context of my situation discussed above, provided that I am handling the upload of the file using jQuery or Bootstrap? I am trying to understand how it could communicate between applications internally, maybe in my scenario.
 
Jack Tauson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jack Tauson wrote:

Ron McLeod wrote:JMS is an interface to a message queue which provides an loosely-coupled asynchronous mechanism for communications between applications or software components.  Providers (senders) place messages in a queue, and consumers (receivers) take messages from the queue.  JMS doesn't perform any kind of calculations/computing, and does not itself support SMTP (email) or HTTP (browser) protocols.

I don't see it can help with providing the user an hint at the amount of time it will take to complete the upload the file, or provide an indication of the progress of the upload.

Probably the best approach would be to solve this with client-side scripting, using a framework/library such as jQuery or Bootstrap.



Thank you for your valuable inputs. Do you think that JMS could be useful in the context of my situation discussed above, provided that I am handling the upload of the file using jQuery or Bootstrap? I am trying to understand how it could communicate between applications internally, maybe in my scenario.



Also, JMS can't be used for scheduling a SQL query which is going to take one day or two,right?
 
Marshal
Posts: 24188
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jack Tauson wrote:Also, JMS can't be used for scheduling a SQL query which is going to take one day or two,right?



Well, remember that the purpose of JMS is to send messages asynchronously between software components. So certainly you could use JMS to send a message to a component which, when it receives a message, will run the query.

And certainly you could use JMS to send another message to that component to ask whether the query is finished yet. And perhaps you could also, given a suitable configuration, have that component send a message back to the other component to say Yes or No.

It isn't clear from your description what components exist on your proposed system which might support that architecture. If you were hoping that the client side of your web application would be the component which communicates via JMS to the component which runs the query, then that's unlikely to work except in very specialized situations. Perhaps the server side of the web application could be that component, but I got the impression that the client side was supposed to be getting the information about whether the query was complete or not. If that's the case then I don't see the point of using JMS on the server side.
 
Jack Tauson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Jack Tauson wrote:Also, JMS can't be used for scheduling a SQL query which is going to take one day or two,right?



Well, remember that the purpose of JMS is to send messages asynchronously between software components. So certainly you could use JMS to send a message to a component which, when it receives a message, will run the query.

And certainly you could use JMS to send another message to that component to ask whether the query is finished yet. And perhaps you could also, given a suitable configuration, have that component send a message back to the other component to say Yes or No.

It isn't clear from your description what components exist on your proposed system which might support that architecture. If you were hoping that the client side of your web application would be the component which communicates via JMS to the component which runs the query, then that's unlikely to work except in very specialized situations. Perhaps the server side of the web application could be that component, but I got the impression that the client side was supposed to be getting the information about whether the query was complete or not. If that's the case then I don't see the point of using JMS on the server side.




I am not sure if we should call this a component or not. But please correct me if something looks illogical in my explanation below as far as components are concerned:

In my spring boot app, I have my client side code as well (HTML,CSS,Javascript), and Spring based webservices related Java code. My client side code communicates with this spring based webservices and these webservices runs and gets me the data from the Oracle database in JSON format and I display
that in my UI. The way I deploy this app on my RHEL server is, I export this app in WAR from my Eclipse and then deployed it on the Apache Tomcat on RHEL server.

If I understood the definition of component properly, I have two components above, one is the client side code and another is the webservice code which is communicating with the Oracle database and getting me JSON data.

1) So, you mean to say that it would be difficult to get information regarding when the query is finished on the client side using JMS?

2) Can the query which is triggered via webservice be scheduled using JMS when a user clicks on a button in the UI? I mean let's say the webservice is going to take one or two days to finish because the query is going to take long, I am wondering if this thing can be scheduled using JMS?
 
Saloon Keeper
Posts: 5282
143
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your interest in using JMS in this scenario? It sounds if if you're looking for a way of using JMS without actually knowing exactly what JMS is for.
 
Paul Clapham
Marshal
Posts: 24188
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jack Tauson wrote:1) So, you mean to say that it would be difficult to get information regarding when the query is finished on the client side using JMS?



Yes. Configuring a web client to be a JMS recipient is something that I would only consider doing if I had a pointy-haired boss insisting on it. And even then I would do everything in my power to avoid doing it.

2) Can the query which is triggered via webservice be scheduled using JMS when a user clicks on a button in the UI? I mean let's say the webservice is going to take one or two days to finish because the query is going to take long, I am wondering if this thing can be scheduled using JMS?



As pointed out several times in this post, the purpose of JMS is to transmit messages between senders and receivers. I suppose you could imagine that "scheduling a query" is in some way equivalent to "sending a message" but the realities of JMS make that a fantasy. There's nothing to stop the receiver of a JMS message from submitting a query, though. As for the run time of that query, I have no idea why that would make any difference.
 
Paul Clapham
Marshal
Posts: 24188
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jack Tauson wrote:If I understood the definition of component properly, I have two components above, one is the client side code and another is the webservice code which is communicating with the Oracle database and getting me JSON data.



That's what I thought. So you already have the client side sending messages (via a web service) to the server side. In which case I can't understand why you want to bring in JMS, whose purpose is also to send messages.
 
Jack Tauson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Jack Tauson wrote:If I understood the definition of component properly, I have two components above, one is the client side code and another is the webservice code which is communicating with the Oracle database and getting me JSON data.



That's what I thought. So you already have the client side sending messages (via a web service) to the server side. In which case I can't understand why you want to bring in JMS, whose purpose is also to send messages.



Ok. So if I understood correctly, you are considering "calling a web service to get the JSON data" as "client side sending messages (via a web service) to the server side".I'll ask a fresh question w/o using JMS terminology so that this thread could be considered as closed.
 
Jack Tauson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Jack Tauson wrote:If I understood the definition of component properly, I have two components above, one is the client side code and another is the webservice code which is communicating with the Oracle database and getting me JSON data.



That's what I thought. So you already have the client side sending messages (via a web service) to the server side. In which case I can't understand why you want to bring in JMS, whose purpose is also to send messages.



Actually, what I am trying to figure out using JMS is the following:

Since, my SQL query is going to take long time when a user clicks on the download button, whether I could schedule this process in the JMS queue so that user interaction with other parts of the UI won't be blocked and possibly, when the SQL is finished, I could send a message to the user (via email) stating that the Query has finished or something similar?
 
Paul Clapham
Marshal
Posts: 24188
54
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jack Tauson wrote:Since, my SQL query is going to take long time when a user clicks on the download button, whether I could schedule this process in the JMS queue so that user interaction with other parts of the UI won't be blocked and possibly, when the SQL is finished, I could send a message to the user (via email) stating that the Query has finished or something similar?



That's a very relevant question. However it's usually implemented in web applications by having the server start the query and then return an immediate response saying "The query is running now", or whatever. Often that's accompanied by a scheme whereby the user can send another request and the server will say "Still not finished" or "Finished now", depending. However in your case where the query is going to run for a long time the latter part would be unnecessary, since the user is not going to be sitting there for a day or two watching the screen. In this situation it's not unusual for the server to send the user an e-mail message when the query finishes.

But you've already figured out the last part, which is the only part where sending a message is involved. So you don't need JMS for that.

You're asking about the first part, which is where the servlet (or whatever you're using to process a request) shouldn't run forever. So here's where JMS might come into the picture: you set up another server, outside the web application. That server would be set up to do nothing but receive JMS messages and process them by running a database query. In this architecture the servlet would be a JMS client which sends database query requests to that outside server, and if you want to send e-mail notifications when the database query is finished you'd have to design for that. It would be done by the JMS server, and the e-mail address might be a constant value or it might be part of the JMS message.
 
Jack Tauson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:
So here's where JMS might come into the picture: you set up another server, outside the web application. .



Thanks Paul.When you say the above,did you mean a complete new server? I mean, I am on RHEL server and my webapp is deployed on the tomcat installed on RHEL. Did you mean to have a complete new RHEL server setup just for this?

If this is not an option, do you think I could use MOM like ActiveMQ on the Tomcat or any other preference? Thanks again !
 
Tim Moores
Saloon Keeper
Posts: 5282
143
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JMS server would be server process outside of Tomcat, but it can run on the same physical machine, provided it's powerful enough for both.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!