-
1. Re: Does JMS HornetQ Server close a blocking REST API call after 20 secs when there's no message to write on a topic ?
jbertram Jun 26, 2015 10:15 AM (in response to zy66543)Rather than pasting .NET code for the calls you're making can you paste the actual text of the HTTP request/response conversation where you observe the unexpected behavior? That would be much more helpful.
-
2. Re: Does JMS HornetQ Server close a blocking REST API call after 20 secs when there's no message to write on a topic ?
zy66543 Jun 26, 2015 12:54 PM (in response to jbertram)Hi Justin,
First, thank you for the reply.
Here is the request uri:
https://<server host name>/hornet-msg/topics/jms.topic.<product name>.data/pull-subscriptions/auto-ack/1435336636547-1-jms.topic.<productname>.data/consume-next-1
Here is the response uri if there is data update in that topic, the client can receive the response:
https://<server host name>/hornet-msg/topics/jms.topic.<product name>.data/pull-subscriptions/auto-ack/1435336636547-1-jms.topic.<productname>.data/consume-next-1
which is the same as the above
Here is the the exception if there is no data update in that topic after 20s (starting from the request is created)
The remote server returned an error: (503) Server Unavailable.
System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
at System.Net.HttpWebRequest.GetResponse()
Thank you
-
3. Re: Does JMS HornetQ Server close a blocking REST API call after 20 secs when there's no message to write on a topic ?
jbertram Jun 26, 2015 1:13 PM (in response to zy66543)I'm not talking about just the URIs you're using. I'm talking about the full text of the HTTP requests and responses that make up the client/server conversation when you observe the unexpected behavior. See Wikipedia for an example of this.
-
4. Re: Does JMS HornetQ Server close a blocking REST API call after 20 secs when there's no message to write on a topic ?
zy66543 Jun 26, 2015 1:35 PM (in response to jbertram)OK. Anyways, I found the reason.
I checked hornetQ source code, in "QueueConsumer", it has a function
public synchronized Response poll(@HeaderParam(Constants.WAIT_HEADER) @DefaultValue("0") long wait,
@PathParam("index") long index,
@Context UriInfo info)
{
if (closed)
{
UriBuilder builder = info.getBaseUriBuilder();
builder.path(info.getMatchedURIs().get(1))
.path("consume-next");
String uri = builder.build().toString();
// redirect to another consume-next
return Response.status(307).location(URI.create(uri)).build();
}
return checkIndexAndPoll(wait, info, info.getMatchedURIs().get(1), index);
}
That long wait is passed to the server in the request header. I changed the header parameter to 15s, and I saw the difference. And I did more testing and see that is really the key. Now I am convinced.
Thank you very much for the help!
-
5. Re: Does JMS HornetQ Server close a blocking REST API call after 20 secs when there's no message to write on a topic ?
jbertram Jun 26, 2015 1:45 PM (in response to zy66543)1 of 1 people found this helpfulThat long wait is passed to the server in the request header.
Yes, of course. This fact is discussed in the documentation.
My point in asking for the actual HTTP request/response conversation was to see if your .NET API calls were actually setting the header appropriately (which apparently it wasn't).
-
6. Re: Does JMS HornetQ Server close a blocking REST API call after 20 secs when there's no message to write on a topic ?
zy66543 Jun 26, 2015 2:18 PM (in response to jbertram)Hi Justin,
As you recommended I dig a little bit at our client code, I found that we setup that as 20s. So I removed my code to change the headers. I directly changed the old code from 20s to 15s, it works!
Thank you very much! And that documentation is really helpful for understanding it.