Home Help Center

IceGrid objects, multiple endpoints

stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
Hi!

I'm using the IceGrid registry along with IceBox based services without IceGrid nodes.
So far, I was using the straight forward approach with just one endpoint per object registered on the registry:
adminPrx.addObjectWithType(prx, identity);

Now I wanted to add more endpoints to an object that is registered on the registry. My goal is to have multiple instances of the same IceBox service on multiple machines to implement (a simple) load balancing. Using replicas/ IceGrid nodes is probably too complex for my scenario, I'd like to keep things as simple as possible.

Is it possible to add more endpoints through IceGrid.Admin when an object is already registered there?

cheers,

Stephan

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Stephan,

    There's no method to specifically add endpoints to an already registered well-known object. You will need to update the proxy for the registered well-known object using the updateObject method.

    Another and simpler option would be to use replica groups with the IceGrid registry dynamic registration configuration enabled. With this configuration, your IceBox servers can register their object adapter with an adapter ID and replica group ID automatically on activation. You just have to register the well-known object with an indirect proxy containing the replica group ID (e.g.: "[email protected]"). See Teach yourself IceGrid in 10 minutes for more information on IceGrid dynamic registration.

    Cheers,
    Benoit.
  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
    Hi Benoit,

    thanks for your reply.
    Could you please elaborate a bit further?

    I included
    IceGrid.Registry.DynamicRegistration=1
    
    into my registry configuration and according to your description
    prx = adapter.Add(myObjectInstance,
              Ice.Util.stringToIdentity("[email protected]");
    addObjectWithType(prx, "MyObject");
    

    Still an exception is thrown when the object is added as it is already present on the registry. Is there anything else I need to add? I'd like to admit that I'm familar with IceGrid but not with replicas :(

    cheers,

    Stephan
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Stephan,

    The Ice.Util.stringToIdentity("[email protected]") call in your code is wrong, it just creates another identity for object which has nothing to do with replica groups. The replica group that the object adapter belongs to is configured with the <oa>.ReplicaGroupId instead.

    To use replica groups, you need to:
    • Configure each sever object adapter with the <oa>.AdapterId and <oa>.ReplicaGroupId properties, for example for the demo/Ice/hello demo:
      Hello.AdapterId=Adapter1
      Hello.ReplicaGroupAdapterId=HelloReplicaGroup
      
      The AdapterId property needs to be unique to each server.
    • Register a well known object proxy with the registry once. You can for example do this with icegridadmin instead of doing it programatically:
      icegridadmin --Ice.Default.Locator=...
      > object add [email protected]
      

    You can try this with the Ice/hello demo. Note that you'll also need to add the Ice.Default.Locator property in the server and client configuration files and change the client Hello.Proxy property to "hello". You shouldn't have to change the code.

    Cheers,
    Benoit.
  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
    Hi Benoit,

    thanks for the explanation, this works like a charm!

    For anyone that wants to try this out: there is a small typo :) in Benoits explanation, the config should imho look like this:
    Hello.ReplicaGroupId=HelloReplicaGroup
    

    :)

    regs,

    Stephan
Sign In or Register to comment.