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

Re: [xmlblaster] questions about return value of update() method



pikaiyuan wrote:
> Hi,everybody
> 	
> 	I want to use the xmlblaster as a mom in my work, and there is a publish/subscribe  scenario:
> 	There is a business logic which deals with the messages delivered from the	 xmlbalster server in the update method of the subscriber, if the business logic returns false, maybe there has some errors in the deliveryed messages, and must be redelivered from the xmlblaster server.
> 	
>     I had read the source file(CbDeliveryConnection.java),and the return value is ignored.
Hi,

clients which can not process update messages should throw an

 update() ... {
   ...
   Global glob = updateKey.getGlobal();
   throw new XmlBlasterException(glob, ErrorCode.USER_UPDATE_ERROR, ...)
 }

see

 http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.update.html

In this case the retries works as expected.

Note that the returned states (like RET_OK) are currently not
evaluated, they are reserved for the future transaction support,

regards

Marcel



> 	
> 	I want to add some redelivery controls in doSend method of CbDeliveryConnection.java just like this:
> 		if (-1==address.getRetries())
> 		{
> 			int iRetriesCounter = 0;
>          	while (true)
>          	{
>          		rawReturnVal = cbDriver.sendUpdate(msgUnitRawArr);
>          		if (rawReturnVal[0].equals(org.inforMessaging.util.enum.Constants.RET_OK)) break;
>          		iRetriesCounter ++;
>          		rawReturnVal = null;
>          		
>          		try { Thread.currentThread().sleep(address.getPingInterval()); } catch (Exception e) { } 
>          	}
>         }
>         else
>         {
>          	for (int i=0; i<address.getRetries(); i++)
>          	{
>          		rawReturnVal = cbDriver.sendUpdate(msgUnitRawArr);
>          		if (rawReturnVal[0].equals(org.inforMessaging.util.enum.Constants.RET_OK)) break;
>          		rawReturnVal = null;
>          		try { Thread.currentThread().sleep(address.getPingInterval()); } catch (Exception e) { } 
>          	}
>         }
> 
> 	Is any problem in my changes to the whole xmlblaster project? any unknowable effect to other programs?
> 	
> 	Any help is appreciated.
> 	Thanks!
> 	
> 		
> pikaiyuan
> pi_kyuan at cvicse.com
> 2003-08-24
> 
> 
> 


-- 
http://www.xmlBlaster.org