[jboss-user] [Messaging, JMS & JBossMQ] - Should stopping a destination cause a connection exception
mveitas
do-not-reply at jboss.com
Thu Nov 2 10:54:09 EST 2006
Should stopping a destination via the JMX console, cause an exception to be registered with the client connection? If not, how can I get the client to register an exception via the ExceptionListener interface?
| Properties p = new Properties();
| p.put( "java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
| p.put( "java.naming.provider.url", "jnp://localhost:1099" );
| p.put( "java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces" );
|
| try
| {
| Context context = new InitialContext( p );
| ConnectionFactory connectionFactory = ( ConnectionFactory ) context.lookup( "ConnectionFactory" );
| Destination destination = ( Destination ) context.lookup( "queue/B" );
| Connection connection = connectionFactory.createConnection();
| connection.setExceptionListener( new ExceptionListener()
| {
| public void onException( JMSException jmsException )
| {
| System.out.println( "EXCEPTION: " + jmsException );
| }
| } );
| Session session = connection.createSession( false, Session.CLIENT_ACKNOWLEDGE );
| MessageConsumer consumer = session.createConsumer( destination );
| consumer.setMessageListener( new MessageListener()
| {
| public void onMessage( Message message )
| {
| System.out.println( "Message: " + message );
| }
| } );
|
| connection.start();
| }
| catch( Exception e )
| {
| e.printStackTrace();
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982697#3982697
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982697
More information about the jboss-user
mailing list