users@glassfish.java.net

Stream data to dynamically connected clients via JMS

From: <glassfish_at_javadesktop.org>
Date: Thu, 19 Jun 2008 02:40:06 PDT

Hello,

(This question is somewhat related to this thread started by Miroslav Nachev: http://forums.java.net/jive/thread.jspa?messageID=276329)

We need to connect client dynamically either directly via JMS or via intermediate HTTP servlets doing HTTP streaming. Our current working solution bases on JBoss, but we want to migrate to Glassfish which does not support our current technique.

In [b]JBoss[/b], it was possible to bind temporary queues/topics into JNDI. So every dynamically connected client created a temporary queue and put it into JNDI with an address based on the unique HTTP Session ID. Every message sent by the client had the source address as bound in the JNDI. In this way, other server components could sent back messages to the client. This met these two requirements:

[b]A.[/b] We could detect if the client is still alive. If the send failed the queue and the client were gone.
[b]B.[/b] If the client disappears, all messages are dropped.

With [b]Glassfish[/b], temporary queues are not serializable. So we have two ideas:

[b]1.The client/streaming servlets send a Register JMS message with the JMSReplyTo set to its streaming temporary queue. The server registers this queue and uses it for routing.[/b]

Question: Is the temporary queue retrieved from JMSReplyTo also not serializable? Otherwise, the server could again use JNDI as registry.

[b]2. We could use message selectors.[/b]

Requirement [b]A[/b] is then not met: We cannot detect whether the client still subscribes to the queue. Heartbeating would be a solution here.

Requirement [b]B[/b]: If the client disconnects, all messages are lost. With message selectors based on client IDs, the queue would fill with stale messages by disappeared clients.
What happens if we use non-durable topic subscriptions? Would all message not matched by any selector be dropped?

I am looking forward to any comments or helpful hints.

Cheers, Jörg
[Message sent by forum member 'jthoennes' (jthoennes)]

http://forums.java.net/jive/thread.jspa?messageID=281244