Package javax.jms

Examples of javax.jms.QueueReceiver.receive()


         assertTrue("onMessage reply.id = 123456788", id == 123456788);

         // Get the 10 ejbCreate timer replys
         for(int n = 0; n < 10; n ++)
         {
            reply = receiver.receive(15000);
            log.info("ejbTimeout reply: " + reply);
            assertTrue("ejbTimeout reply != null", reply != null);
            id = reply.getIntProperty("UNIQUE_ID");
            assertTrue("onMessage reply.id = 123456788", id == 123456788);
            long elapsed = reply.getLongProperty("Elapsed");
View Full Code Here


        final Destination destination = (Destination) ctx.lookup("queue/test");
        final MessageProducer producer = session.createProducer(destination);
        producer.send(message);
        producer.close();

        final Message reply = receiver.receive(1000);
        assertNotNull(reply);
        final String result = ((TextMessage) reply).getText();
        assertEquals("replying Test", result);

    }
View Full Code Here

            final Destination destination = (Destination) ctx.lookup("queue/test");
            final MessageProducer producer = session.createProducer(destination);
            producer.send(message);
            producer.close();

            final Message reply = receiver.receive(1000);
            assertNotNull(reply);
            final String result = ((TextMessage) reply).getText();
            assertEquals("replying Test", result);
        } finally {
            //connection.stop();
View Full Code Here

         producer.send(m1);
         producer.send(m2);

         sess.commit();

         TextMessage mr = (TextMessage)cons.receive(3000);
         assertNotNull(mr);
         assertEquals("testing1", mr.getText());

         sess.rollback();
View Full Code Here

         assertNotNull(mr);
         assertEquals("testing1", mr.getText());

         sess.rollback();

         mr = (TextMessage)cons.receive(3000);
         assertNotNull(mr);
         assertEquals("testing1", mr.getText());

         // second message cannot be received
         // if the first message is not committed.
View Full Code Here

         assertNotNull(mr);
         assertEquals("testing1", mr.getText());

         // second message cannot be received
         // if the first message is not committed.
         mr = (TextMessage)cons.receive(3000);
         assertNull(mr);

         sess.commit();

         mr = (TextMessage)cons.receive(3000);
View Full Code Here

         mr = (TextMessage)cons.receive(3000);
         assertNull(mr);

         sess.commit();

         mr = (TextMessage)cons.receive(3000);
         assertNotNull(mr);
         assertEquals("testing2", mr.getText());

         sess.commit();
View Full Code Here

        prod1.send(ssn.createTextMessage("test1"));
       
        MessageProducer prod2 = ssn.createProducer(ssn.createTopic("ADDR:amq.topic/test"));
        prod2.send(ssn.createTextMessage("test2"));
       
        Message msg1 = receiver.receive();
        assertNotNull(msg1);
        assertEquals("test1",((TextMessage)msg1).getText());
       
        Message msg2 = sub.receive();
        assertNotNull(msg2);
View Full Code Here

                    logger.info( "Receiver " + Thread.currentThread().getName() + " connected." );

                    // start receive loop
                    while( ! ( shouldStop.get() || Thread.currentThread().isInterrupted()) ) {
                        try {
                            message = receiver.receive( 200 );
                        } catch( Exception e) {
                            //
                            // ignore interrupted exceptions
                            //
                            if( e instanceof InterruptedException || e.getCause() instanceof InterruptedException ) {
View Full Code Here

                        readQ,
                        WSIFJMSConstants.JMS_CORRELATION_ID + "='" + id + "'");
            else
                rec = session.createReceiver(readQ);

            msg = rec.receive(timeout);
            setLastMessage(msg);

            if (msg == null)
                throw new WSIFException(
                    "Receive timed out on JMS queue "
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.