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

[xmlblaster] RE: Durable subscriptions


your email got bounced because of your provider
zzwzyz at 163.com adds html to you messages.
Please try to avoid this in future as our mailing list
does not accept HTML.

> how to implement persistent subscriber in xmlblaster.
> The enviroment is c++ , xmlblaster 848 version.
> for example,
>   I run the  xmlblaster server.  a publisher , a subscriber;
>   publisher publish 100 message,
>   subscriber receive 10 message , then shutdown the subsciber,
>  I want restart the subscriber, and the subscriber receive the remaining 90 message.
Here is an example in Java:

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 subcriber
publish some more messages, restart the subscriber
and the messages arrive.

1. -session.name joe/2
  assures that you reconnect to the same session id '2'

2. -dispatch/callback/retries -1
  assures that xmlBlaster does not destroy the joe/2
  session when the callback of the subscriber disappears

3. -dispatch/callback/pingInterval 2000
  is just that xmlBlaster server pings the callback server
  every 2 seconds instead of every minute (this is optional)

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
  (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 have not tried this with C++ but it should work as well.
Note that the C++ client library does resubscribe automatically
on reconnect if necessary (is this true Michele??)