Package org.apache.activemq.command

Examples of org.apache.activemq.command.ActiveMQTextMessage


    /**
     * @throws Exception
     */
    public void testSendReceive() throws Exception {
        for (int i = 0;i < MESSAGE_COUNT;i++) {
            TextMessage textMessage = new ActiveMQTextMessage();
            textMessage.setText("MSG-NO:" + i);
            for (int x = 0;x < producers.length;x++) {
                producers[x].send(textMessage);
            }
        }
        synchronized (receivedMessageCount) {
View Full Code Here


    protected void assertSendTextMessage(ActiveMQDestination destination, String text)
            throws MessageNotWriteableException {
        large = true;

        ActiveMQTextMessage expected = new ActiveMQTextMessage();

        expected.setText(text);
        expected.setDestination(destination);

        try {
            log.info("About to send message of type: " + expected.getClass());
            producer.oneway(expected);

            // lets send a dummy command to ensure things don't block if we
            // discard the last one
            // keepalive does not have a commandId...
            // producer.oneway(new KeepAliveInfo());
            producer.oneway(new ProducerInfo());
            producer.oneway(new ProducerInfo());

            Command received = assertCommandReceived();
            assertTrue("Should have received a ActiveMQTextMessage but was: " + received,
                    received instanceof ActiveMQTextMessage);
            ActiveMQTextMessage actual = (ActiveMQTextMessage) received;

            assertEquals("getDestination", expected.getDestination(), actual.getDestination());
            assertEquals("getText", expected.getText(), actual.getText());

            log.info("Received text message with: " + actual.getText().length() + " character(s)");
        }
        catch (Exception e) {
            log.info("Caught: " + e);
            e.printStackTrace();
            fail("Failed to send to transport: " + e);
View Full Code Here

        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

    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

     
      assertTrue("Transforming an ObjectMessage message to an ActiveMQObjectMessage",ActiveMQMessageTransformation.transformMessage((ObjectMessage)new ActiveMQObjectMessage(), null) instanceof ActiveMQObjectMessage);
     
      assertTrue("Transforming a StreamMessage message to an ActiveMQStreamMessage",ActiveMQMessageTransformation.transformMessage((StreamMessage)new ActiveMQStreamMessage(), null) instanceof ActiveMQStreamMessage);
     
      assertTrue("Transforming a TextMessage message to an ActiveMQTextMessage",ActiveMQMessageTransformation.transformMessage((TextMessage)new ActiveMQTextMessage(), null) instanceof ActiveMQTextMessage);
     
        assertTrue("Transforming an ActiveMQMessage message to an ActiveMQMessage",ActiveMQMessageTransformation.transformMessage(new ActiveMQMessage(), null) instanceof ActiveMQMessage);
    }
View Full Code Here

            super.init();
            addItem("Text", "Text", SimpleType.STRING);
        }

        public Map getFields(Object o) throws OpenDataException {
            ActiveMQTextMessage m = (ActiveMQTextMessage) o;
            Map rc = super.getFields(o);
            try {
                rc.put("Text", ""+m.getText());
            } catch (JMSException e) {
                rc.put("Text", "");
            }
            return rc;
        }
View Full Code Here

     * @throws Exception
     */
    public void testSendReceive() throws Exception {
        for (int i = 0;i < MESSAGE_COUNT;i++) {
            for (int x = 0;x < producers.length;x++) {
                TextMessage textMessage = new ActiveMQTextMessage();
                textMessage.setText("MSG-NO: " + i + " in cluster: " + x);
                producers[x].send(textMessage);
            }
        }
       
        for (int i = 0;i < NUMBER_IN_CLUSTER;i++) {
View Full Code Here

    /**
     * @throws Exception
     */
    public void testSendReceive() throws Exception {
        for (int i = 0;i < MESSAGE_COUNT;i++) {
            TextMessage textMessage = new ActiveMQTextMessage();
            textMessage.setText("MSG-NO:" + i);
            for (int x = 0;x < producers.length;x++) {
                producers[x].send(textMessage);
            }
        }
        synchronized (receivedMessageCount) {
View Full Code Here

            addItem(MESSAGE_TEXT, MESSAGE_TEXT, SimpleType.STRING);
        }

        @Override
        public Map<String, Object> getFields(Object o) throws OpenDataException {
            ActiveMQTextMessage m = (ActiveMQTextMessage)o;
            Map<String, Object> rc = super.getFields(o);
            try {
                rc.put(MESSAGE_TEXT, "" + m.getText());
            } catch (JMSException e) {
                rc.put(MESSAGE_TEXT, "");
            }
            return rc;
        }
View Full Code Here

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

TOP

Related Classes of org.apache.activemq.command.ActiveMQTextMessage

Copyright © 2018 www.massapicom. 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.