Package org.springframework.jms.core

Examples of org.springframework.jms.core.JmsTemplate.receive()


        // now consume using something that is not Camel
        Thread.sleep(1000);

        JmsTemplate jms = new JmsTemplate(amq.getConfiguration().getConnectionFactory());
        TextMessage msg = (TextMessage) jms.receive("in");
        assertEquals("Hello World", msg.getText());

        // there should be a JMSReplyTo so we know where to send the reply
        Destination replyTo = msg.getJMSReplyTo();
        assertEquals("queue://myReplyQueue", replyTo.toString());
View Full Code Here


                        return resolv.resolveDestinationName(session, jmsConfig.getTargetDestination(),
                                                             false);
                    }
                });
               
                final Message message = jmsTemplate.receive(destination);
                MessageCreator messageCreator = new MessageCreator() {
                    public Message createMessage(Session session) {
                        return message;
                    }
                };
View Full Code Here

        Message msg = null;
        int count = 0;

        do {
            msg = template.receive(Sender.DESTINATION_NAME);

            if (msg != null)
                count++;

        } while (msg != null);
View Full Code Here

        Destination destination = (Destination) ctx.getBean("destination");

        System.out.println("Will wait " + template.getReceiveTimeout()
                + " seconds for message");

        Message msg = template.receive(destination);
        System.out.println("Received Message: " + msg);
    }
}
View Full Code Here

        final Destination destination = (Destination) ctx
                .getBean("destination");

        while (true) {
            System.out.println("Waiting...");
            Message msg = template.receive(destination);
            System.out.println("Received: " + msg);
        }
    }
}
View Full Code Here

        // use another thread to listen and send the reply
        Executors.newFixedThreadPool(1).submit(new Callable<Object>() {
            public Object call() throws Exception {
                JmsTemplate jms = new JmsTemplate(amq.getConfiguration().getConnectionFactory());

                final TextMessage msg = (TextMessage) jms.receive("nameRequestor");
                assertEquals("What's your name", msg.getText());

                // there should be a JMSReplyTo so we know where to send the reply
                final Destination replyTo = msg.getJMSReplyTo();
View Full Code Here

                        return resolv.resolveDestinationName(session, jmsConfig.getTargetDestination(),
                                                             false);
                    }
                });
               
                final Message message = jmsTemplate.receive(destination);
                MessageCreator messageCreator = new MessageCreator() {
                    public Message createMessage(Session session) {
                        return message;
                    }
                };
View Full Code Here

            });

            final JmsTemplate template2 = new JmsTemplate(cf2);
            template2.setReceiveTimeout(10000);

            final Message m = template2.receive("test.q");
            assertTrue(m instanceof TextMessage);

            final TextMessage tm = (TextMessage)m;

            assertEquals("test", tm.getText());
View Full Code Here

        // now consume using something that is not Camel
        Thread.sleep(1000);

        JmsTemplate jms = new JmsTemplate(amq.getConfiguration().getConnectionFactory());
        TextMessage msg = (TextMessage) jms.receive("nameRequestor");
        assertEquals("What's your name", msg.getText());

        // there should be a JMSReplyTo so we know where to send the reply
        Destination replyTo = msg.getJMSReplyTo();
        assertEquals("queue://nameReplyQueue", replyTo.toString());
View Full Code Here

                        return resolv.resolveDestinationName(session, jmsConfig.getTargetDestination(),
                                                             false);
                    }
                });
               
                final Message message = jmsTemplate.receive(destination);
                MessageCreator messageCreator = new MessageCreator() {
                    public Message createMessage(Session session) {
                        return message;
                    }
                };
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.