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

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



zhang zhi wei wrote:
> I was puzzled by your reply.
> 
> Firstly, the xmlBlaster server doesnot handle the return result of 
> Update method,
> then it doesnot know when to redeliver the message to client. Here the 
> main point is how to implement redelivery mechanism in xmlBlaster.

You don't need to modify the code.
If a client wants to signal an error it should
throw an XmlBlasterException from update() with
ErrorCode.USER_UPDATE*
In this case the message is redelivered.

The return value is not evaluated but will
in a future release to support transactions.
> 
> Of course, when client is down or crashed , the xmlBlaster server will 
> try to reconnect to client, but not redeliver to client.

In this case xmlBlaster will queue the message and
deliver it on reconnect, as described in a previous mail:

----------------------------------------
java org.xmlBlaster.Main

java javaclients.HelloWorldPublish -numPublish 100

(hit a key to publish messages)

java javaclients.HelloWorldSubscribe
     -session.name joe/2
     -dispatch/callback/retries -1
     -multiSubscribe false
     -dispatch/callback/pingInterval 2000
----------------------------------------

Now you can hit a key to subcribe, kill the susbcriber
publish some more messages, restart the subscriber
and the messages arrive.

> 
> and what's the redelivery meachanism in xmlBlaster?



Probably i havn't got your problem or you have found
a bug which i don't know of, in this
case please send me an example code with all details.

regards,

Marcel

> 
> the modification in the last message is OK? or if implementation of 
> redelivery mechanism in
> xmlblaster, are there any other places must be  modified?
> 
> thanks a lot!
> 
> 
>> From: Marcel Ruff <mr at marcelruff.info>
>> Reply-To: xmlblaster at server.xmlBlaster.org
>> To: xmlblaster at server.xmlblaster.org, pi_kyuan at cvicse.com
>> Subject: Re: [xmlblaster] questions about return value of update() method
>> Date: Mon, 25 Aug 2003 00:43:33 +0200
>>
>> 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
>>
> 
> _________________________________________________________________
> 享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com 
> 


-- 
http://www.xmlBlaster.org