Package javax.jms

Examples of javax.jms.Connection.stop()


        catch(Exception e) {
            log.error(e.getMessage());
            return;
        }
        Connection c = ((ConnectionHolder)connectionHolders.get(index)).getConnection();
        c.stop();
    }

    public void close(int index) throws Exception {

        try {
View Full Code Here


    public void testNoExceptionOnClosewithStartStop() throws JMSException {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
                "vm://localhost?broker.persistent=false");
        Connection connection = connectionFactory.createConnection();
        connection.start();
        connection.stop();
        connection.close();
    }

    public void testNoExceptionOnClose() throws JMSException {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
View Full Code Here

        Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = s.createProducer(new ActiveMQQueue(destinationName));
        producer.send(s.createTextMessage(message));
        producer.close();
        s.close();
        c.stop();
  }

}
View Full Code Here

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = session.createTopic(topicName);
        TopicSubscriber durableSubscriptionCreator = session.createDurableSubscriber(topic, subName);

        connection.stop();
        durableSubscriptionCreator.close();
        session.close();
        connection.close();

        // publisher task
View Full Code Here

                consumer = session.createDurableSubscriber(topic, subName);
            }

            void close(boolean unsubscribe) throws Exception {
                if (connection != null) {
                    connection.stop();
                }

                if (consumer != null) {
                    consumer.close();
                }
View Full Code Here

        connection.start();

        CopyOnWriteArrayList<TransportConnection> connections = broker.getConnectorByName("tcp").getConnections();
        assertEquals(1, connections.size());
        assertNotNull(connections.get(0).getRemoteWireFormatInfo().getHost());
        connection.stop();
    }

    @Test
    public void testAMQ5050WithManualSpecifiedHost() throws Exception {
        // Let verify a host header is added to the connection.
View Full Code Here

        connection.start();

        CopyOnWriteArrayList<TransportConnection> connections = broker.getConnectorByName("tcp").getConnections();
        assertEquals(1, connections.size());
        assertEquals("foo", connections.get(0).getRemoteWireFormatInfo().getHost());
        connection.stop();
    }

}
View Full Code Here

        catch (Exception e)
        {
            e.printStackTrace();
        }

        conn.stop();
       
        // Send 1 matching message and 1 non-matching message
        MessageProducer producer = session.createProducer(topic);
        TextMessage msg = session.createTextMessage("testResubscribeWithChangedSelectorAndRestart1");
        msg.setBooleanProperty("Match", true);
View Full Code Here

        catch (Exception e)
        {
            e.printStackTrace();
        }

        conn.stop();
       
        // Send 1 matching message and 1 non-matching message
        MessageProducer producer = session.createProducer(topic);
        TextMessage msg = session.createTextMessage("testResubscribeWithChangedSelectorAndRestart1");
        msg.setBooleanProperty("testprop", true);
View Full Code Here

        boolean halfwayPointReached = consumerReadToHalfwayLatch.await(5000, TimeUnit.MILLISECONDS);
        assertTrue("Did not read half of messages within time allowed", halfwayPointReached);

        _managedSourceQueue.moveMessages(fromMessageId, toMessageId, _destinationQueueName);

        asyncConnection.stop();

        // The exact number of messages moved will be non deterministic, as the number of messages processed
        // by the consumer cannot be predicted.  There is also the possibility that a message can remain
        // on the source queue.  This situation will arise if a message has been acquired by the consumer, but not
        // yet delivered to the client application (i.e. MessageListener#onMessage()) when the Connection#stop() occurs.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.