Archived

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

Location transparency

Hello!

I am developing a basic arquitecture for a Multi-Agent System under the FIPA Standard, and I am using Ice to develop it.

When an agent start up, I must provide a mechanism so that the agent can adquire an address. This mechanism must be transparent (because an agent can be executed in different computers), therefore I need Ice chooses the endpoints for the agent.

I have tried to use the IceGrid::Admin interface in a similar way that the Ice Documentation exposes (page 1035), but I obtain an Ice::NoEndpointException. I suppose this exception is the result of not specifying the endpoints, but I want Ice does it for me so that each agent can be a well-known object.

Thank you very much.

Comments

  • benoit
    benoit Rennes, France
    Hi David,

    I suppose that it's the client which is getting the Ice::NoEndpointException? Do you correctly set the Ice.Default.Locator property in the client configuration? How did you register the proxy for the well-known object with the IceGrid::Admin interface?

    Cheers,
    Benoit.
  • Hello!

    The problem is in the server side, in other words, in the Agent. The code I have proved is similar to the example exposed in the documentation:

    void
    AgentI::
    setContactAddress(string address, Ice::ObjectAdapterPtr& adapter)
    {

    adapter = communicator()->createObjectAdapter(this->getName()+"Adapter");
    Ice::Identity ident = Ice::stringToIdentity(this->getName());
    Ice::ObjectPrx obj = adapter->add(this, ident);
    Ice::ObjectPrx proxy = communicator()->stringToProxy("IceGrid/Admin");
    IceGrid::AdminPrx admin = IceGrid::AdminPrx::checkedCast(proxy);
    admin->addObjectWithType(obj, obj->ice_id());
    adapter->activate();

    }

    This method is included in the Agent class, which extends from Agent (obtained from the interface specified in Slice) and from Ice::Application.

    The Ice.Default.Locator property is ok, because when I deploy the application (with others well-known objects explicitly indicated) specified in an xml file there are not problems.

    My problem can be described with the following question: How can I add a well-known object to my application without including it in the xml file and without specifying its endpoints?

    Thank you again!
  • benoit
    benoit Rennes, France
    Did you check the value of the registered proxy with the icegridadmin tool? You can use the "object describe <identity>" command for example (with <identity> set to the name of your agent).

    Where do you specify the endpoints for the object adapter that you create? If you don't specify these endpoints, the object adapter won't have any endpoints (and the well-known object proxy as well...). You should either set the adpater endpoints with the <adapter name>.Endpoints property or use for example:
    adapter = communicator()->createObjectAdapterWithEndpoints(this->getName()+"Adapter", "tcp");
    

    Here the adapter will listen with "tcp" on all the network interfaces of your machine and with a TCP/IP port allocated by the system.

    Cheers,
    Benoit.