Thank you very much for replaying...
Well, really I'm not reconecting in my code. When phisical connection goes down, then
I can see warn messages from LeasePinger, and when the client recovers its connection warn
messages don't appear. In this situation, the client can send again messages to the
queue, but cannot receive messages from the topic.
This is a extract of my code, from the client's GUI you call the send information
method, and the AVListener's onMessage method only prints the information received on
that GUI.
...
public void run()
{
try
{
initConnections();
startTopicListener();
status = RUNNING;
while(status == RUNNING)
{
try
{
synchronized (this)
{
this.wait(10000);
}
}
catch(InterruptedException ie)
{
ie.printStackTrace();
}
}//while
}//try
catch(Exception e)
{
e.printStackTrace();
}//catch
finally
{
finishTopicListener();
finishConnections();
}
}
public void sendInformation(Object info) throws Exception
{
Queue queue = (Queue)ic.lookup(destinationName);
MessageProducer sender = qsession.createProducer(queue);
TextMessage message = qsession.createTextMessage(info.toString());
message.setStringProperty(propClientId, clientId);
sender.send(message);
}
public void initConnections() throws Exception
{
ic = new InitialContext();
ConnectionFactory cf = null;
cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
connection = cf.createConnection(jmsUser, jmsPwd);
//Obligatorio indicar clientid para poder crear una durable suscription
connection.setClientID(clientId);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
qsession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
}
public void startTopicListener() throws Exception
{
Topic topic = (Topic)ic.lookup(topicName);
subscriber = session.createDurableSubscriber(topic, subscriptionName);
avListener = new AVTopicListener();
subscriber.setMessageListener(avListener);
connection.start();
}
public void finishConnections() throws Exception
{
if (connection != null)
{
connection.close();
}
if (ic != null)
{
ic.close();
}
}
public void finishTopicListener() throws Exception
{
subscriber.close();
session.close();
qsession.close();
}
...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4193948#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...