Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Nov 2009
    Location
    sofia
    Posts
    9

    How to create 2 engines in one page?

    Hi
    I have 2 adapters loaded in the lightstreamer server. One is directly sneding messages from socket stream. The other is comunicating with jboss server with jms. This all is tested and works.
    The problem is that i need to use the both adapters in one page. I saw the example with frames, but i could not use it. My application is GWT i.e. using java code to generate html/javascript .
    I have integrated the application page to work with the adapters but when i create 2 pushpages like this

    Code:
    	private native JavaScriptObject createPushPage() /*-{
    		var page = new $wnd.PushPage(); 
    		return page;
    	}-*/;
    
    	private native void init(JavaScriptObject map, JavaScriptObject page) /*-{
    	try {
    			page.context.setDomain(map['domain']);
    			page.onEngineCreation = function(engine) {
    				engine.connection.setLSHost(map['host']);
    	   			engine.connection.setLSPort(map['port']);
    				engine.connection.setAdapterName(map['adapter_root']);
    				engine.changeStatus(map['engine_status']);
    			}
    			page.bind();
    			page.createEngine("app", map['ls_home'], "SHARE_SESSION");
    	} catch(error) {
    		alert(error);
    	}
    	}-*/;
    
    	private native JavaScriptObject getNVT(String[] group, String[] schema, String sourceType) /*-{
    	var nonVisualTable = new $wnd.NonVisualTable(group, schema, sourceType);
    	return nonVisualTable;
    	}-*/;
    It is saying that an engine is already created.

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    Do you mean that you get a
    createEngine() has already been called
    message?
    If your pushpages are not real pages, but they are implemented as subparts of the same container page,
    then you can't call createEngine on a pushpage level.

    If you need to use two different Data Adapters, you could define a single Adapter Set which includes both; so, you would need only one Engine.
    There would be a single Metadata Adapter, which should be able to understand requests targeted to each Data Adapter.

  3. #3
    Member
    Join Date
    Nov 2009
    Location
    sofia
    Posts
    9
    I have
    Adapter 1
    Adapter 2
    The client will receive data from adapter 1 when connects with group and schema different from those of Adapter 2.
    The question is is it possible to connect to 2 adapters using different groups with one engine? I did not find this in the examples.

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    All the examples predeployed in the distribution package (which you can see in action by following the instructions in GETTING_STARTED.TXT) share the same Engine.
    This means that they all refer to the same Adapter Set.
    However, each example is served by a distinct Data Adapter; all these adapters are mounted in the Adapter Set, through adapters\Demo\adapters.xml.

    On the client side, the only restriction is that all items used in each single table have to be supplied by the same Data Adapter, whose name is configured through setDataAdapter.

    On the server side, the main limitation is that the Data Adapter name specified in each request is not supplied to the Metadata Adapter methods (for interface backward compatibility matters);
    hence, the item names should be chosen in such a way that no ambiguities could arise.

  5. #5
    Member
    Join Date
    Nov 2009
    Location
    sofia
    Posts
    9

    Red face

    Everything on the server side is ok, i have used adapter set to define all my data adapters.
    The problem is only on the client. I have to bind my page with the engine with schema={ "item"} which use non visual table A and ALSO i need to bind the page with the engine with schema = { "settings" } which use non visual table B. Because it is restricted to have more than one engine. So i am now trying the example StockListDemo_Frames with frames but the technology which i am using is hard and unknown for me to achieve this with frames.
    I also tried this example PortfolioDemo with 2 adapters in set but they use one group which dont work for me.
    As i told you i need to have 2 tables which have its own schema and group and use different adapters. It seems this is possible only with frames, which is my problem. Because when i reseive mesage from on the client in my second frame like this
    Code:
      pushPage.bind();
     
      // seek the LightstreamerEngine created by the main page
      pushPage.seekEngine("DemoCommonEngine", self.parent.frames["SLD_LSCONTAINER"]);
    
      var schema = ['settings'];
      var group = ['settings'];
      var newTable = new NonVisualTable(group, schema, "MERGE");
      newTable.setDataAdapter("SYSTEMSETTINGSJMSADAPTER");
      newTable.onItemUpdate = updateItem;
    
      pushPage.addTable(newTable, "main");
    
      function updateItem(item, updateInfo) {
    	window.parent.updateItemCallback(item);	  
      }
    It says that there is no permission to call the function in the parent page. I think because the function updateItem is called by the newTable which call may be comes from the domain where lightstreamer is running, and i this function calls my function which is on the site domain such exception is thrown?
    i am receiving the message but i cannot call method from the parent page where the frame is included in frameset nor calling method from the other frame (which is the thing i need).

  6. #6
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    you don't need to use frames to reach your goal (btw we can solve the permission denied problem if you want).
    All you need are two tables, e.g.:



    Just as a side note, I see that you use 'settings' both as item name and as field name. Please be sure that's what you want (it can be confusing).

 

 

Similar Threads

  1. how to create Adapter Set
    By msgiribabu in forum Adapter SDKs
    Replies: 2
    Last Post: January 31st, 2011, 12:32 PM
  2. Error when create Hello world sample
    By thitkhohotvit in forum Adapter SDKs
    Replies: 9
    Last Post: January 19th, 2011, 12:50 PM
  3. create .jar with .class
    By khalil78 in forum Adapter SDKs
    Replies: 2
    Last Post: April 4th, 2008, 08:38 PM
  4. How to create Data Adapter?
    By Hanumant in forum Adapter SDKs
    Replies: 3
    Last Post: January 29th, 2008, 04:42 PM
  5. Unable to create New DotNET Adapter
    By shobha in forum Adapter SDKs
    Replies: 4
    Last Post: August 13th, 2007, 02:32 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 10:10 PM.