[JBoss-user] [Messaging, JMS & JBossMQ] - Re: JMS subscriber reconnect
Thanks - Here is what I've implemented, however I am still having issues with regards to closing the connection. When there is a network failure, I get a ping timeout exception, which is what I expect, but when I go to close the connection it just hangs there. I never reach my notify() statement. What am I missing? This works on SilverStreams app server, is there something different that I need to do on JBoss? anonymous wrote : | import javax.jms.*; | import javax.naming.InitialContext; | import java.io.PrintWriter; | import java.io.FileWriter; | import java.io.IOException; | import java.util.Date; | import java.text.DateFormat; | | public class SmartListener implements MessageListener, ExceptionListener, Runnable{ | String topicName; | TopicSubscriber topicSubscriber; | TopicConnection connection; | | public void run(){ | startConnection(); | } | | public SmartListener(String topicName){ | this.topicName = topicName; | } | | public void startConnection(){ | | /** | * Thread which performs reconnections, usually waiting for to be instructed to start | * the re-connection process | */ | Thread t = new Thread(){ | public void run(){ | while(true){ | reconnect(); | } | } | }; | t.start(); | | //Create TopicSubscriber, if it fails immediatley notify re-connect thread | try{ | topicSubscriber = createSubscriber(); | } | catch(JMSException jmse){ | System.out.println("JMSException: " + jmse); | synchronized(this){ | notify(); | } | } | } | | public String buildFilter(){ | String filter = "alias in ("; | for(int i=0; ihttp://www.jboss.org/index.html?module=bb&op=viewtopic&p=3854353#3854353 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3854353 --- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Messaging, JMS & JBossMQ] - JMS subscriber reconnect
I've looked through the forum and have yet to find a great example of how to implement a subscriber reconnect after a ping timeout has occurred. I've implemented the ExceptionListener to know when the timeout has occurred, but now I want to know what the correct way is to reconnect to the providor and my topic. From what I've read I know that I need to close the connection (connection.close()) but what is the best way after that? Thanks for any suggestions. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3853641#3853641 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3853641 --- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Messaging, JMS & JBossMQ] - Re: Can not publish a MapMessage
Anyone? Ideas? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3852965#3852965 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3852965 --- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Messaging, JMS & JBossMQ] - Can not publish a MapMessage
I am having problems publishing a MapMesage with jboss 3.2.5 or higher. When I try to publish the message the following exception is thrown on jboss: anonymous wrote : 10:20:29,078 WARN [ClientConsumer] Could not send messages to a receiver. | java.io.EOFException | at java.io.ObjectInputStream$BlockDataInputStream.readByte(Unknown Sourc | e) | at java.io.ObjectInputStream.readByte(Unknown Source) | at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:27 | 9) | at java.lang.Thread.run(Unknown Source) | 10:20:29,078 ERROR [JMSDestinationManager] The connection to client ID:1 failed. However, I can publish a TextMessage or an ObjectMessage just fine. I tried running the same code on 3.2.3 and it worked. Is there a config issue that I am missing? Here is the code that is sending the message: anonymous wrote : TopicSession topicSession = null; | TopicPublisher topicPublisher = null; | | try{ | topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); | topicPublisher = topicSession.createPublisher(topic); | | MapMessage msg = topicSession.createMapMessage(); | msg.setInt("state", state); //0 - On, 1 - Off, 2 - Cycle | msg.setString("alias", alias); | topicPublisher.publish(msg); | } | catch(Throwable t){ | //JMSException could be thrown | t.printStackTrace(); | System.err.println("SACPowerControlBean.powerOff: error"); | sc.setRollbackOnly(); | } | finally{ | if(topicSession != null){ | try{ | topicSession.close(); | } | catch(JMSException e){ | } | } | } This is inside a session bean, however I have tried to publish with just a standalone JMS client and recieve the same error. Thanks for you help. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3852615#3852615 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3852615 --- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user