[jboss-user] [Messaging, JMS & JBossMQ] - Re: Monitoring new connections to a topic

adrian@jboss.org do-not-reply at jboss.com
Tue Jul 10 09:20:36 EDT 2007


"chris05atm" wrote : 
  | Using subscribe() my Interceptor will broadcast a message to the topic whenever a client connects. The problem is I guess the message is broadcast before the connecting client starts receiving messages. Every other connected client receives the broadcasted message except the client that caused the subscribe() method to fire.
  | 

Ok, then why don't you intercept receive()? i.e. on the clients first request
to receive a message.
subscribe() just means they created the subscription (receiver/subscriber), not they
did receive() in the jms api.

But even then you don't know if it will actually be receiving.
You'd need to know whether the client has also done setEnabled(true)
i.e. whether it invoked connection.start()

You'd also have to trap unsubscribe() and connectionClosing()
to tidyup whatever state you use to remember that you already did
the broadcast on the first receive().

On the generic timing issue, you just do the broadcast AFTER the invocation
to the server.

public void subscribe(...) throws JMSException
{
   super.subscribe(...);
   // Here we know the subscription was successful
}

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062428#4062428

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062428



More information about the jboss-user mailing list