Package javax.jms

Examples of javax.jms.Session.createBrowser()


        for (int i=0;i<outbound.length; i++) {
            producer.send(outbound[i]);
        }

        QueueBrowser browser = session.createBrowser(destination);
        Enumeration<?> enumeration = browser.getEnumeration();

        for (int i=0; i<outbound.length; i++) {
            assertTrue("should have a", enumeration.hasMoreElements());
            assertEquals(outbound[i], enumeration.nextElement());
View Full Code Here


        for (int i=0;i<outbound.length; i++) {
            producer.send(outbound[i]);
        }

        // verify second batch is visible to browse
        browser = session.createBrowser(destination);
        enumeration = browser.getEnumeration();
        for (int j=0; j<2;j++) {
            for (int i=0; i<outbound.length; i++) {
                assertTrue("should have a", enumeration.hasMoreElements());
                assertEquals("j=" + j + ", i=" + i, outbound[i].getText(), ((TextMessage) enumeration.nextElement()).getText());
View Full Code Here

        MessageProducer producer = session.createProducer(destination);
        producer.send(outbound[0]);

        // create browser first
        QueueBrowser browser = session.createBrowser(destination);
        Enumeration<?> enumeration = browser.getEnumeration();

        // browse the first message
        assertTrue("should have received the first message", enumeration.hasMoreElements());
        assertEquals(outbound[0], enumeration.nextElement());
View Full Code Here

        for (int i = 0; i < numberOfMessages; i++) {
            producer.send(session.createTextMessage("Message: "  + i));
        }

        QueueBrowser browser = session.createBrowser(destination);
        Enumeration<?> enumeration = browser.getEnumeration();

        assertTrue(enumeration.hasMoreElements());

        int numberBrowsed = 0;
View Full Code Here

        for (int i=0; i<numMessages; i++) {
            TextMessage message = session.createTextMessage("Message: " + i);
            producer.send(message);
        }

        QueueBrowser browser = session2.createBrowser(destinationPrefetch1);
        @SuppressWarnings("unchecked")
        Enumeration<Message> browserView = browser.getEnumeration();

        List<Message> messages = new ArrayList<Message>();
        for (int i = 0; i < numMessages; i++) {
View Full Code Here

        producer.send(outbound[0]);
        producer.send(outbound[1]);
        producer.send(outbound[2]);

        // create browser first
        QueueBrowser browser = session.createBrowser(destination);
        Enumeration<?> enumeration = browser.getEnumeration();

        // browse some messages
        assertEquals(outbound[0], enumeration.nextElement());
        assertEquals(outbound[1], enumeration.nextElement());
View Full Code Here

       
        public QueueBrowser createBrowser(Destination dest) throws Exception {
            Connection c = createConnection();
            c.start();
            Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
            return s.createBrowser((Queue)dest);
        }

        public MessageConsumer createDurableSubscriber(Topic dest, String name) throws Exception {
            Connection c = createConnection();
            c.start();
View Full Code Here

            TextMessage message = session.createTextMessage();
            message.setText("hello");
            p.send(message);

            QueueBrowser browser = session.createBrowser(queue);
            Enumeration enumeration = browser.getEnumeration();
            while (enumeration.hasMoreElements()) {
                Message m = (Message) enumeration.nextElement();
                assertTrue(m instanceof TextMessage);
            }
View Full Code Here

            message = session.createTextMessage();
            message.setText("hello + 9");
            p.send(message, DeliveryMode.PERSISTENT, 9, 0);

            QueueBrowser browser = session.createBrowser(queue);
            Enumeration enumeration = browser.getEnumeration();
            int count = 0;
            while (enumeration.hasMoreElements()) {
                Message m = (Message) enumeration.nextElement();
                assertTrue(m instanceof TextMessage);
View Full Code Here

            // Browse and check the message is there
            Connection connection2 = qcf.createConnection();
            connection2.start();
            Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
            QueueBrowser qb = session2.createBrowser(q);
            // Warning is suppressed - the API gives a the choice between raw generics and unsafe cast!
            @SuppressWarnings("unchecked")
            Enumeration<TextMessage> msgs = qb.getEnumeration();
            while (msgs.hasMoreElements())
            {
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.