Home Help Center

Use Multiple Locators When Linking Topics

kantorhskantorhs Member Harry KantorOrganization: DODProject: Mine Hunting Combat Systems
I currently have two different systems (A and B). Each system is running an IceGridNode which runs a replicated IceStorm (based off of the examples in the demo/IceStorm/replicated directory). I create a topic "Foo.A" on system A and want to link that topic to system B. My basic requirement is that system B can come and go, listening to events when it wants. Since system B may not always be turned on I can't replicate the IceStorms across the two systems.


I use the following configuration file:

Ice.Default.Locator=A_DemoIceGrid/Locator:default -h <a_ip_addr> -p 4061
IceStormAdmin.TopicManager.A=A_IceStorm/TopicManager
TopicManager.Proxy=A_IceStorm/TopicManager

B_IceStorm/[email protected]=B_IceStorm/[email protected]
B_IceStorm/[email protected]=B_DemoIceGrid/Locator:default -h <b_ip_addr> -p 4061



I then wrote a little Java code to query all of the topics that exist in the IceStorm in system A. For each topic I then try and create the same topic in system B. When I run the software from system B I am presented with the exception Ice.NotRegisteredException (B_IceStorm/TopicManager). I turn on some tracing (Network=2, Protocol=1, Locator=2) and it appears that system B's locator is not being used.

I have tried to programatically tried to change the default locator on the communicator but that prevents me from being able to communicate with A_IceStorm (Ice.NotRegisteredException: A_IceStorm-TopicManagerReplicaGroup).

Any help here would be appreciated.

Comments

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

    You can override the locator on a per-proxy basis using the proxy ice_locator method. This is equivalent to setting the proxy .Locator property in the configuration like you did with the "B_IceStorm/[email protected]" property. Note however that you need to create the proxy with the Ice::Communicator::propertyToProxy method:
    // Java
    Ice.ObjectPrx prx = communicator.propertyToProxy("B_IceStorm/[email protected]");
    System.out.println(prx.ice_getLocator());
    

    Note also that the locator associated to a proxy is a local parameter. It isn't transmitted over the wire. So if you send an indirect proxy for a topic from B to the A IceStorm service, this IceStorm service won't be able to locate the topic.

    Cheers,
    Benoit.
  • kantorhskantorhs Member Harry KantorOrganization: DODProject: Mine Hunting Combat Systems
    Based on the very last piece of your reply I don't think that I will be able to do what I want to do. Is that correct?

    If not, is there a way to accomplish this other than writing an application that registers for the event on IceStorm A and sends it to IceStorm B?
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Yes, I'm afraid there isn't any easy options. Implementing the forwarding yourself is one option. You could also reconsider if using two IceGrid domains is really necessary. Yet another option would be to configure IceStorm to instead listen on fixed TCP/IP ports and not register its objects adapters with IceGrid. This way, IceStorm won't publish indirect proxies but direct proxies that don't need to be resolved.

    Cheers,
    Benoit.
  • kantorhskantorhs Member Harry KantorOrganization: DODProject: Mine Hunting Combat Systems
    I agree that there are no easy options. I am able to forward a single event between IceStorms, but I would need to start auto-generating this "glue" code since it has to be written per-event.

    I do think that changing to a fixed TCP/IP port for my IceStorms is the easy button. I am pretty sure that I should start looking at the example in demo/IceStorm/replicated2

    Thanks again for your help.
Sign In or Register to comment.