Results 1 to 4 of 4

Thread: IceStorm and Services inside a IceGrid

  1. #1
    undici77 is offline Registered User
    Name: Alessandro Barbieri
    Organization: EGICON
    Project: ATS
    Join Date
    Jan 2011
    Posts
    6

    IceStorm and Services inside a IceGrid

    Hello, I'm a new Ice User, and I'm trying to develop an application (Server and Cilent) where I would have 1 Service (HelloService) that expone a function 'Hello', and a Thread that publish on a IceStorm Topic the current time every second.

    Server Side, I have written the code in C++, and I'm trying to develop the client in Java.

    I start IceGrid with this cfg file:
    Code:
    IceGrid.InstanceName=AtsGrid
    Ice.Default.Locator=AtsGrid/Locator:default -p 4061
    IceStorm.TopicManager.Proxy=IceStorm/TopicManager
    IceGrid.Registry.DefaultTemplates=C:\Program Files\ZeroC\Ice-3.4.1\config\templates.xml
    IceGrid.Registry.Client.Endpoints=default -p 4061
    IceGrid.Registry.Server.Endpoints=default
    IceGrid.Registry.Internal.Endpoints=default
    IceGrid.Registry.Data=db/registry
    IceGrid.Registry.PermissionsVerifier=AtsGrid/NullPermissionsVerifier
    IceGrid.Registry.AdminPermissionsVerifier=AtsGrid/NullPermissionsVerifier
    IceGrid.Registry.SSLPermissionsVerifier=AtsGrid/NullSSLPermissionsVerifier
    IceGrid.Registry.AdminSSLPermissionsVerifier=AtsGrid/NullSSLPermissionsVerifier
    
    IceGrid.Node.Name=node1
    IceGrid.Node.Endpoints=default
    IceGrid.Node.Data=db/node
    IceGrid.Node.CollocateRegistry=1
    
    IceGrid.Node.Trace.Activator=1
    
    IceGridAdmin.Username=foo
    IceGridAdmin.Password=bar
    After I have registered this application.xml:
    Code:
    <icegrid>
    
      <application name="Simple" import-default-templates="true">
    
        <node name="node1">
    
          <server-instance template="IceStorm" instance-name="IceStorm"/>
    
          <server id="SimpleServer" exe=".\bind\server_prova" activation="always">
            <adapter name="Hello" endpoints="tcp">
              <object identity="hello" type="::Demo::Hello" property="Identity"/>
            </adapter>
            <adapter name="Clock" endpoints="tcp">
              <object identity="clock" type="::Demo::Clock" property="Identity"/>
            </adapter>
          </server>
        </node>
    
      </application>
    
    </icegrid>
    Where Demo::Hello is the service, and Demo::Clock is the Topic Publisher.

    Until here, Everything appear to work correctly:
    Code:
    C:\Project\atsGrid\cpp\atsNode>icegridnode --Ice.Config=grid.cfg
    -- 11/02/11 17:39:20.048 icegridnode: Activator: activating server `SimpleServer'
    -- 11/02/11 17:39:20.095 icegridnode: Activator: activating server `IceStorm'
    Just pubblished : 11/02/11 17:39:20.313
    Just pubblished : 11/02/11 17:39:21.343
    Just pubblished : 11/02/11 17:39:22.357
    Just pubblished : 11/02/11 17:39:23.371
    Just pubblished : 11/02/11 17:39:24.385
    Just pubblished : 11/02/11 17:39:25.399
    But now, I can't subscribe the IceStorm Topic from My Java code:
    This is my configuration:
    Code:
    Ice.Default.Locator=AtsGrid/Locator:default -p 4061
    IceStorm.TopicManager.Proxy=IceStorm/TopicManager
    This is the subscriber code
    Code:
    String topicName = "time";
    String option = "None";
    boolean batch = false;
    String id = null;
    String retryCount = null;
    int i;
            
    if(batch && (option.equals("Twoway") || option.equals("Ordered")))
    {
        System.err.println(appName() + ": batch can only be set with oneway or datagram");
        return 1;
    }
    
    IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast(
                communicator().stringToProxy("IceStorm/TopicManager"));
    if(manager == null)
    {
        System.err.println("invalid proxy");
        return 1;
    }
    
    try
    {
        topic = manager.retrieve(topicName);
    }
    catch(IceStorm.NoSuchTopic e)
    {
        try
        {
           topic = manager.create(topicName);
        }
        catch(IceStorm.TopicExists ex)
        {
            System.err.println(appName() + ": temporary failure, try again.");
             return 1;
        }
    }
            
            
    adapter = communicator().createObjectAdapter("Clock.Subscriber");
    When I call communicator().createObjectAdapter I Get this Exception:

    Ice.InitializationException
    reason = "object adapter `Clock.Subscriber' requires configuration"

    Any ideas?

    Thanks!
    Last edited by undici77; 11-02-2011 at 01:51 PM.

  2. #2
    undici77 is offline Registered User
    Name: Alessandro Barbieri
    Organization: EGICON
    Project: ATS
    Join Date
    Jan 2011
    Posts
    6

    Addendum

    I developed my examples following this thread:
    IceGrid and IceStorm Example

    Any Ideas?

  3. #3
    benoit's Avatar
    benoit is online now ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi

    You need to configure the endpoints for the object adapter named "Clock.Subscriber" from your subscriber. You can either do this with properties by setting the property Clock.Subscriber.Endpoints=tcp or by using the createObjectAdapterWithEndpoints("Clock.Subscriber ", "tcp") communicator call.

    Cheers,
    Benoit.

  4. #4
    undici77 is offline Registered User
    Name: Alessandro Barbieri
    Organization: EGICON
    Project: ATS
    Join Date
    Jan 2011
    Posts
    6
    Hi Benoit,
    thanks for your answer. Now my example work very well!!

    Greetings
    Alessandro

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to uninstall icegrid services
    By dormantdemon in forum Help Center
    Replies: 2
    Last Post: 05-18-2009, 12:09 PM
  2. Sequence inside a structure
    By msorensson in forum Help Center
    Replies: 1
    Last Post: 01-19-2009, 07:42 AM
  3. Set properties inside Ice::Application
    By vanjogja in forum Help Center
    Replies: 2
    Last Post: 01-25-2008, 05:57 AM
  4. IceBox hosting java services in IceGrid
    By Sameerrele in forum Help Center
    Replies: 5
    Last Post: 08-21-2006, 10:56 AM
  5. Replies: 1
    Last Post: 06-21-2006, 11:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •