Archived

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

IceStorm Counter Demo in an IceGrid

I setup a service to be like the Counter IceStorm Demo. Is that type of service easily put into an IceGrid or should I rewrite it to be more conventional single publisher to publish the count and a secondary service to provide the current count? I would like to keep as is, but I cannot figure out how to put into an Ice Grid.

Also I have several publishers I want in the IceGrid and the IceGridAdmin tool says the did not start or timed out. Do I need to send a signal to the IceGrid to say it is alive? The Publishers are running just fine and I do see the data from them. Right now I am just ignoring the message and looking at the log file to see if it running.

Comments

  • benoit
    benoit Rennes, France
    bigtim wrote: »
    I setup a service to be like the Counter IceStorm Demo. Is that type of service easily put into an IceGrid or should I rewrite it to be more conventional single publisher to publish the count and a secondary service to provide the current count? I would like to keep as is, but I cannot figure out how to put into an Ice Grid.

    I'm not sure what you mean by "more conventional" but I don't see why you couldn't keep it as it is. You just need to write the correct deployment descriptor for the counter publisher. Something like the following should do the job:
       <server id="CounterServer" path="./server">
            <adapter name="Counter" register-process="true">
                <object identity="counter"/>
            </adapter>
            <property name="IceStorm.TopicManager.Proxy" value="..."/>
       </server>
    

    (you'll also need to modify the server code from Server.cpp to ensure that the server doesn't load anymore the "config.server" configuration file in the main() method)
    Also I have several publishers I want in the IceGrid and the IceGridAdmin tool says the did not start or timed out. Do I need to send a signal to the IceGrid to say it is alive? The Publishers are running just fine and I do see the data from them. Right now I am just ignoring the message and looking at the log file to see if it running.

    It's difficult to help without more information. Can you post the deployment descriptor you're using and samples of the server code showing how the server is initialized? You can also enable activation tracing on the IceGrid node with IceGrid.Node.Trace.Activator=2 to see how the IceGrid node activates your servers.

    Btw, which Ice version and platform do you use?

    Cheers,
    Benoit.
  • Benoit,

    I am using C++ under Gentoo Linux and Ice version 3.2.0. I am also using Qt 4.3.x for clients and MySQL for data storage. I am also developing client to run under Windows and the latest VC++. I first develop the client under Linux and then port to Windows. I will try the deployment descriptor you gave me for my server.

    As far as the publisher go, I am manually starting them from the IceGridAdmin tool under Windows. Below is the xml file I use to load the publisher.
    <icegrid>
    
      <application name="SP-PF">
          <node name="IceDev1">
          <server id="SPPF" exe="pricefeed" activation="on-demand">
                    <option>--market</option>
                    <option>SP</option>
                    <option>--exchange</option>
                    <option>CME</option>
                    <option>--type</option>
                    <option>underlying</option>
            <adapter name="Ticks" endpoints="tcp" register-process="true">
              <object identity="sp-underlying" type="::Price.Feed" property="Identity"/>
            </adapter>
          </server>
          </node>
      </application>
    </icegrid>
    


    The run function for the app is basically as follows:
            Ice::PropertiesPtr properties = communicator()->getProperties();
            IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCas
    t( communicator()->stringToProxy("PrimaryFeed/TopicManager"));
    
            if(!manager)
            {
                    cerr << "PriceFeed: invalid manager proxy" << endl;
                    exit(-1);
            }
    
    
           
            try
            {
                    topic = manager->retrieve(topicName());
            }
            catch(const IceStorm::TopicExists& e)
            {
                    cerr << e << " topic: " << e.name << " already there thank you!"
    << endl;
            }
            catch(const IceStorm::NoSuchTopic&)
            {
                    try
                    {
                            topic = manager->create(topicName());
                    }
                    catch(const IceStorm::TopicExists&)
                    {
                            cerr << argv[0] << ": temporary failure. try again." << e
    ndl;
                            return EXIT_FAILURE;
                    }
            }
    
            cerr << "TOPIC IS " << topicName() << endl;
            assert(topic);
            Ice::ObjectPrx obj = topic->getPublisher();
            if(!obj->ice_isDatagram())
            {
                    obj = obj->ice_oneway();
            }
    
           Price::FeedPrx tservice = Price::FeedPrx::uncheckedCast(obj);
            if( tservice == 0x0 )
            {
                    cerr << argv[0] << ": invalid proxy" << endl;exit(-1);
            }
    
    
  • benoit
    benoit Rennes, France
    &tYour code doesn't include the creation of the object adapter named "Ticks". Are you correctly creating this adapter and activating it in a timely manner?

    The server is considered "active; by the IceGrid node once all its registered object adapters have been activated (i.e.: the adapters declared in the deployment descriptor have been activated with adapter->activate()). If these adapters are not activated in a timely manner (the default activation timeout is 60s), the IceGrid node considers that the server activation timed out.

    I recommend enabling more tracing on your IceGrid node to better understand the activation of your servers and see if it can give you some clues. You can set the following tracing in your IceGrid node configuration file:
    IceGrid.Node.Trace.Activator=2
    IceGrid.Node.Trace.Server=2
    IceGrid.Node.Trace.Adapter=2
    

    Please post the traces from the IceGrid node with these properties set if you need further help with this. It would also help to see more of your server code to ensure the initialization of the object adapter is correct.

    Cheers,
    Benoit.
  • I do not have an Adaptor in this server. It is fashioned after the clock demo. I set up the topic as shown and then go off and wait for some event to happen and then I publish it. In this Price::Feed, I wait for a price change to come along and then publish it. If I activated an adaptor, I am not sure it would work correctly.

    Thanks for the help and I will try to set up the traces.
  • benoit
    benoit Rennes, France
    Hmm, why do you declare the <adapter name="Ticks" ...> element in the server descriptor if your server doesn't have any object adapters? If the server doesn't have any adapters, you shouldn't declare any in the descriptor. Most likely, the server activation times out because IceGrid expect this adapter to be activated.

    Cheers,
    Benoit.
  • Duh on my part. I took it out and it is ok.

    Thanks!!!