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

Re: [xmlblaster] persistance with subscription and sessions



Martin Johnson wrote:

>>Sent again in case registration process bounced first attempt to send.

Hi Marcel, Michele,

Below is and extract from another message on the list

/--
4. -multiSubscribe false
  when the subscriber restarts it does the same subscribe
  again and you would receive the messages twice.

  Setting this to 'false' will ignore duplicate identical
  subscribes

  (An alternative solution:
   We could change the code of HelloWorldSubscribe to
   check if it has reconnected to the previous session

   and in this case not do a subscribe anymore).
--/

I really like to know the technique to do this rather than having multiSubscribe==false.
1) multiSubscribe=false is the smart way to go, the server takes care to not subscribe twice.

2) The alternative solution loads the burden to your client code.
You need to save the secret session id from the ConnectReturnQos to your hard disk.
On client restart and reconnect it loads the secretSessionId from hard disk again and
compares it with the new one from the new ConnectReturnQos.
If they are equal you know that the server still knows everything about us,
if they are different you know that the server may have been down (or has destroyed
your server session because of your settings) and has lost previous (none persistent) subscribes.


3) A third variant could query the existing subscriptions via a administrative command or JMX from
the server and react accordingly.


regards
Marcel


I have a crashing client (for other systematic reasons) and can end up with many many subscriptions.


Love to be able to avoid this.

Regards

Martin




--
Marcel Ruff
http://www.xmlBlaster.org