Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Jul 2008
    Location
    Bedminster
    Posts
    4

    Need sample code for Meta Adapter

    Can anyone provide me with a sample code of creating Meta Adapter, in which we can authenticate user thru DB.
    Also if I create a new meta adapter, how to edit the adapter.xml so that i should pick my adapter. I'm very new to this, so any help is appreciated.

    regards
    Rekhender

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    972
    At Lightstreamer, we haven't got any sample code to attach.

    In order to authenticate the user, your Metadata Adapter should implement the "notifyUser" method and let it access and consult the database.
    As the notifyUser implementation may be blocking, ensure that enough threads are configured in the thread pool devoted to the notifyUser calls. You achieve this by modifying the "server_pool_max_size" element in the Server configuration file.
    Note that if any of the other Metadata Adapter methods has to provide user specific answers, then it is recommended that all needed information is gathered by notifyUser, so that the other method implementations can be nonblocking.

    You configure Lightstreamer Server to load your Metadata Adapter in "adapters.xml" by replacing the "adapter_class" value inside the "metadata_provider" element.
    There, you can also supply initialization parameters to the Adapter, through the "param" elements; the parameters are received by the Adapter as a keys/values map in the "init" method.

  3. #3
    Member
    Join Date
    Jul 2008
    Location
    Bedminster
    Posts
    4
    Well i have checked these settings, also can you please help me as to where do I need to pass User and Password? From the page itself, I'm trying to pass it on connection object.

    engine.connection.setUserName("user123");
    engine.connection.setPassword("password");

    When I do this, nothing happens, I was expecting either NotifyUser getting called or NotifyNewSession getting called. but nothing gets called when I do this.

    Regards
    Rekhender

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    972
    The code is correct; just ensure that the settings are performed before the first call to "changeStatus", which causes the connection to be issued.
    Upon connection, NotifyUser and NotifyNewSession are invoked on the Metadata Adapter.
    Could you observe on the client side that a successful connection takes place and still your methods have not been invoked?
    If this is the case, there may be some configuration issue, such that the default LiteralBasedProvider is still invoked, instead of your custom Remote Metadata Adapter.
    Let us know; we can guide you through some checks.

  5. #5
    Member
    Join Date
    Jul 2008
    Location
    Bedminster
    Posts
    4
    Well this is what i'm doing

    page.onEngineCreation = function(engine) {
    engine.connection.setUserName("user123");
    engine.connection.setPassword("password");
    engine.connection.setAdapterName("PROXY_HELLOWORLD ");
    engine.changeStatus("STREAMING");
    }

    Still it doesn't work. I'm using the class provides in C# in the sample project for MetaDataProvider. Do i need to change something in adapter.xml? I haven;t changed anything, but I noticed, that the 'Init' do get called when i run my sample project, which means that my class is getting initialized, but nothing works after that.

    Can you please mention me the steps to make it work, or what else do i need to check?

    thanks
    Rekhender

  6. #6
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    972
    You say
    I'm using the class provides in C# in the sample project for MetaDataProvider
    , then you say
    my class is getting initialized
    and this makes me confused.
    I need more information on your context.

    I assume that:
    • your test is based on the HelloWorld example (as the Adapter name is PROXY_HELLOWORLD)
    • in particular, you refer to the HelloWorld for .NET case;
      in that example, the Data Adapter is a Remote Adapter, while the Metadata Adapter is an in-process java Adapter (i.e. the supplied com.lightstreamer.adapters.metadata.LiteralBasedPr ovider)
    • you need to use a Remote Adapter written in C# also as the Metadata Adapter
    • you are using the supplied
      DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\src_metadata_adapter\LiteralBasedProvider.cs source code as a reference for coding your Metadata Adapter

    May you please confirm?

    Which is exactly the problem? Is it that the client page does not work at all, or is it that you see the client page pushing but can't see the invocations of the methods on your Metadata Adapter?

 

 

Similar Threads

  1. Sample code for multiple data adapter access
    By h2c357 in forum Client APIs
    Replies: 1
    Last Post: September 8th, 2011, 08:55 AM
  2. Replies: 1
    Last Post: January 31st, 2011, 07:47 AM
  3. Data Adapter sample for COMMAND mode
    By Otake in forum Adapter APIs
    Replies: 5
    Last Post: October 18th, 2009, 07:09 PM
  4. Tibco sample Code
    By wmolde in forum Client APIs
    Replies: 5
    Last Post: September 24th, 2009, 10:59 AM
  5. .Net Messaging system - meta and data adapter linking
    By paul.syson@internova.co.u in forum Adapter APIs
    Replies: 6
    Last Post: March 24th, 2009, 09:13 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 03:17 PM.