-
July 18th, 2008, 07:31 PM
#1
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
-
July 21st, 2008, 10:41 AM
#2
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.
-
July 21st, 2008, 02:49 PM
#3
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
-
July 22nd, 2008, 09:01 AM
#4
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.
-
July 22nd, 2008, 01:56 PM
#5
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
-
July 23rd, 2008, 09:34 AM
#6
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
-
By h2c357 in forum Client SDKs
Replies: 1
Last Post: September 8th, 2011, 08:55 AM
-
By msgiribabu in forum Adapter SDKs
Replies: 1
Last Post: January 31st, 2011, 07:47 AM
-
By Otake in forum Adapter SDKs
Replies: 5
Last Post: October 18th, 2009, 07:09 PM
-
By wmolde in forum Client SDKs
Replies: 5
Last Post: September 24th, 2009, 10:59 AM
-
By paul.syson@internova.co.u in forum Adapter SDKs
Replies: 6
Last Post: March 24th, 2009, 09:13 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 07:13 AM.
Bookmarks