Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Member
    Join Date
    Apr 2007
    Location
    Stoke-on-Trent
    Posts
    18

    Multiple adapters

    How do I set up multiple data adapters on my Lighstreamer server? I'm using ARI so these are adapter proxies that I'm talking about, using the remote .NET stuff. I've managed to set up a single adapter and get it to work correctly, now I want to add a seconds one with a different name.

    So far I've created a second sub-directory within the adapters directory, using a different name of course, and edited the adapters.xml in here to give the data and metadata adapters different names from the first one, and using different TCP port numbers. I can connect separate remote servers to both adapters, but I can only connect a remote client to one of them (the first) using an HTTP connection.

    What am I doing wrong here?

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    975
    Quote Originally Posted by TonyRoberts
    I can only connect a remote client to one of them (the first)
    May you please expand on this?
    What exactly couldn't you do? Using both adapters from the same client or using the second one only?
    And what exactly did it happen? Did you get any error message?

    Dario

  3. #3
    Member
    Join Date
    Apr 2007
    Location
    Stoke-on-Trent
    Posts
    18
    Quote Originally Posted by DarioCrivelli
    May you please expand on this?
    What exactly couldn't you do?
    Dario
    I've spent some more time on this since posting my original question. I could not get both adapters to work at the same time. I'm running on a Windows platform. I'm using remote adapters executing inside my own application i.e. I'm using just the .NET dll, not the .EXE and .DLL together.

    What I did was this: originally I just had one adapter, listening on ports 6661, 6662 and 6663. This adapter was set up by creating a sub-directory of the LS\adapters directory which contains an "adapters.xml" file, configured to set the name of the data and metadata adapters and the ports as above. It also contains a directory called "lib" which in turn contains just the "ls-proxy-adapters.jar" file. This has always worked correctly.

    I tried to add a second adapter by creating a second subdirectory of the LS\adapters directory, with exactly the same contents as for my first one. This time the adapters.xml was set to give the data and metadata adapters new unique ID and names and to use ports 7661, 7662, 7663. So, names and ports completely different for the two adapters.

    If I start Lightstreamer with just one adapter subdirectory and then use "netstat -a" from a command prompt I can see that there is a listening socket on port 6663 or 7663 depending on which one of my two adapters I've left in place. Whichever one it is I can connect to it from my application with the remote adapter code.

    When I start the Lightstreamer server with the 2 adapters set up as I just described it does in fact start correctly. However, if I then use netstat again there is only ever one listening socket on either port 6663 or 7663. Which port I get depends on the exact names of the adapter subdirectorys. Originally my one and only adapter directory had a name starting with "I". When I added my second one this had a name starting with "D" i.e lower in the alphabet. This is the one using port 7663 and in this case this is the listening port that I see. If I change my second adapter to have a named starting with "Z" then the listening port is 6663 i.e. the one from the original adapter with name that is now lower in the alphabet.

    Have I misunderstood how this is supposed to work? The documentation that comes with Lighstreamer server does not describe how to set up more than one adapter at time, though it does suggest that it can be done.

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    975
    Tony,
    I could not replicate the problem and I could successfully run two clients fed by the two different Remote Servers.

    Note that Lightstreamer Server initializes the adapters sequentially, by listing the directories in the alphabetical order; when a Proxy Adapters is involved, the initialization is not completed until the corresponding Remote Server connects to the listening ports (either one or two); then the listening ports are closed and the next Remote Adapter is initialized.
    In your case, 4 adapters are involved:
    - metadata 6663
    - data 6661-6662
    - metadata 7663
    - data 7661-7662

    Depending on the listening ports you see on the "netstat -a",
    you should run the corresponding Remote Server and see the connection succeed and the next listening ports to be open.
    If you follow this process, do you still encounter any problem?

    Note that the sequential initialization of the adapters may pose some problems and, indeed, with our Proxy Adapters, it is deadlock-prone. We just assumed that all Remote Adapters are independent processes.

    Dario

  5. #5
    Member
    Join Date
    Apr 2007
    Location
    Stoke-on-Trent
    Posts
    18
    Quote Originally Posted by DarioCrivelli
    Note that Lightstreamer Server initializes the adapters sequentially, by listing the directories in the alphabetical order; when a Proxy Adapters is involved, the initialization is not completed until the corresponding Remote Server connects to the listening ports (either one or two); then the listening ports are closed
    Dario
    AAAH, now I see what's going on. None of what you have just told me is in the documentation. If I'd known this then I would not have had a problem.

    So, that also means that an Adapter Proxy can only accept exactly 1 Remote Server connection? This because once a connection has been accepted then a further "listen" is not put up on the server. In our environment we want to distribute data that can be coerced to be of similar type coming from multiple sources, so one mechanism that seemed possible to us was to have an adapter proxy which multiple remote servers connected to. Another alternative was to have one adapter per type of data source within our system, although even though there could be more than once instance of the data type's specific application running (working on different parts of the same dataset) so we'd still need to have more than one connection to an adapter proxy.

    Quote Originally Posted by DarioCrivelli
    Note that the sequential initialization of the adapters may pose some problems and, indeed, with our Proxy Adapters, it is deadlock-prone. We just assumed that all Remote Adapters are independent processes.
    Dario
    What do you mean by the last part of that, the "independent processes" comment?

  6. #6
    Member
    Join Date
    Apr 2007
    Location
    Stoke-on-Trent
    Posts
    18
    Quote Originally Posted by DarioCrivelli
    Tony,
    If you follow this process, do you still encounter any problem?
    Dario
    OK, I've changed the very naive "proof of concept" test apps I was using to be better behaved and I get much better results now. SO: I start my Lightstreamer server with two Adapter Proxies configured and I see it listening on the port for the first of them. Now I start the app which is the Remote Server for this adapter and I see the data and metadata send/receive/notify processes start up AND I see from netstat that there is now a listening socket for the second adapter. Start the Remote Server app for this one and its data and metadata send/receive/notify processes start up too. Also the HTTP server process now starts listening on port 8080. I can now start up apps which connect as clients which subscribe to theses two adapters and this also works.

    Only problem I now have is that if I close down one of my Remote Server apps then the associated Adapter Proxy also fails, due to stream i/o error. I was expecting this. However, the failure in this adapter also causes the whole Lightstreamer server to stop. From what I had read I was expecting the Lightstreamer to continue running because it still has an Adapter Proxy correctly connected to a Remote Server which is active.

  7. #7
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    975
    This brings us back to this thread.

  8. #8
    Member
    Join Date
    Apr 2007
    Location
    Stoke-on-Trent
    Posts
    18
    Quote Originally Posted by DarioCrivelli
    This brings us back to this thread.
    Yes, I know it does.

    My point was that the documentation I've seen, and messages in that thread, suggest that having an Adapter Proxy throw an error due to the Remote Adapter terminating would only cause the Lightstreamer server to also terminate if this was the only adapter running. The implication was that if there was more than one Adapter Proxy running then if just one of them went away then the rest would carry on running and so the Lightstreamer server would not shutdown. Have I interpreted the documentation incorrectly?

  9. #9
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    517
    That was probably a misunderstanding. I confirm that the current implementation of the Proxy Adapter terminates the Server process upon Remote Adapter disconnection, irrespective of other Adapters still running.

    This behavior will be probably changed in a future release of Lightstreamer (expected within a couple of months), where support for multiple Adapters accessed from the same session wil be added too.

  10. #10
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    975
    Tony, sorry for the misunderstanding.
    We found a sentence in that thread that could be interpreted as you did:
    Note that, while on the Remote Adapter side there may be custom code to be preserved from a process close (as in your case), on the Server side, where the Proxy Adapter is running, this is not the case, unless other adapters are running.
    I will fix it in that thread.
    Could you find a similar ambiguity in our documentation too?

 

 

Similar Threads

  1. Multiple Data/Metadata Adapters
    By odeheurles in forum Adapter APIs
    Replies: 6
    Last Post: January 26th, 2015, 10:50 AM
  2. How to use multiple adapters in one web client
    By sjohn in forum Client APIs
    Replies: 11
    Last Post: January 23rd, 2015, 12:22 PM
  3. adapters.xml
    By Pradeep Chahal in forum Adapter APIs
    Replies: 1
    Last Post: April 26th, 2010, 03:50 PM
  4. multiple data adapters
    By rd2008 in forum Client APIs
    Replies: 2
    Last Post: January 7th, 2009, 03:28 PM
  5. Accessing multiple adapters
    By Waddy in forum General
    Replies: 2
    Last Post: March 16th, 2007, 07:06 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 02:24 PM.