Examples of ActiveMQTextMessage


Examples of org.apache.activemq.command.ActiveMQTextMessage

        // publish a message
        Xid tid = createXid();
        resource.start(tid, XAResource.TMNOFLAGS);
        MessageProducer producer = session.createProducer(dest);
        ActiveMQTextMessage message  = new ActiveMQTextMessage();
        message.setText(getName());
        producer.send(message);

        connection.close();

        assertTransactionGoneFromBroker(tid);
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

        info.setClientId(info.getConnectionId().getValue());
        return info;
    }

    protected Message createMessage(ProducerInfo producerInfo, ActiveMQDestination destination) {
        ActiveMQTextMessage message = new ActiveMQTextMessage();
        message.setMessageId(new MessageId(producerInfo, ++msgIdGenerator));
        message.setDestination(destination);
        message.setPersistent(false);
        try {
            message.setText("Test Message Payload.");
        } catch (MessageNotWriteableException e) {
        }
        return message;
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

     * @return an ActiveMQTextMessage
     * @throws JMSException if the JMS provider fails to create this message due
     *                 to some internal error.
     */
    public TextMessage createTextMessage() throws JMSException {
        ActiveMQTextMessage message = new ActiveMQTextMessage();
        configureMessage(message);
        return message;
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

     * @return an ActiveMQTextMessage
     * @throws JMSException if the JMS provider fails to create this message due
     *                 to some internal error.
     */
    public TextMessage createTextMessage(String text) throws JMSException {
        ActiveMQTextMessage message = new ActiveMQTextMessage();
        message.setText(text);
        configureMessage(message);
        return message;
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

        message.setStringProperty(LENGTH10STRING, LENGTH10STRING);
        producer.send(message);

        messageList.assertMessagesArrived(1);

        ActiveMQTextMessage received = ((ActiveMQTextMessage) messageList
                .flushMessages().get(0));

        assertEquals(LENGTH10STRING, received.getText());
        assertTrue(received.getProperties().size() > 0);
        assertTrue(received.propertyExists(LENGTH10STRING));
        assertEquals(LENGTH10STRING, received.getStringProperty(LENGTH10STRING));

        /**
         * As specified by getSize(), the size (memory usage) of the body should
         * be length of text * 2. Unsure of how memory usage is calculated for
         * properties, but should probably not be less than the sum of (string)
         * lengths for the key name and value.
         */

        final int sizeShouldBeNoLessThan = LENGTH10STRING.length() * 4 + received.DEFAULT_MINIMUM_MESSAGE_SIZE;
        assertTrue("Message size was smaller than expected: " + received.getSize(),
                received.getSize() >= sizeShouldBeNoLessThan);
        assertFalse(LENGTH10STRING.length() * 2 == received.getSize());
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

    protected int browseMessages(QueueBrowser browser, String name) throws Exception {
        Enumeration msgs = browser.getEnumeration();
        int browsedMessage = 0;
        while (msgs.hasMoreElements()) {
            browsedMessage++;
            ActiveMQTextMessage message = (ActiveMQTextMessage)msgs.nextElement();
            LOG.info(name + " browsed: " + message.getText() + " " + message.getDestination() " " + message.getMessageId() + " " + Arrays.toString(message.getBrokerPath()));
        }
        return browsedMessage;
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

                    if (consume) {
                        if (count != 0) {
                            MessageConsumer consumer = createSyncConsumer(broker, dest);
                            totalCount += count;
                            for (int i = 0; i < count; i++) {
                                ActiveMQTextMessage message = (ActiveMQTextMessage)consumer.receive(1000);
                                LOG.info(broker + " consumer: " + message.getText() + " " + message.getDestination() " " + message.getMessageId() + " " + Arrays.toString(message.getBrokerPath()));
                                if (message == null) break;
                            }
                        }
                    } else {
                        totalCount = count;
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

    protected ActiveMQDestination createActiveMQDestination(String string) {
        return new ActiveMQQueue(string);
    }

    protected Message createMessage(String string) throws Exception {
        ActiveMQTextMessage message = (ActiveMQTextMessage)ActiveMQTextMessageTest.SINGLETON.createObject();
        message.setText(string);
        return message;
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

        assertEquals("getJMSPriority", 3, message.getJMSPriority());
        assertEquals("foo", "abc", message.getStringProperty("foo"));
        assertEquals("bar", "123", message.getStringProperty("bar"));

        assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
        ActiveMQTextMessage amqMessage = (ActiveMQTextMessage)message;
        assertEquals("GroupID", "abc", amqMessage.getGroupID());
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

        message.setPersistent(deliveryMode == DeliveryMode.PERSISTENT);
        return message;
    }
   
    protected Message createMessage(ProducerInfo producerInfo, ActiveMQDestination destination) {
        ActiveMQTextMessage message = new ActiveMQTextMessage();
        message.setMessageId(new MessageId(producerInfo, ++msgIdGenerator));
        message.setDestination(destination);
        message.setPersistent(false);
        try {
            message.setText("Test Message Payload.");
        } catch (MessageNotWriteableException e) {
        }
        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.