Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1

    Direct push to Lightstreamer from a C daemon.

    Hi;

    I am new to Lightstreamer and I'm in my very first attempts to work with it. I just subscribed to this forum so please bear with my probably lame questions.

    I managed to put the HelloWorld and MarketDepthDemo to work on my server.

    In my Job, everything is in DBF/NTX (yeah! Tell me about it!). I already wrote a daemon in C that gathers data from those files. I was wondering if I could extend my daemon to push this gathered data directly to Lightstreamer.

    I tried to "relate" the java code to a C equivalent but I'm an old dog and I just couldn't do it.

    So if there is a way, what are the main ordered steps to accomplish this?

    Thanks for any advice.

  2. #2
    Administrator
    Join Date
    Feb 2008
    Location
    Siracusa
    Posts
    147
    Hi Mlobo,

    to accomplish your goal you have to set up a Remote Adapter Infrastructure, following the principles depicted in this document.

    Basically, you have to create one or more processes which open a TCP communication with Lightstreamer Server and start the interaction by exchanging commands as required by the ARI protocol.

    It is possible to implement a Remote Adapter for any language that supports socket programming, and C (in any its implementation) obviously does. Here the full list of Remote Adapter examples in different languages and platforms.

    Please get back to us for any doubt.
    Gianluca

  3. #3
    Thanks Gianluca;

    I'll give it a shot and will post my results.

    Mario Lobo

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    515
    Hi Mario,

    The "Hello World" tutorial on pushing data to Lightstreamer server via TCP sockets is this: https://github.com/Weswit/Lightstrea...adapter-socket

    Cheers
    Alessandro

  5. #5
    Here i what I did.

    1) I used the adapters.xml bellow:

    <?xml version="1.0"?>

    <adapters_conf id="PROXY_HELLOWORLD_SOCKETS">

    <metadata_provider>
    <adapter_class>com.lightstreamer.adapters.metadata .LiteralBasedProvider</adapter_class>
    </metadata_provider>

    <data_provider>
    <adapter_class>com.lightstreamer.adapters.remote.d ata.NetworkedDataProvider</adapter_class>
    <param name="request_reply_port">7001</param>
    <param name="notify_port">7002</param>
    <param name="timeout">36000000</param>
    </data_provider>

    </adapters_conf>

    2) Copied everything to the proper directories

    [/usr/Lightstreamer/bin/unix-like]>ls -l ../../adapters/HelloWorldSockets/
    total 8
    -rw-r--r-- 1 root wheel 503 Sep 14 09:10 adapters.xml
    drwxr-xr-x 2 root wheel 512 Sep 14 09:12 lib

    [/usr/Lightstreamer/bin/unix-like]>ls -l ../../adapters/HelloWorldSockets/lib/
    total 120
    -rw-r--r-- 1 root wheel 120535 Sep 14 09:12 ls-proxy-adapters.jar

    When I start lightstreamer, I get this:

    [/usr/Lightstreamer/bin/unix-like]>./start.sh
    Java environment:
    JAVA_HOME = "/usr/local/openjdk8"
    JAVA_OPTS = "-server -XX:MaxGCPauseMillis=1000"

    Setting file descriptor limit to 117270
    Configured file descriptors, soft limit: 117270
    Configured file descriptors, hard limit: 117270

    Lightstreamer Server directory:
    LS_HOME = "/usr/Lightstreamer"

    Lightstreamer Server main configuration file:
    LS_CONFIG = "/usr/Lightstreamer/conf/lightstreamer_conf.xml"

    Starting Lightstreamer Server...
    Please check logs for detailed information.
    15.Sep.15 16:40:51,551 < INFO> Lightstreamer Server 6.0.1 build 1780
    15.Sep.15 16:40:51,591 < INFO> Lightstreamer Server starting in Moderato edition.
    15.Sep.15 16:40:51,753 < WARN> Only minimal JMX management support is available with the current license.
    15.Sep.15 16:40:51,858 < INFO> Started RMI server for JMX on port 8888.
    15.Sep.15 16:40:52,110 < INFO> Bound RMI Connector for JMX on port 8888 (communication on port 8888).
    15.Sep.15 16:40:52,211 < INFO> Bound RMI Connector for Platform mbeans on port 8888 (communication on port 8888).
    15.Sep.15 16:40:52,221 < INFO> SERVER pool size set by default at 10.
    15.Sep.15 16:40:52,348 < INFO> Pump pool size set by default at 4.
    15.Sep.15 16:40:52,466 < INFO> data_provider element without name attribute; using DEFAULT as the default name.
    15.Sep.15 16:40:52,500 < INFO> data_provider element without name attribute; using DEFAULT as the default name.
    15.Sep.15 16:40:52,503 < INFO> Loading Metadata Adapter for Adapter Set WELCOME
    15.Sep.15 16:40:52,503 < INFO> Loading Metadata Adapter for Adapter Set MARKETDEPTH
    15.Sep.15 16:40:52,504 < INFO> Loading Metadata Adapter for Adapter Set PROXY_HELLOWORLD_SOCKETS
    15.Sep.15 16:40:52,521 < INFO> Finished loading Metadata Adapter for Adapter Set PROXY_HELLOWORLD_SOCKETS
    15.Sep.15 16:40:52,543 < INFO> Loading Data Adapter PROXY_HELLOWORLD_SOCKETS.DEFAULT
    15.Sep.15 16:40:52,563 <ERROR> Can't find data adapter class.
    java.lang.ClassNotFoundException: com.lightstreamer.adapters.remote.data.NetworkedDa taProvider
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:381) ~[na:1.8.0_45]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:4 24) ~[na:1.8.0_45]
    at com.lightstreamer.g.d.an.loadClass(an.java) ~[na:na]
    at com.lightstreamer.init.b.a(b.java) [ls-bootstrap.jar:na]
    at com.lightstreamer.g.d.f.a(f.java) [lightstreamer.jar:na]
    at com.lightstreamer.g.d.f.a(f.java) [lightstreamer.jar:na]
    at com.lightstreamer.g.d.ak.b(ak.java) [lightstreamer.jar:na]
    at com.lightstreamer.o.b.al.run(al.java) [lightstreamer.jar:na]
    15.Sep.15 16:40:52,564 <ERROR> Error in task Init adapter set PROXY_HELLOWORLD_SOCKETS: com.lightstreamer.o.b.ae: Error in task Init for PROXY_HELLOWORLD_SOCKETS.DEFAULT.
    15.Sep.15 16:40:52,567 <ERROR> Error while loading the Adapters: LoadingException: Error in Adapter loading.
    15.Sep.15 16:40:52,567 <ERROR> Error while loading the Adapters: Error in Adapter loading.
    15.Sep.15 16:40:52,567 <FATAL> Adapters initialization failed.

    What should I do?

    Thanks,

    Mario Lobo

  6. #6
    Alessandro;

    That's exactly the demo I'm trying to run.

  7. #7
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    505
    Hi Mario,

    It seems you are using an Adapters configuration of the old Lightstreamer server 5.x but no longer supported in the new version 6.
    Please, try with an adapters.xml like this:


    Indeed, the issue was that the old configuration implies the use of a common class loader shared with the server, which is not supported anymore for Proxy Adapters.

    Please let us know if you need any further clarifications.

    Regards,
    Giuseppe

  8. #8
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    505
    Please note that in my previous post, inside the xml snippet, remained some fake spaces, which I was not able to remove.

  9. #9
    That did it!
    grazie mille, Giuseppe!

    Now I can begin experimenting!

    Mario Lobo

  10. #10
    Giuseppe;

    One last off-topic question. The plan is to use Lightstreamer on a site that won't have more than 80 simultaneous accesses at a given time. And it will stay at that.

    Will the moderato edition be suited for this?

 

 

Similar Threads

  1. Using the direct network protocol?
    By Alessandro in forum Client Protocol
    Replies: 2
    Last Post: July 19th, 2010, 10:01 AM

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 07:42 PM.