Menu

Streaming

Help
mattlf
2008-09-22
2013-04-22
  • mattlf

    mattlf - 2008-09-22

    Hi
    I am trying to get OpenTick to stream data
    I have the following program that is really similar to org / otfeed / sample / TickStream.java
    Note that the difference is the timeout on the waitforcompletion

    I am getting the following error:

    Connecting to: feed1.opentick.com:10015
    Connected
    Logged in
    prepare request...
    submit request...
    # Error: OTError: requestId=0, code=5000, desc=shutdown
    Connection terminated: OTError: requestId=0, code=5000, desc=shutdown

    I would appreciate some help. Thank you

    TickStreamCommand command = new TickStreamCommand();
        command.setExchangeCode("Q");
        command.setSymbolCode("MSFT");
        command.setQuoteDelegate(new IDataDelegate<OTQuote>() {
            public void onData(OTQuote data) {
                System.out.println(data);
            }
        });
        command.setTradeDelegate(new IDataDelegate<OTTrade>() {
            public void onData(OTTrade data) {
                System.out.println(data);
            }
        });
        command.setMmQuoteDelegate(new IDataDelegate<OTMMQuote>() {
            public void onData(OTMMQuote data) {
                System.out.println(data);
            }
        });
        command.setBboDelegate(new IDataDelegate<OTBBO>() {
            public void onData(OTBBO data) {
                System.out.println(data);
            }
        });

        command.setCompletionDelegate(new ICompletionDelegate() {
            public void onDataEnd(OTError error) {
                if(error != null) {
                    System.out.println("# Error: " + error);
                }
            }
        });
       
        IConnection connection = Connector.connect();
        Thread.currentThread().sleep(10000);//sleep for 1000 ms
       
        try {
                System.out.println("prepare request...");
            IRequest request = connection.prepareRequest(command);
            System.out.println("submit request...");
            request.submit();

            request.waitForCompletion(60000);

        } finally {

            connection.shutdown();
            connection.waitForCompletion(60000);
        }
       

     
    • mattlf

      mattlf - 2008-09-22

      Hi Mike,
      Any idea what could be the problem here ?
      Best
      matt

       
      • Mike Kroutikov

        Mike Kroutikov - 2008-09-22

        Matt, I have a suspicion, but will be able to confirm it only later tonight (there is a bug in waitForCompletion that can throw an exeception and cause connection to be closed). If you do not mind compiling the driver code yourself, I can suggest what to change in order to try this.

        -Mike

         
        • Mike Kroutikov

          Mike Kroutikov - 2008-09-22

          Matt, I can not reproduce the problem you described.

          I used release 0.1.3, and modified TickStream with the code you provided. I am getting succesfull retrieval of the symbol I request (Q/GOOG). Please, send me the following:

          1. exact code of the program
          2. parameters you are using (if any)
          3. which release you are using

          -Mike

           
    • mattlf

      mattlf - 2008-09-22

      Hi Mike

      I don't mind compiling the code and making a change. I will also create a small program that reproduce the issue and send it to you
      Thank you
      matt

       
      • Mike Kroutikov

        Mike Kroutikov - 2008-09-22

        Matt,

        Please, send the repro to my e-mail address (pgmmpk at gmail.com).

        Try compiling the snapshot version (download it from SVN). The bug I was talking about is fixed there, but fix did not make it into production version yet.

        If I am correct, snapshot version of driver should work.

        Thank you,
        -Mike

         
    • mattlf

      mattlf - 2008-09-23

      Hi Mike
      I just sent you a test program with the error
      Thank you!
      matt

       

Log in to post a comment.

MongoDB Logo MongoDB