activemq如何工作

I read on the ActiveMQ official page how it works, but could not understand the whole scenario how request and response is going on. As per my understanding now, if I have a servelet on server and JavaScript as client using amq.js, then

  1. JavaScript sends a poll request to server.
  2. Server starts a thread and checks for data to be sent as response.
  3. If data is not available at that time, server waits till there is any data.
  4. Server sends the data when available and then the connection breaks.
  5. Client receives the data and again send the poll request.

In this way the client request is parked at the server till the data is received.

Is this understanding correct and possible? If yes, how the request is parked at the server?

Thanks.

Yes, you understand it correctly. But with the restriction that the request will be on hold for 30 seconds, then it times out (default).

The request is parked at the server using Jetty Continuations, as Jetty is the servlet container in ActiveMQ.

Since ActiveMQ, java side, can be setup with asynchronous listeners, there does not need to be on thread blocked for the entire poll.