Results 1 to 2 of 2

Thread: Problems when distributing messages through IceStorm to multiple replicas

  1. #1
    lmgarcia is offline Registered User
    Name: Luis Miguel Garcia
    Organization: UCLM
    Project: Agent Platform
    Join Date
    Sep 2011
    Posts
    1

    Problems when distributing messages through IceStorm to multiple replicas

    Hi everybody,

    I'm having an issue when using Icestorm in my application, which involves a replication mechanism in my own application-domain service. The followed approach is similar to highly available Icestorm, that is, a master-slave scheme where only the master updates the state but read-only operations can be attended by any replica.

    I use Icestorm to distribute changes from the master to the slaves and to decide who the master is (bully algorithm). Basically, the problem is that the messages sent by a replica do not reach the others when are distributed through IceStorm. In fact, only the replica that sends a message receives it. However, if a replica receives a message via an indirect proxy, for instance, instead of using a topic, then there is no problem at all.

    All the replicas are publishers and are subscribed to the topics for the replication system and the master election. I hope the following code clarifies my explanation:

    Code:
    // The names starting with an underline are private attributes of the class.
    
    void AMSI::setPublisherAndSubscriber(const Ice::CommunicatorPtr& communicator)
    {
      Ice::ObjectPrx obj = communicator->stringToProxy("FIPA.IceStorm/TopicManager");
      _topicManager = IceStorm::TopicManagerPrx::checkedCast(obj);
    
      _amsTopicManagerProxy = _adapter->addWithUUID(
        new AMSTopicManagerI(e_priority, this))->ice_twoway();
    
      string topicName[] = {"electionsAMS", "replicaInfoAMS"};
      IceStorm::TopicPrx topic[2];
    
      for (int i = 0; i < 2; ++i)
      {
    
        // Set the publishers.
    
        while (!topic[i])
        {
          try
          {
            topic[i] = _topicManager->retrieve(topicName[i]);
          }
    
          catch (const IceStorm::NoSuchTopic&)
          {
            try
            {
              topic[i] = _topicManager->create(topicName[i]);
            }
            catch (const IceStorm::TopicExists&) {}
          }
        }
    
        Ice::ObjectPrx pub = topic[i]->getPublisher()->ice_twoway();
    
        if (i == 0)
          _electionPublisher = FIPA::AMSTopicManagerPrx::uncheckedCast(pub);
        else
          _replicaPublisher = FIPA::AMSTopicManagerPrx::uncheckedCast(pub);
    
        // Subscribers.
    
        IceStorm::QoS qos;
        qos["reliability"] = "ordered";
        qos["retryCount"] = AMS_ICESTORM_RETRY; // this is 3
        topic[i]->subscribeAndGetPublisher(qos, _amsTopicManagerProxy);
    
      } // end for
    
    }
    AMSTopicManagerI handles the received messages and also discards the messages that come from itself. The server is an Icebox service and all the application is deployed with Icegrid.

    I suspect I'm missing something when using objects that are publishers and subscribers at the same time.

    Thanks a lot for your help in advance.

  2. #2
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Luis,

    I didn't spot anything wrong with your code. If IceStorm cannot reach your (other) subscribers for some reason, you should turn on some tracing to figure it out, for example:
    Ice.Trace.Network
    IceStorm.Trace.Subscriber

    Is _adapter a direct adapter? What is its endpoint configuration?

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Throttling of messages in Icestorm
    By mangrish in forum Help Center
    Replies: 5
    Last Post: 10-12-2009, 08:56 AM
  2. Could IceStorm messages use proxy as parameter?
    By cxq2003 in forum Help Center
    Replies: 0
    Last Post: 05-18-2009, 12:10 PM
  3. Replies: 0
    Last Post: 04-21-2009, 11:41 AM
  4. Replies: 7
    Last Post: 02-17-2006, 11:30 PM
  5. IceStorm: Persistent messages
    By stephan in forum Help Center
    Replies: 1
    Last Post: 09-15-2004, 09:11 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
  •