6 Replies Latest reply on Jun 26, 2015 2:18 PM by Yu Zhang

    Does JMS HornetQ Server close a blocking REST API call after 20 secs when there's no message to write on a topic ?

    Yu Zhang Newbie

      We have a JBOSS AS 7 server + hornetQ as our server. We do have an application running in that environment.

      Our client is a .NET client. The client will create a http request (msg consume next) periodically.

       

      In a steady state, which means there is no update messages in a topic, an httpRequest.GetResponse() will have a "server unavailable" exception every 20s.

      That exception means server does not have any data in that topic.

       

      Here is the code:

      XXXHttpStream httpStream = new XXXHttpStream(new Uri(pURI), requestMethod);

      httpStream.Request.Timeout = 40000; // this is the timeout we want to have

      // set the headers

      ...

      httpStream.Open()

       

      XXXHttpStream is our self defined class

      public class XXXHttpStream : Stream {

           private WebResponse m_response;

           private Stream m_stream;

           public XXXHttpStream(Uri uri, RequestMethod requestMethod)    

           {

                  m_request = (HttpWebRequest)WebRequest.Create(uri);

                  m_request.Method = requestMethod.ToString().ToUpper();

                  m_request.KeepAlive = false;

                  m_request.Proxy = null;

           }

           public HttpWebRequest Request

             {

             get { return m_request; }

           }

            public WebResponse Response

             {

             get { return m_response; }

           }

          // here is the open function

           public XXXHttpStream Open()

           {           

                  m_response = m_request.GetResponse();          

                  m_stream = m_response.GetResponseStream();

                  return this;

           }

      }

       

      Under steady state, the m_request.GetResponse will throw an "server unavailable" exception in every 20s, although we have a 40s timeout settings. And the response headers contains "msg-consume-next". This is not under our expectation since the timeout is set to 40s, where does that 20s come from?

      But under a working state, if we create a very large message and the total GetResponse time cost more than 40s, we will have a timeout exception and this is under our expectation.

       

      So we are guessing there should be a timeout setting when there is not date to write on the server side.

       

      Is there any settings to set that 20s? And where can we find it?

       

       

      Thank you.