Archived

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

in service get info about icebox

Hi all! Please help me.

My question is next:

For example:

Something configure in Icegrid:
    <node name="node1">

      <icebox id="IceBox" activation="on-demand" exe="iceboxnet.exe">

        <service name="Service" entry="services.dll:ServiceI">
               ...
        </service>

      </icebox>
    </node>



I have node1 that run IceBox, IceBox run Service -> use method service:
   start(string name, Ice.Communicator communicator, string[] args)  
   {
        // ... Do something 
   } 

But how in body of this method(see above) get info about icebox and node? For example info such as: name node, name IceBox that corresponding to names in IceGrid config.

Cheers,
Jinn.

Comments

  • benoit
    benoit Rennes, France
    Hi,

    You can retrieve the server identifier by getting the Ice.ProgramName property. For other values, the easiest is to set properties with the information you need. For example for the node name:
        <node name="node1">
          <icebox id="IceBox" activation="on-demand" exe="iceboxnet.exe">
            <service name="Service" entry="services.dll:ServiceI">
              <properties>  
                <property name="Node" value="${node}"/>
              </properties>  
            </service>
          </icebox>
        </node>
    

    You can then retrieve the property value in the code:
    void
    start(string name, Ice.Communicator communicator, string[] args)  
    {
         Ice.Properties properties = communicator.getProperties();
         string serverId = properties.getProperty("Ice.ProgramName");
         string node = properties.getProperty("Node");
         ...
    }
    

    Cheers,
    Benoit.
  • Thank you very much for your response! :)

    Cheers,
    Jinn.