metero
Hi
i have a project , where i am connecting to a java program and receive some data.
The Adapter is java class , i need to run two adapters with the same java class
to connect with two different programs to receive data it is possible that !!??
Like, the same java class for ONE ADAPTER and TWO PROVIDERS
or
TWO ADAPTERS
BUT ALWAYS THE SAME CLASS
<?xml version="1.0"?>
<adapters_conf id="DEMO_FEED">
<metadata_provider>
<adapter_class>
com.lightstreamer.adapters.metadata.LiteralBasedProvider
</adapter_class>
</metadata_provider>
<data_provider name="SOCKETLSADAPTER_A">
<!-- Optional. Specify a directory other than "."
for this Adapter's own class and configuration files. -->
<install_dir>SocketLSAdapter_A</install_dir>
<!-- Mandatory. Java class name of the adapter. -->
<adapter_class>stocklistdemo.adapters.StockQuotesData</adapter_class>
<!-- Set If Feed is Local or Remote a.[Local] b.[Remote] -->
<param name="hostIP">10.0.0.100</param>
<param name="bindPort">2000</param>
</data_provider>
<data_provider name="SOCKETLSADAPTER_B">
<!-- Optional. Specify a directory other than "."
for this Adapter's own class and configuration files. -->
<install_dir>SocketLSAdapter_B</install_dir>
<!-- Mandatory. Java class name of the adapter. -->
<adapter_class>stocklistdemo.adapters.StockQuotesData</adapter_class>
<!-- Set If Feed is Local or Remote a.[Local] b.[Remote] -->
<param name="hostIP">10.0.0.110</param>
<param name="bindPort">2000</param>
</data_provider>
</adapters_conf>
THANKS
Mone
Hi,
you can certainly use the same class to run two different data adapters;
you don't have to use two different install_dirs doing so, but you probably need to pass to them a parameter so that them can differentiate themselves in some way (I guess you don't need two data adapters that are one the clone of the other;
So your adapters.xml will look like this:
[syntax="XML"]<?xml version="1.0"?>
<adapters_conf id="DEMO_FEED">
<metadata_provider>
<adapter_class>
com.lightstreamer.adapters.metadata.LiteralBasedProvider
</adapter_class>
</metadata_provider>
<data_provider name="SOCKETLSADAPTER_A">
<adapter_class>stocklistdemo.adapters.StockQuotesData</adapter_class>
<param name="hostIP">10.0.0.100</param>
<param name="bindPort">2000</param>
<param name="myParam">A</param>
</data_provider>
<data_provider name="SOCKETLSADAPTER_B">
<adapter_class>stocklistdemo.adapters.StockQuotesData</adapter_class>
<param name="hostIP">10.0.0.100</param>
<param name="bindPort">2000</param>
<param name="myParam">B</param>
</data_provider>
</adapters_conf>[/syntax]
while the tree of your adapter will look like this:
LS_HOMEadaptersyourAdapterlibjarContainingYouAdapterClass.jar
This way Lightstreamer will create two instances of StockQuotesData passing to each of them the specified params.
From the client point view, you can specify the dataAdapter to let them subscribe to one or to the other instance.
HTH
betasec
Hi thanks for the response
Look like load two times the class but is not working as i want
is connected only to one Feed Server , i have to check my java class to not conflict the variables
Thanks