[jboss-user] [JBoss Messaging] - Re: Missing messages after the failover of Jboss Node

mayankmit2002 do-not-reply at jboss.com
Fri Aug 21 09:50:28 EDT 2009


plz. find below my receiver code



  |   private void createJMSClient ()
  |     {
  |         final Properties props = new Properties();
  |         props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  |         props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
  |         props.put(Context.PROVIDER_URL, "NOICLT13274:1100,NOICLT22560:1100,NOICLT13407:1100");
  |         props.put("jnp.timeout", "1000");
  |         props.put("jnp.sotimeout", "1000");
  |         props.put("jnp.disablediscovery", "true");
  |         props.put("jnp.partitionName", "NOICLT22560_PARTITION");
  |                 
  |         try
  |         {
  |             final Context context = new InitialContext(props);
  |             ConnectionFactory mTopicConnectionFactory = (ConnectionFactory) context.lookup("ClusteredConnectionFactory");
  |             System.out.println(mTopicConnectionFactory);
  |             Topic mTopic = (Topic) context.lookup("topic/CMSPublic");
  | 
  |             Connection mTopicConnection = mTopicConnectionFactory.createConnection();
  |             Session mTopicSession = mTopicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
  | 
  |             // Create subscriber
  |             MessageConsumer mSubscriber = mTopicSession.createConsumer(mTopic);
  |             mSubscriber.setMessageListener(this);
  |             mTopicConnection.setExceptionListener(this);
  | 
  |             mTopicConnection.start();
  |             isConnected = true;
  |         }
  |         catch (final CommunicationException anException)
  |         {
  |             // anException.printStackTrace();
  |             System.err.println("Server is not avaliable!!! \n Trying to reconnect the server!!  " + anException.getMessage());
  |         }
  |         catch (final NamingException anException)
  |         {
  |             // anException.printStackTrace();
  |             System.err.println("Server is not avaliable!!! \n Trying to reconnect the server!!  " + anException.getMessage());
  |         }
  | 
  |         catch (final JMSException anException)
  |         {
  |             // anException.printStackTrace();
  |             System.err.println("Server is not avaliable!!! \n Trying to reconnect the server!!  " + anException.getMessage());
  |         }
  |         catch (Exception finalException)
  |         {
  |             // finalException.printStackTrace();
  |             System.err.println("Exception while starting JMS event listener. You may not be able to receive event, please restart your application");
  |         }
  |     
  |     }
  | 

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

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



More information about the jboss-user mailing list