Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Oct 2007
    Location
    Chattanooga
    Posts
    12

    Standalone launcher

    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

    -------------------
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

    <configSections>
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
    </configSections>

    <appSettings/>

    <log4net>

    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
    <file value="DotNetServer.log" />
    <appendToFile value="true" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="100MB" />
    <rollingStyle value="Size" />
    <staticLogFileName value="true" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
    </layout>
    </appender>

    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
    <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger [%ndc] &lt;%property{auth}&gt; - %message%newline" />
    </layout>
    </appender>

    <!--
    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.

    start "JMSRemoteAdapters" /MIN JMSLauncher.exe /host localhost /data_rrport 7661 /data_notifport 7662 /metadata_rrport 7663 max_bandwidth=40 max_frequency=3 buffer_size=30


    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.
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Oct 2007
    Location
    Chattanooga
    Posts
    12
    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.

  3. #3
    Member
    Join Date
    Oct 2007
    Location
    Chattanooga
    Posts
    12

    Server.start

    Does server.start actually invoke the init method in the data adapter?

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    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.

  5. #5
    Member
    Join Date
    Oct 2007
    Location
    Chattanooga
    Posts
    12
    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 ?

  6. #6
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    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
    DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_DotNet_Server\DotNetServe rs.bat
    ), while the "open source" StandaloneLauncher.cs is specific for the StockListDemo and just transfers some arguments from its command line to the Metadata Adapter.

  7. #7
    Member
    Join Date
    Oct 2007
    Location
    Chattanooga
    Posts
    12
    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?

  8. #8
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    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.

 

 

Similar Threads

  1. Gracefully disconnect standalone .NET adapters
    By riaanj in forum Adapter APIs
    Replies: 15
    Last Post: September 26th, 2007, 09:30 AM
  2. .NET Standalone Adapter with Client
    By wattsw in forum Adapter APIs
    Replies: 2
    Last Post: November 13th, 2006, 05:12 PM
  3. Standalone application
    By cvs_fif in forum Adapter APIs
    Replies: 8
    Last Post: September 25th, 2006, 02:36 PM

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 01:46 PM.