-
May 2nd, 2016, 03:22 PM
#1
How can I set the listener in the Data adapter?
Hey,
So from what I have read, the listener is set by the LightStreamer Kernel (correct me if I am wrong), but if I wish to configure the listener in the data adapter, how can I do it? So far when I am debugging the Lightstreamer-example-StockList-adapter-java it takes null for a listener, so how can I change it?
-
May 3rd, 2016, 09:06 AM
#2
Hi Priyanka,
I confirm that the listener is provided by the Lightstreamer server to your Adapter with the setListener method call. The listener is set just after the init method and before any subscribe is called.
The listener never changes throughout the entire life of the adapter, then neither the Lightstreamer server nor the code of your adapter can change it in any way.
Please could you confirm that your setListener implementation properly stores the received object in some private variable, and never overwrite it?
Could you confirm that the init method terminates successfully.
Regards,
Giuseppe
-
May 3rd, 2016, 10:10 AM
#3
Hey Giuseppe,
Thanks for the prompt reply.
1) Could you please let me know how to initialize the LightStreamer server? I read on a blog that an instance of a Remote Data Adapter is supplied to Lightstreamer through a lightstreamer_adapter.server.DataProviderServer instance. Where can I find this lightstreamer_adapter.server.DataProviderServer class in my LS_Home folder?
2)I tried debugging the Lightstreamer-example-StockList-adapter-java project. This is how my Main.java code looks like :
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
DataAdapter dataAdapter = new DataAdapter();
Map params = new HashMap<String,String>();
params.put("log_config", "../adapters_log_conf.xml");
params.put("log_config_refresh_seconds", "10");
params.put("adapters_conf.id", "WELCOME");
File configDir = new File("../adapters_log_conf.xml");
ItemEventListener listener ;
dataAdapter.setListener(new ItemEventListener());
dataAdapter.init(params, configDir);
}
}
Could you please let me know if there is some key-value pair that I have missed adding to my params map which is why my init is not working properly?
Please do help.
Thank you,
Priyanka
-
May 3rd, 2016, 11:29 AM
#4
Hi Priyanka,
Please let me clarify that if your intention is to test the Stock-List Demo Java Adapter you do not have anything to deal with remote adapters.
Furthermore, the code you're writing is going in the wrong direction, you have no need of a Main java program that initializes the adapter, it is a tasks that is performed by the Lightstreamer server.
Please follow the instructions of the install section of this README. Basically you have to copy the stocklist folder, you can find in the deploy.zip file, to the adapters folder under your LS_HOME and then start the server, launching the script located under "LS_HOME\bin", according to your operating system.
At the start, the Lightstreamer server initialize the Adapter that is ready to be used by one of the demo client provided: Complete list of clients using this Adapter.
Regards,
Giuseppe
-
May 3rd, 2016, 12:05 PM
#5
Hey,
So now I understand that I do not have to write a Main java program. So could you please help me with debugging of the Stock-List Demo Java Adapter? I have followed the steps posted by "Mone" in the following thread: http://forums.lightstreamer.com/show...-Lightstreamer. But once I remove the lib folder from the adapters/welcome_res/StockList folder in order to debug, do I have to make changes to the <adapter_class> inside my adapters.xml file since my path of the StockList project has now changed to my workspace of Eclipse?
Sorry for the trouble. This is my first time with LighStreamer.
Thank you,
Priyanka
-
May 3rd, 2016, 12:32 PM
#6
Hi Priyanka,
We have an updated post for how "Developing & Running an Adapter Set Using Eclipse".
It refers to a new project for the Adapter, instead in your case, you should refer to your already existing eclipse project.
Regards,
Giuseppe
-
May 3rd, 2016, 04:12 PM
#7
Hey,
Issue sorted finally!
Thank you,
Priyanka
Similar Threads
-
By gianluca.finocchiaro in forum Adapter SDKs
Replies: 26
Last Post: July 8th, 2019, 12:10 PM
-
By lizamare in forum Adapter SDKs
Replies: 1
Last Post: April 17th, 2015, 09:59 AM
-
By sky.sanders@gmail.com in forum Client SDKs
Replies: 1
Last Post: June 11th, 2012, 09:45 AM
-
By msgiribabu in forum Adapter SDKs
Replies: 2
Last Post: January 31st, 2011, 11:32 AM
-
By EWANG in forum Client SDKs
Replies: 1
Last Post: October 9th, 2009, 10:46 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 04:19 PM.
Bookmarks