I have written an adapter that talks to JMS in .NET. As mentioned in the DotNetAdapter.pdf, I created a new project, added the references and wrote an adapater class that implements IdataProvider.
Now in order to invoke this adapter, I wrote a standalone launcher. I opened a console application target project and then added the required references. I am attaching the standalone console app code as an attachment.
Both the adapter class and the standalone projects compile fine. Now I create a folder under <lightstreamerroot>\adapters\. I added a lib folder and a classes folder. Into the lib folder, I copied ls-proxy-adapters.jar . I have attached my adapter.xml as my attachment. Please note I am using ports 7661,7662,7663
Now I start my lightsreamer windows service. It starts fine. Shows no errors.
below is what I see in the log.
------------------------------------------------------------------------------------------------
12-Feb-08 13:17:07,126 |INFO |LightstreamerLogger.init |WrapperSimpleAppMain |Lightstreamer Server starting in Enterprise edition
12-Feb-08 13:17:07,186 |INFO |LightstreamerLogger.init |WrapperSimpleAppMain |Started HTML Adaptor for JMX on port 6666
12-Feb-08 13:17:07,246 |INFO |LightstreamerLogger.init |WrapperSimpleAppMain |Started JMXMP Connector for JMX on port 9999
12-Feb-08 13:17:07,356 |INFO |LightstreamerLogger.init |WrapperSimpleAppMain |Loading Metadata Provider JMS
12-Feb-08 13:17:07,496 |INFO |.remote.transport.SocketTransport|WrapperSimpleAp pMain |Connecting...
--------------------------------------------------------------------------------------------
Now under DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment
I create a folder called JMSLauncher and create a folder called dotnet_2.0. In this folder I drop in the dlls for the standalone launcher I wrote. I added a config file for the pp, that is as follows
<!--
Loggers for Lightstreamer .NET Remote Server and Remote Adapter Library.
-->
<logger name="Lightstreamer.DotNet.Server">
<level value="INFO" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<!--
At INFO level, Connection status is logged.
-->
<logger name="Lightstreamer.DotNet.Server.NetworkedServerS tarter">
<level value="INFO" />
</logger>
<!--
At INFO level, Connection details are logged.
At DEBUG level, request, reply and notify lines are logged.
-->
<logger name="Lightstreamer.DotNet.Server.RequestReply">
<level value="WARN" />
</logger>
<!--
Logs the activity of the custom server.
At INFO level, Remote Server startup is logged.
At DEBUG level, command line argument recognition is logged.
-->
<logger name="Test.LS.Adapters">
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<root>
</root>
</log4net>
</configuration>
------------------------------------
I created a bat file
@echo off
rem ---------------------------------------------------------------------------
rem Set the DotNet installation path as the current directory. Change the
rem directory accordingly to your installation path of DotNet Adapter.
pushd .\dotnet_2.0
rem Lightstreamer StockListDemo .NET Adapter Standalone Server Usage:
rem DotNetStockListDemoLauncher
rem [/name <name>] /host <address>
rem /data_rrport <port> /data_notifport <port> /metadata_rrport <port>
rem ["<param1>=<value1>" ... "<paramN>=<valueN>"]
rem Where:
rem <name> is the symbolic name for both the adapters (1)
rem <address> is the host name or ip address of LS server (2)
rem <port> is the tcp port number where LS proxy is listening on (3)
rem <paramN> is the Nth Metadata Adapter parameter name (4)
rem <valueN> is the value of the Nth Metadata Adapter parameter (4)
rem Notes:
rem (1) The adapter name is optional, if it is not given the adapter will be
rem assigned a progressive number name like "#1", "#2" and so on
rem (2) The communication will be from here to LS, not viceversa
rem (3) The notification port is necessary for a Data Adapter, while it is
rem not needed for a Metadata Adapter
rem (4) The parameters name/value pairs will be passed to the LiteralBasedProvider
rem Metadata Adapter as an hashtable in the "parameters" Init() argument
rem The StockListDemo Data Adapter requires no parameters
rem ---------------------------------------------------------------------------
rem Start the Literal Based Provider Remote Metadata Adapter and the StockList
rem Demo Remote Data Adapter in networked mode, specifying to connect to the
rem local host. Change the "/host" parameter according to your configuration.
rem ---------------------------------------------------------------------------
rem All done. Goes back to the original current directory and pauses, in case
rem of any error.
echo Processes started. All done.
popd
pause
---------------------
Now when I click on the bat file, it is erroring out saying Invalid cast exception. my log file is not getting created . I am thinking that it is erroring out when it is trying to create my log file. Can you look at my config file and my serverMain class and my config file and tell me what I am doing wrong.
I think I figured it out. My log file is now getting created and I see the following messages.
But when it comes to _server.Start(); it is giving me a null reference exception
"reference not set to an instance of an object". I used the same code as in the DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\src_standalone_launcher\StandaloneLauncher.cs.
Do you know why I am getting this error. The attachment in my prev post on this same thread has my .cs code.
Thanks for all your help.
Yes, _server.Start(), as the first action, invokes the Init method in the Adapter.
It seems the most likely place for the exception, as indeed nothing else has been changed.
One small help.My data adapter needs to read the JMS URL , toopic name etc from an external def file . Can you tell me the best way to pass this to the dataadapter from the standalone launcher.
Can I pass the adapter.xml path , to server.adapterConfig ?
I can only confirm and expand what was said in this thread
The prescribed way to supply a configuration file from the Remote Server "main" function in "StandaloneLauncher.cs" to the Data Adapter is to specify the file path in the "server.AdapterConfig" property; then, the Data Adapter "Init" method will receive the file name in its "configFile" argument and should take the burden of reading the file.
As an alternative, you can take the burden of reading the configuration file in StandaloneLauncher.cs and pass the relevant properties as a map, in "server.AdapterParams"; in this case, the Data Adapter "Init" method will receive the map as an "IDictionary" object, in the "parameters" argument.
In any case, no support for the configuration file management is available. The "adapters.xml" file used for the configuration of the java Adapters which run in-process with Lightstreamer Server has, unfortunately, no equivalent for the Remote Adapters.
The base Remote Server launcher (i.e. DotNetServer.exe) just gets configuration arguments from the command line and can only run one Adapter (see
), while the "open source" StandaloneLauncher.cs is specific for the StockListDemo and just transfers some arguments from its command line to the Metadata Adapter.
So what is lightstreamers recommendation for running multiple adapters.
1) Do I need to write standalone launchers for each adapter?
2) What is lightstreamers receommendation for the below scenario?
I need to listen to various topics on the same jms url? Would I need to write a separate adapters for each topic?
The main limitation about adapters is that each web client can open only one streaming session at a time and a session can be associated to only one Data/Metadata Adapter pair.
So, you probably need to setup a single Metadata Adapter and a single Data Adapter, unless totally different front-end applications have to be fed by the same Server instance. In a remoting scenario, this means one Metadata and Data Proxy Adapter (already supplied) plus one Metadata and Data Remote Adapter.
We have no recommendation about how to launch the Remote Adapters. Customizing a standalone launcher allows you to launch both Metadata and Data Remote Adapter together. If launching them separately is acceptable, then you may not need to customize two standalone launchers, but you may find it enough to use the provided Remote Server.
Note that you also may not need to use a Remote Metadata Adapter at all. You could setup a local, java Metadata Adapter in place of the Proxy Metadata Adapter and only need the Remote Data Adapter.
Bookmarks