Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24
  1. #11
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    I have followed this only already, but when I use ; this didn't work so that I changed to ":"

    My shell script looks like
    set cpath=/home/postnammauzhavan/Lightstreamer/adapters/WINLITERemoteStockList/classes/ls-adapter-remote.jar:/home/postnammauzhavan/Lightstreamer/adapters/WINLITERemoteStockList/classes/jedis.jar:/home/postnammauzhavan/Lightstreamer/adapters/WINLITERemoteStockList/classes/gson.jar:/home/postnammauzhavan/Lightstreamer/adapters/WINLITERemoteStockList/classes/LS_quote_feed_simulator.jar
    set class=stocklist.server.ServerMain


    set command="java -cp $cpath $class -host localhost -metadata_rrport 6722 -data_rrport 6720 -data_notifport 6721"
    exec $command

    When I run this above sh file using bash linuxwinbulllite.sh & the below showing as result. There is no issues on my script to run adapter. But when I check log there is nothing showing as Accepted connection.

    [root@cloudvpsserver unix-like]# bash linuxwinbulllite.sh &
    [1] 46076
    [1]+ Done bash linuxwinbulllite.sh

    07-Jul-20 00:37:13,875|INFO |L.requests |SERVER POOLED THREAD 4 |Serving request: /lightstreamer/create_session.js --> LS_op2=create&LS_phase=5513&LS_cause=nullresp&LS_p olling=true&LS_polling_millis=0&LS_idle_millis=0&L S_cid=pcYgxn8m8 feOojyA1T661j3g2.pz479h7m&LS_adapter_set=WLSTOCKLI ST_REMOTE&LS_container=lsc& on "Lightstreamer HTTP Server" from 1.23.1.117:50020

  2. #12
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Could you add a very simple log to file in your adapters? Just to understand what is going on.

  3. #13
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    Can you please help me on this how to add log in my adapter.
    @Override
    public void subscribe(String itemName) throws SubscriptionException, FailureException {
    logger.debug("Subscribing to " + itemName);
    }
    Is this okay or I add some other things. But when I check in my log file I couldn't find the Subscribing to ​in my log file.

  4. #14
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    The log you perform in your code should be entirely managed by your code, without Lightstreamer involvement
    (although the java remote SDK also provides a very simple logging interface).
    For instance if your "logger" object is obtained with slf4j, you should provide a suitable slf4j implementation and configuration.

    However, Giuseppe's advise was to log the startup phase of the process, when the process tries to establish a connection with Lightstreamer Server, since there is no evidence of such connection.
    As log as the remote adapter process fails to connect, it won't receive any invocation of "subscribe", hence it is correct that you can't see this log.

  5. #15
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    Hello,
    Finally find out the issue, I have modified my shell script as like below,
    cpath="/home/postnammauzhavan/Lightstreamer/adapters/WINLITERemoteStockList/classes/ls-adapter-remote.jar:/home/postnammauzhavan/Lightstreamer/adapters/WINLITERemoteStockList/classes/jedis.jar:/home/postnammauzhavan/Lightstreamer/adapters/WINLITERemoteStockList/classes/gson.jar:/home/postnammauzhavan/Lightstreamer/adapters/WINLITERemoteStockList/classes/LS_quote_feed_simulator.jar"
    class="stocklist.server.ServerMain"


    command="java -cp $cpath $class -host localhost -metadata_rrport 6722 -data_rrport 6720 -data_notifport 6721"
    exec $command $
    It seems need to give values within double quote.

    Now I have an issue on getting update from redis and serve this data to subscribed items.
    I have used redis instance on ExternalFeedSimulator java class. Can you please on this where I need to create instance and where to close the redis exactly. Because of this I'm facing the issue like
    Exception in thread "Timer-0" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 12
    My code looks like below,
    import com.google.gson.Gson;
    import com.google.gson.annotations.SerializedName;
    import redis.clients.jedis.Jedis;

    public class ExternalFeedSimulator {
    private static Jedis jedis;
    private static final String redisHost = "localhost";
    private static final Integer redisPort = 6379;
    private static Gson gson = new Gson();

    public void start() {
    try {
    jedis = new Jedis(redisHost, redisPort);
    getJSON();
    long waitTime = 500;
    bidaskratescheduleGenerator(bidaskrates, waitTime);
    } catch (Exception e) { System.out.println(e);
    }
    }

    public static String getJSON() {
    try {
    liveratesnew.clear(); ClientsRateRow[] craterows = gson.fromJson(jedis.get("WLallclientsrates"), ClientsRateRow[].class);
    for (ClientsRateRow raterow : craterows) {
    liveratesnew.put(raterow.client_com_id, raterow);
    curclientrates.add(raterow);
    }
    RateRow[] cbaserates = gson.fromJson(jedis.get("WLBaseRates"), RateRow[].class);
    for (RateRow raterow : cbaserates) {
    bidaskrates.add(raterow);
    }
    } catch (IllegalStateException ex) {
    ex.printStackTrace();
    } finally {
    jedis.close();
    }
    return null;


    }

    private void bidaskratescheduleGenerator(final ArrayList<RateRow> displayrates, long waitTime) {
    dispatcher.schedule(new TimerTask() {
    @Override
    public void run() {
    long nextWaitTime;
    synchronized (displayrates) {
    if (listener != null) {
    for (RateRow curbidaskrates : displayrates) {
    final HashMap<String, String> bidaskevent = new HashMap<String, String>();
    bidaskevent.put("desc", curbidaskrates.getGold1_symbol());
    bidaskevent.put("bid", curbidaskrates.getGold1_bid());
    bidaskevent.put("ask", curbidaskrates.getGold1_ask());
    bidaskevent.put("high", curbidaskrates.getGold1_high());
    bidaskevent.put("low", curbidaskrates.getGold1_low());
    bidaskevent.put("ltp", curbidaskrates.getGold1_ltp());
    listener.onEvent(curbidaskrates.getGold1_symbol(), bidaskevent, false);
    }
    }
    displayrates.clear();
    nextWaitTime = 500;
    }
    getJSON();
    bidaskratescheduleGenerator(bidaskrates, nextWaitTime);
    }
    }, waitTime);
    }


    }
    In my php service every second will update the stock market rates into redis key as json string. In my java adapter for every 500 milliseconds i need to read and update to subscribed clients. Could you please help me on this how to do this in my adapter.
    Last edited by rvkvino; July 8th, 2020 at 08:49 AM.

  6. #16
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi,

    The error message seems not pertaining to redis but to the json parser.
    Please have a look at this https://stackoverflow.com/questions/...ine-1-column-1, maybe can help with your issue.

    Regards,
    Giuseppe

  7. #17
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    I have referred this link already,
    My actual issue comes like this first time after that only I'm facing issue on json string. If I handle this issue the above json issue not comes.

    redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Connection reset by peer: socket write error
    at redis.clients.jedis.Connection.flush(Connection.java:334)
    at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:257)
    at redis.clients.jedis.Connection.getBulkReply(Connection.java:248)
    at redis.clients.jedis.Jedis.get(Jedis.java:153)
    at stocklist.feed_simulator.ExternalFeedSimulator.getJSON(ExternalFeedSimulator.java:78)
    at stocklist.feed_simulator.ExternalFeedSimulator$1.run(ExternalFeedSimulator.java:128)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)
    Caused by: java.net.SocketException: Connection reset by peer: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(Unknown Source)
    at java.net.SocketOutputStream.write(Unknown Source)
    at redis.clients.util.RedisOutputStream.flushBuffer(RedisOutputStream.java:52)
    at redis.clients.util.RedisOutputStream.flush(RedisOutputStream.java:216)
    at redis.clients.jedis.Connection.flush(Connection.java:331)
    .
    my json looks like this only
    [
    {
    "com_id": "33",
    "com_name": "GOLD BAR",
    "selling_rate": "5001",
    "buying_rate": "-",
    "delivery": "03-07-2020",
    "retail_rate": "-",
    "com_weight": "1.000",
    "com_order": "1",
    "client": "lmxtrade",
    "client_com_id": "lmxtrade_33",
    "high_rate": "5002",
    "low_rate": "4980"
    },
    {
    "com_id": "36",
    "com_name": "GOLD FT",
    "selling_rate": "5001",
    "buying_rate": "4800",
    "delivery": "03-07-2020",
    "retail_rate": "-",
    "com_weight": "1.000",
    "com_order": "2",
    "client": "lmxtrade",
    "client_com_id": "lmxtrade_36",
    "high_rate": "5002",
    "low_rate": "4980"
    },
    {
    "com_id": "37",
    "com_name": "GOLD RTGS",
    "selling_rate": "4901",
    "buying_rate": "-",
    "delivery": "03-07-2020",
    "retail_rate": "-",
    "com_weight": "1.000",
    "com_order": "3",
    "client": "lmxtrade",
    "client_com_id": "lmxtrade_37",
    "high_rate": "4902",
    "low_rate": "4880"
    },
    {
    "com_id": "38",
    "com_name": "SILVER",
    "selling_rate": "49190",
    "buying_rate": "48463",
    "delivery": "03-07-2020",
    "retail_rate": "-",
    "com_weight": "1000.000",
    "com_order": "4",
    "client": "lmxtrade",
    "client_com_id": "lmxtrade_38",
    "high_rate": "49190",
    "low_rate": "49190"
    },
    {
    "com_id": "33",
    "com_name": "GOLD CBE RTGS ",
    "selling_rate": "5001",
    "buying_rate": "4890",
    "delivery": "07-07-2020",
    "retail_rate": "-",
    "com_weight": "1.000",
    "com_order": "1",
    "client": "kkvtrade",
    "client_com_id": "kkvtrade_33",
    "high_rate": "5002",
    "low_rate": "4980"
    },
    {
    "com_id": "36",
    "com_name": "GOLD FT",
    "selling_rate": "5001",
    "buying_rate": "4900",
    "delivery": "07-07-2020",
    "retail_rate": "-",
    "com_weight": "1.000",
    "com_order": "2",
    "client": "kkvtrade",
    "client_com_id": "kkvtrade_36",
    "high_rate": "5002",
    "low_rate": "4980"
    },
    {
    "com_id": "37",
    "com_name": "GOLD RTGS",
    "selling_rate": "4901",
    "buying_rate": "5000",
    "delivery": "07-07-2020",
    "retail_rate": "-",
    "com_weight": "1.000",
    "com_order": "3",
    "client": "kkvtrade",
    "client_com_id": "kkvtrade_37",
    "high_rate": "4902",
    "low_rate": "4880"
    },
    {
    "com_id": "38",
    "com_name": "SILVER",
    "selling_rate": "50369",
    "buying_rate": "50354",
    "delivery": "07-07-2020",
    "retail_rate": "-",
    "com_weight": "1000.000",
    "com_order": "4",
    "client": "kkvtrade",
    "client_com_id": "kkvtrade_38",
    "high_rate": "50400",
    "low_rate": "50008"
    }
    ]
    This above json i'm parsing using the class,(Array of object)
    ClientsRateRow[] craterows = gson.fromJson(jedis.get("WLallclientsrates"), ClientsRateRow[].class);
    Last edited by rvkvino; July 8th, 2020 at 10:32 AM.

  8. #18
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Have you tried to approach all redis operations in the getJSON method (open the connection, retrieve the json and close)?

  9. #19
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    Yes this helped me. I have open and close all the places wherever I have used Redis and then closed. Now working fine my adapter. My problem is solved in website. Now I need to know whether is there any LS client library is available for dart language. I'm developing app in Flutter, now I need to show market rates in app also which I done in website.

  10. #20
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    A flutter/dart client is in our roadmap, but not in the very short term.
    But in the past we have suggested a workaround to those interested in the Flutter/Dart platform which consists of leverage our Android/iOS SDK and write a thin compatibility layer calling the Android/iOS Client API from Dart (see here for details).

    As an extreme alternative if you are comfortable with the Dart language, you could directly implement the TLCP protocol at least for the functionality necessary for your app (https://www.lightstreamer.com/repo/d...ifications.pdf).

    Please let us know if you need any further clarifications.

    Regards,
    Giuseppe

 

 

Similar Threads

  1. Replies: 12
    Last Post: May 26th, 2014, 10:59 AM
  2. Error handling for: [Unexpected update for item]
    By tony99nyr in forum Adapter SDKs
    Replies: 3
    Last Post: April 7th, 2014, 10:29 AM
  3. Preventing user access after notifyUser call
    By sarbao in forum Adapter SDKs
    Replies: 2
    Last Post: March 3rd, 2014, 08:39 AM
  4. NotifyUser Header
    By milad.j in forum Adapter SDKs
    Replies: 1
    Last Post: November 4th, 2013, 10:23 AM
  5. Delay in notifyUser() causes erratic create_session behavior
    By brianjohnson in forum Adapter SDKs
    Replies: 2
    Last Post: April 5th, 2010, 01:02 PM

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 06:39 PM.