Archived

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

Glacier2 with other local servers

I want to have a connection to a local server and to the Glacier2 router to get data in a single application. I am attempting to do so by putting the endpoints of the local server in the config file for the app. When the app trys to use MarketDataService, it stills goes to the router. Do I need to make another adaptor to do this?

It is like the below:
MarketDataService=marketdataservice:tcp -p 11111 -h 127.0.0.1

Ice.Default.Router=Router-2/router:default -p 14005 -h 10.3.0.79

PrimaryFeed.Subscriber.Endpoints=tcp
PrimaryFeed.Subscriber.Router=Router-2/router:default -p 14005 -h 10.3.0.79

Comments

  • matthew
    matthew NL, Canada
    The connection to the MarketDataService service should NOT be routed, is that correct? The reason why your application does not do this is because you have set the default router through the Ice.Default.Router property. So you can either:

    - Not set a default router, and instead set the router on a per-proxy basis. This is the better choice if the majority of your proxies are NOT routed.
    - Set a default proxy, and override the router on a per-proxy basis. This is the better choice if the majority of your proxies ARE routed.

    You can set or unset the router by calling the ice_router method on the proxy. Another way of doing this is to use propertyToProxy along with associated proxies. You can read about this in the Ice manual, or I described all of this in my article in issue 23 http://www.zeroc.com/newsletter/issue23.pdf.
  • matthew wrote: »
    The connection to the MarketDataService service should NOT be routed, is that correct?
    correct
    matthew wrote: »
    - Not set a default router, and instead set the router on a per-proxy basis. This is the better choice if the majority of your proxies are NOT routed.
    - Set a default proxy, and override the router on a per-proxy basis. This is the better choice if the majority of your proxies ARE routed.

    The second one applies here. I cannot figure this out from the documentation. Could you help me out here? Given the example configuration file, do I keep it the same and change my C++ code or do I do something in the configuration file to get this to work? I understand what you are saying, I think, but I am not sure what to do. I do not see a Default.Proxy property.
    matthew wrote: »
    You can set or unset the router by calling the ice_router method on the proxy. Another way of doing this is to use propertyToProxy along with associated proxies. You can read about this in the Ice manual, or I described all of this in my article in issue 23 http://www.zeroc.com/newsletter/issue23.pdf.

    I am
  • I finally figured it out from the newsletter.

    Thanks
  • I am using the following in C++:
    try
            {
                    Ice::ObjectPrx base = communicator()->propertyToProxy("MarketData");
                    base = base->ice_router(0);
                   _mds = Kcco::MarketDataServicePrx::uncheckedCast(base);
            }
    
            catch( const Ice::NotRegisteredException& )
            {
                    try
                    {
                            _mds = Kcco::MarketDataServicePrx::uncheckedCast(communicator()->stringToProxy("marketdataservice"));
                            //_mds = Kcco::MarketDataServicePrx::uncheckedCast(query->findObjectByType("::Kcco::MarketDataService"));
                    }
                    catch( const Ice::NotRegisteredException& )
                    {
                            exit(-1);
                    }
            }
    

    Is there a way to do this in the config file.

    Tim
  • dwayne
    dwayne St. John's, Newfoundland
    You could do the following in your config file to unset the router per proxy as long as you use propertyToProxy() in your code to create the proxy.
    Ice.Default.Router=Router-2/router:default -p 14005 -h 10.3.0.79
    
    MarketDataService=marketdataservice:tcp -p 11111 -h 127.0.0.1
    MarketDataService.Router=""
    
  • dwayne wrote: »
    You could do the following in your config file to unset the router per proxy as long as you use propertyToProxy() in your code to create the proxy.
    Ice.Default.Router=Router-2/router:default -p 14005 -h 10.3.0.79
    
    MarketDataService=marketdataservice:tcp -p 11111 -h 127.0.0.1
    MarketDataService.Router=""
    


    Thanks Dwayne. I was setting the Router to 0 and it was failing. It works now.

    Tim