Results 1 to 3 of 3
  1. #1

    Handle HTTP GET request and execute Java logic

    I have requirement to allow the Lightstreamer to serve an HTTP Get request that will itself send a request to the Web Server that routes to an application server to verify connectivity and return an "OK" or "Fail" based on whether the verification is successful. It's basically for a in-house monitoring tool that will verify connectivity through out all the nodes.

    It's simple enough to handle the logic that sends the request from the Lightstreamer adapter to the web-server and app-server however, I don't see a clear solution as to how to handle the initial simple GET requests in the Java adapter? What would be the best approach to do this?

    My first thoughts are Servlets or Spring but I understand that the Lightstreamer server is not designed for this.


    Thanks.
    Last edited by mello151; June 11th, 2014 at 09:56 PM.

  2. #2
    Senior Member
    Join Date
    Feb 2013
    Posts
    54
    Hi,

    I'm not sure I've correctly understood your scenario. basically what I've understood is that you have a data adapter which connects to web servers and app servers to check connectivity and publish the results. But instead of letting the adapter perform these checks on a regular basis, you want to trigger these checks manually from outside your adapter with a http request, served by the Lightstreamer Server. Am I correct?
    In this case you may use the 'send message'. Basically your client sends a message to the Lightstreamer Server, and the server forwards this request to the MetadataAdapter on the 'notifyUserMessage' method. The Metadata Adapter then has to call your Data Adapter and forward the request to it, in order to trigger the checks.
    How to perform the 'send message' depends on the Client API you are using, but, if you are using a Presto or Vivace Edition, you may use directly a HTTP request as explained in section 4.4 'Sending Messages' of the Generic Client Network Protocol Tutorial.
    Keep in mind that you have to create a new session before sending a send_message request, since the sessionId is one of the requested parameters, so you cannot just send a single HTTP request but you have to follow the Lightstreamer network protocol as described in the document.
    According to HTTP specifications, requests to Lightstreamer Server should always be issued through the POST method, since as a general rule they cause side effects on the Server behaviour, but, for testing purposes, it may be easier to use the GET method and it will work as well (for more detail see section 2.1.2 'GET method vs. POST method' of the same document).


    I hope I've correctly addressed your question.
    Marco
    Last edited by marco.testa; June 12th, 2014 at 01:45 PM.

  3. #3
    Thanks! That's exactly the type of thing I'm looking for.

    Basically, there's an external monitoring system used by the enterprise that performs health checks and I'm looking for a way that it can send a request and verify the response back from the web server and application server.

    I'll give this a try and let you know how it works out.

    Thanks,
    Mel

 

 

Similar Threads

  1. Get http request body (raw view) from adapter
    By WorkingMan in forum General
    Replies: 1
    Last Post: September 10th, 2013, 09:49 AM
  2. How does lightstreamer handle pusing data to
    By PeterHiross in forum Client APIs
    Replies: 3
    Last Post: November 16th, 2011, 09:42 AM
  3. Replies: 3
    Last Post: September 27th, 2011, 08:56 AM
  4. Replies: 1
    Last Post: July 28th, 2010, 10:15 AM
  5. Request Refused and sync error
    By shreyaspurohit in forum Adapter APIs
    Replies: 9
    Last Post: March 31st, 2009, 10:11 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 12:39 AM.