Package javax.jms

Examples of javax.jms.Session.createBrowser()


        for (int i=0; i<numMessages; i++) {
            TextMessage message = session.createTextMessage("Message: " + i);
            producer.send(message);  
        }
       
        QueueBrowser browser = session2.createBrowser(destinationPrefetch1);
        Enumeration<Message> browserView = browser.getEnumeration();
   
        List<Message> messages = new ArrayList<Message>();
        for (int i = 0; i < numMessages; i++) {
            Message m1 = consumer.receive(5000);
View Full Code Here


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


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


        // browse some messages
        assertEquals(outbound[0], (Message) 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

        // Get the first.
        assertEquals(outbound[0], consumer.receive(1000));
        consumer.close();
        //Thread.sleep(200);

        QueueBrowser browser = session.createBrowser((Queue) destination);
        Enumeration enumeration = browser.getEnumeration();

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

       
        MessageProducer producer = session.createProducer(destination);
        producer.send(outbound[0]);
       
        // create browser first
        QueueBrowser browser = session.createBrowser((Queue) destination);
        Enumeration enumeration = browser.getEnumeration();
       
        // create consumer
        MessageConsumer consumer = session.createConsumer(destination);
       
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);
        Enumeration<Message> browserView = browser.getEnumeration();
   
        List<Message> messages = new ArrayList<Message>();
        for (int i = 0; i < numMessages; i++) {
            Message m1 = consumer.receive(5000);
View Full Code Here

      ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUri.toString());
      connection = connectionFactory.createConnection();
      connection.start();
      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue destination = session.createQueue(queueName);
      QueueBrowser browser = session.createBrowser(destination);
      List<Message> list = new ArrayList<Message>();
      for (Enumeration<Message> enumn = browser.getEnumeration(); enumn.hasMoreElements();) {
        list.add(enumn.nextElement());
      }
      messages = list.toArray();
View Full Code Here

      ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUri.toString());
      connection = connectionFactory.createConnection();
      connection.start();
      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue destination = session.createQueue(queueName);
      QueueBrowser browser = session.createBrowser(destination);
      List<Message> list = new ArrayList<Message>();
      for (Enumeration<Message> enumn = browser.getEnumeration(); enumn.hasMoreElements();) {
        list.add(enumn.nextElement());
      }
      messages = list.toArray();
View Full Code Here

        Session session = connection.createSession(false, Session.SESSION_TRANSACTED);
        destination = createDestination(session, destinationType);
        sendMessages(session, destination, 5);

       
        QueueBrowser browser = session.createBrowser((Queue) destination);
        Enumeration enumeration = browser.getEnumeration();
        for(int i=0; i < 5; i++) {
            Thread.sleep(100);
            assertTrue(enumeration.hasMoreElements());
            Message m = (Message)enumeration.nextElement();
View Full Code Here

        // Get the first.
        assertEquals(outbound[0], consumer.receive(1000));
        consumer.close();
        //Thread.sleep(200);

        QueueBrowser browser = session.createBrowser((Queue) destination);
        Enumeration enumeration = browser.getEnumeration();

        // browse the second
        assertTrue("should have received the second message", enumeration.hasMoreElements());
        assertEquals(outbound[1], (Message) enumeration.nextElement());
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.