Archived

This forum has been archived. Please start a new discussion on GitHub.

connection establishment

Hello everybody!

What I have is the following scenario:

A kind of registration server is running all the time. All Servents tell him after they were started which services they provide. The registration server itselfs holds a map, with the Proxy and its services provided. If the services of a servent change, the servent calls "updateServices" on registration server side and the list is updated and send to all servents. So every servent holds a copy of the list with all servents available in the scenario. Any time a new servent goes online, he receives the whole list with all available servents from the registration server.

If a servent needs a service, it will look in his own list and chooses one servent who offers this service and contacts him. And thats my problem: How to contact this other servent? I have the Proxy in the list and theIce::Identity of the required servent. But how to create a connection?

Between registry server and all servents i have bidirectional connections.

Thanks for upcoming answers!

Comments

  • xdm
    xdm La Coruña, Spain
    jaleira wrote:
    I have the Proxy in the list and theIce::Identity of the required servent. But how to create a connection?

    Between registry server and all servents i have bidirectional connections.

    I'm not sure if i understand well your problem, I think you don't need open a connection explicit, when you call a method of a proxy Ice run time automatic open the connection if needed.
  • bernard
    bernard Jupiter, FL
    I don't understand your deployment. By 'servent', do you mean 'server'?

    If you have many servers, which connections are bi-directional? Why do you create bi-dir connections?

    Cheers,
    Bernard
  • By servent I mean a node, that can be both: Server and Client. So the functionality is splitted: Against the registration server all servents behave like a client, who register themselves. Afterwards every servent could need a service provided by another servent. Than a connection is needed between those two. In this case one servent acts like a client and the other servent (providing the service) acts like a server.

    I am still looking for a solution to this problem!

    Concerning the bi-directional connections: I don't really know, if i need them. That was also a part of my question :-)
  • bernard
    bernard Jupiter, FL
    Maybe you really mean "servant", the programming language object that is associated with an Ice Object through an Adapter object map or Servant Locator?

    If you don't know if you need bi-dir connections or not, then I'd recommend to stick to regular connections. Without bi-dir connections, there is no reason to worry about Ice::Identities -- just pass proxies around, and Ice will take care of establishing the connections when needed.

    Cheers,
    Bernard
  • No, I don't mean Servant! Servent:http://en.wikipedia.org/wiki/Servent

    What is important for my application is, that I don't want to define endpoints (or even hosts) for my servents. But without defining endpoints I can't establish connections between servents, because I receive Ice::NoEndpointsException! :confused:
  • benoit
    benoit Rennes, France
    Your servers (or more precisely the server side of your "servents") need to listen on a network interface to be able to dispatch requests from clients. For that, you need to define endpoints for the object adapters created in your servers (with the <adapter name>.Endpoints property). This doesn't mean that clients will have to explicitly be aware of these endpoints however! If your server registers a proxy with another service (a registry), a client can lookup this proxy and just invoke on it -- the client will automatically establish the connection with the server pointed by the proxy and you don't have to worry about the server endpoints (this information is encoded in the proxy).

    I suspect your misunderstsanding is comming from the fact that you're trying to use bidir connections. You should just use regular connections instead and pass proxies around instead of identities. Your Slice would look like the following:
    #include <Ice/BuiltinSequences.ice>
    
    interface Servent
    {
    ...
    };
    
    interface ServentRegistry
    {
       Servent* find(string serviceName);
       void updateServices(Servent* proxy, Ice::StringSeq serviceNames);
    };
    

    Cheers,
    Benoit.