-
September 12th, 2015, 06:23 PM
#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.
-
September 13th, 2015, 09:54 AM
#2
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
-
September 14th, 2015, 01:19 AM
#3
Thanks Gianluca;
I'll give it a shot and will post my results.
Mario Lobo
-
September 14th, 2015, 09:53 AM
#4
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
-
September 15th, 2015, 08:46 PM
#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
-
September 15th, 2015, 08:49 PM
#6
Alessandro;
That's exactly the demo I'm trying to run.
-
September 16th, 2015, 08:40 AM
#7
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
-
September 16th, 2015, 09:35 AM
#8
Please note that in my previous post, inside the xml snippet, remained some fake spaces, which I was not able to remove.
-
September 16th, 2015, 02:14 PM
#9
That did it!
grazie mille, Giuseppe!
Now I can begin experimenting!
Mario Lobo
-
September 16th, 2015, 02:30 PM
#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
-
By Alessandro in forum Client SDKs
Replies: 2
Last Post: July 19th, 2010, 09:01 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 04:25 AM.
Bookmarks