[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] modify in ConnectionsHandler.cpp



Hi again,

your code does the subscribe and additionally it puts the
subscribe request into the queue.
I believe this is to force auto-re-subscribing after the server
was away.
A better solution is probably to use persistent subscribes
in the server as described in

  http://www.xmlblaster.org/xmlBlaster/doc/requirements/engine.persistence.subscription.html

if the server fails the old susbcriptions are there again,
if there was a only temporary network problem no action is needed.

With your code all subscriptions are allways queued
which may lead to multiple subscriptions after flushing the queue
after a network problem
when reaching the same server instance again (if not multiple subscribe
was switched off in the subscribe QoS).

What is you exact problem you wanted to solve,
i would need more info to decide if/how to add your
code to the distribution.

thanks

Marcel


> pikaiyuan wrote:
> 
>>Hello
>>
>>	I found there has some bug in connectionshandler.cpp like this: 
>>you are maybe forget to add SubscribeQueueEntry and UnSubscribeQueueEntry
>>to ClientQueueProperty, and result in some bugs when program runs in failsafe model.
>>    It runs correctly after I had made some changes.
> 
> 
> Hi,
> 
> thanks for reporting, we will look into this issue
> for the next release.
> 
> 
>>1. in subscribe() method
>>   try {
>>      SubscribeReturnQos ret = connection_->subscribe(key, qos);
>>      //add by pky to add subscribe entries to client ram queue
>>      if (!queue_) {
>>	      if (!connectQos_) {
>>	         throw XmlBlasterException(INTERNAL_SUBSCRIBE, ME + "::queuesubscribe", 
>>             "need to create a queue but the connectQos is NULL (probably never connected)");
>>	      }
>>	      if (log_.trace()) log_.trace(ME+":queueSubscribe", "creating a client queue ...");
>>	      queue_ = &QueueFactory::getFactory().getPlugin(global_, connectQos_->getClientQueueProperty());
>>	      log_.info(ME+":queuesubscribe", "created a client queue");
>>	   }
>>	   if (log_.trace()) 
>>	      log_.trace(ME, string("queuesubscribe: entry has been queued"));
>>	   SubscribeQueueEntry entry(global_, key, qos);
>>	   queue_->put(entry);
>>       //end
>>       return ret;
>>   }   
>>   catch (XmlBlasterException& ex) {
>>      if ( ex.isCommunication() ) toPollingOrDead(&ex);
>>      throw ex;
>>   }
>>
>>2. in unsubscribe() method
>>   try {
>>      vector<UnSubscribeReturnQos> ret = connection_->unSubscribe(key, qos);
>>	  //add by pky to add unsubscribe entries to client ram queue
>>      if (!queue_) {
>>	      if (!connectQos_) {
>>	         throw XmlBlasterException(INTERNAL_UNSUBSCRIBE, ME + "::queueunsubscribe", 
>>             "need to create a queue but the connectQos is NULL (probably never connected)");
>>	      }
>>	      if (log_.trace()) log_.trace(ME+":queueunsubscribe", "creating a client queue ...");
>>	      queue_ = &QueueFactory::getFactory().getPlugin(global_, connectQos_->getClientQueueProperty());
>>	      log_.info(ME+":queueunsubscribe", "created a client queue");
>>	   }
>>	   if (log_.trace()) 
>>	      log_.trace(ME, string("queueunsubscribe: entry has been queued"));
>>       UnSubscribeQueueEntry entry(global_, key, qos);
>>	   queue_->put(entry);
>>       //end
>>       return ret;
>>   }   
>>   catch (XmlBlasterException& ex) {
>>      if ( ex.isCommunication() ) toPollingOrDead(&ex);
>>      throw ex;
>>   }
>>
>>  By the way, does anyone has a look at ptp model in cplusplus client side.
> 
> It should run fine, do you experience any problems?
> 
> best regards,
> 
> Marcel
> 
>>thanks any way        
>> 				
>>
>>			   pikaiyuan
>>			   2004-07-01	   
>>
>>
> 
> 
> 


-- 
http://www.xmlBlaster.org