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

Re: [xmlblaster] Notifying Clients



chris lau wrote:
Hi,

I am trying to setup a situation where client A publishes a PTP message to client B. Client B
subscribes for updates using the callback method. The problem I'm running into is that I want
Client B to get a notification that a message has arrived but I *do not want* to remove the
message from the queue. Client B will then use the get() method at a later time to retrieve the
message.
If it is only one message which B is waiting on you could throw a
"user.update.holdback"
(see http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.update.html)
during update(), like this B is notified and the message remains in the servers callback queue.
After retrieving the message with get() you can set the dispatcherActive=true again.


Another possibility is that B logs in as B/1 and B/2.
If the PtP is send to B, both session will receive it.
Now B/1 gets it consuming over update() and is 'notified'.
B/2 didn't specify a callback server and did set dispatcherActive=false during connect().
Now B/2 uses sync get()s only to retrieve.


Still another solution is to use a receive() call setting consuming=false.
(see http://www.xmlblaster.org/xmlBlaster/doc/client-api/org/xmlBlaster/client/I_XmlBlasterAccess.html#receive(java.lang.String,%20int,%20long,%20boolean)
Now B blocks and returns when the message has arrived ("notifiy").
Later, you can call receive() with consumable=true to access and destroy it.


Another possibility is to have another login session to subscribe on the PtP topic
and is like this notified. B has set dispatcherActive=false already during connect
and only uses get() or receive() synchronously whenever needed.


Probably there are some more ways to solve it,

regards
Marcel
What is happening now is that as soon a Client A publishes a message and the update() method of
Client B is triggered, the message is removed from the queue.

I've tried to set the subscribeQos.setWantContent to false, but that doesn't keep the message in
the queue.

So, basically, here is the sequence of events.
1. Client B connects and subscribes for updates.
2. Client A connects and publishes a message.
3. Client B receives a notification that a message has arrived. Message remains in queue.
4. A period of time elapses...
5. Client B retrieves message contents. 6. Client B removes message from queue (if not done automatically)


Is xmlBlaster able to do this?

Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com