checkMessageListener(); if (timeout == 0) { return this.receive();
private void runReceiveLoop(ActiveMQMessageConsumer messageConsumer) throws JMSException { while(!shouldStop.get()) { if (log.isTraceEnabled()) { log.trace("Checking for new message"); } Message message = messageConsumer.receive(400); errorsInARowCount = 0; if (message != null) { processMessage(messageConsumer, message); } } }
TextMessage msg = (TextMessage) amqConsumer.receive(); assertNotNull(msg); assertTrue("message has \"no expiry\" text: " + msg.getText(), msg.getText().contains("no expiry"));
@Test public void testMutipleReceivingFromCore() throws Exception { final String text = "HelloWorld"; final int num = 100; //text messages sendMultipleTextMessagesUsingCoreJms(queueName, text, 100); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE); final ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(destination); for (int i = 0; i < num; i++) { TextMessage textMessage = (TextMessage) consumer.receive(5000); assertEquals(text + i, textMessage.getText()); assertEquals(destination, textMessage.getJMSDestination()); } }
checkMessageListener(); if (timeout == 0) { return this.receive();
checkMessageListener(); if (timeout == 0) { return this.receive();
checkMessageListener(); if (timeout == 0) { return this.receive();
checkMessageListener(); if (timeout == 0) { return this.receive();
TextMessage textMessage = (TextMessage) consumer.receive(5000); MapMessage mapMessage = (MapMessage) consumer.receive(5000); sendObjectMessageUsingCoreJms(queueName, obj); ObjectMessage objectMessage = (ObjectMessage) consumer.receive(5000); SimpleSerializable data = (SimpleSerializable) objectMessage.getObject(); StreamMessage streamMessage = (StreamMessage) consumer.receive(5000); sendBytesMessageUsingCoreJms(queueName, bytesData); BytesMessage bytesMessage = (BytesMessage) consumer.receive(5000); byte[] rawBytes = new byte[bytesData.length]; bytesMessage.readBytes(rawBytes); javax.jms.Message genericMessage = consumer.receive(5000);