Archived

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

subscribe to IceStorm: works from code, doesn't from config

I have a server which publishes something to IceStorm. A client then tries to subscribe to the IceStorm topic. If I use createObjectAdapterWithEndpoints() function everything works as it should. If I try to use createObjectAdapter() with a config file for the client, IceStorm says there's "no suitable endpoint available".

The client adapter in both cases seems to be initialized ("accepting tcp connections"). I also turned the ready-printout on (Ice.PrintAdapterReady=1), and it looks good.

any ideas on how else to troubleshoot?
thanks a lot, alex



============================================================
====== CREATE ADAPTER WITH ENDPOINTS : WORKS! =======
============================================================

=== TOPIC SUBSCRIBER CODE ===
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("MyAdapter", "default");

=== TOPIC SUBSCRIBER ===
testclient$ ./testclient --Ice.Config=testclient.cfg
[ ./testclient: Network: attempting to bind to tcp socket 127.0.0.1:0 ]
[ ./testclient: Network: accepting tcp connections at 127.0.0.1:33215 ]
MyAdapter ready

=== ICESTORM ===
[ icebox-IceStorm: Network: accepted tcp connection
local address = 127.0.0.1:10000
remote address = 127.0.0.1:33219 ]
[ icebox-IceStorm: Topic: Subscribe: position2dConsumerCallback ]
[ icebox-IceStorm: Flush: 1 object(s) ]
[ icebox-IceStorm: Network: trying to establish tcp connection to 127.0.0.1:33215 ]
[ icebox-IceStorm: Network: tcp connection established
local address = 127.0.0.1:33220
remote address = 127.0.0.1:33215 ]
[ icebox-IceStorm: Flush: 1 object(s) ]
[ icebox-IceStorm: Flush: 1 object(s) ]



============================================================
====== CREATE ADAPTER WITH CONFIG FILE : DOES NOT WORK! =======
============================================================


=== TOPIC SUBSCRIBER CODE ===
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter( "MyAdapter" );

=== TOPIC SUBSCRIBER CONFIG ===
MyAdapter.AdapterId=coffee/testclient
MyAdapter.Endpoints=default

=== TOPIC SUBSCRIBER ===
testclient$ ./testclient --Ice.Config=testclient.cfg
[ ./testclient: Network: attempting to bind to tcp socket 127.0.0.1:0 ]
[ ./testclient: Network: accepting tcp connections at 127.0.0.1:33203 ]
MyAdapter ready

=== ICESTORM ===
[ icebox-IceStorm: Network: accepted tcp connection
local address = 127.0.0.1:10000
remote address = 127.0.0.1:33213 ]
[ icebox-IceStorm: Topic: Subscribe: position2dConsumerCallback ]
[ icebox-IceStorm: Flush: 1 object(s) ]
[ icebox-IceStorm: Subscriber: position2dConsumerCallback: publish failed: Reference.cpp:1103: Ice::NoEndpointException:
no suitable endpoint available for proxy `position2dConsumerCallback -O @ coffee/testclient' ]
[ icebox-IceStorm: Flush: 0 object(s) ]


=== ICESTORM CONFIGURATION ===
IceStorm.TopicManager.Endpoints=default -p 10000
IceStorm.Publish.Endpoints=default
IceStorm.Trace.TopicManager=2
IceStorm.Trace.Topic=1
IceStorm.Trace.Subscriber=2
IceStorm.Trace.Flush=1
IceStorm.Flush.Timeout = 2000

Comments

  • marc
    marc Florida
    n2503v wrote:
    MyAdapter.AdapterId=coffee/testclient

    Remove this line. This will make the OA generate indirect proxies, which I assume is not what you want to do.
  • Thanks a lot Mark, that puts me on the right track. I've read the related stuff in the manual but can't find answers to the following:

    1. can I create a direct or indirect proxy explicitly from an OA? or convert from one proxy type to another?

    2. if not, than what do I do in my case: I need an adapter which registers itself with IcePackRegistry (so that some objects can be found through it) AND a direct proxy for subscribing to IceStorm. Do I need two OA's in this case? (The connections-7 article does not cover this case :)

    thanks again for the quick response, alex
  • benoit
    benoit Rennes, France
    If your object adapter is configured with an adapter id (with the <adapter name>.AdapterId property):
    • the Ice::ObjectAdapter::createProxy() method will create indirect proxies
    • the Ice::ObjectAdapter::createDirectProxy() method will create direct proxies.

    You have 2 options to register your subscriber with IceStorm:
    • Register your subscriber with a direct proxy that you've created with the createDirectProxy method if your adapter is configured with an adapter id.
    • Register your subscriber with an indirect proxy. For this to work you must make sure to set the Ice.Default.Locator property in your IceStorm configuration. Otherwise, the IceStorm service wouldn't be able to get the endpoints of the indirect proxy and you would get the problem you've mentioned in your first post (the Ice::NoEndpointException).

    Benoit.
  • Thanks for your help guys. Now it's all clear and works.

    Knowing the name of the function I found all the info in the chapter on Locator service. I wish I could look up the *complete* interface for Communicator or Object Adapter (e.g. I would've found createDirectProxy() by myself). Is it in the manual? Where?

    cheers, alex
  • marc
    marc Florida
    It's all in the manual. See page 1243.