Examples of ActiveMQTextMessage


Examples of org.apache.activemq.command.ActiveMQTextMessage

               String point = "activemq:"
                 + ((ActiveMQDestination)destination).getPhysicalName().replace("//", "")
                 + "?requestTimeout=" + requestTimeout;
               try {
                 String body = (String)client.getProducerTemplate().requestBody(point, text);
                   ActiveMQTextMessage answer = new ActiveMQTextMessage();
                   answer.setText(body);
                 writeMessageResponse(response.getWriter(), answer);
               } catch (Exception e) {
                 IOException ex = new IOException();
                 ex.initCause(e);
                 throw ex;
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

            addItem(CompositeDataConstants.MESSAGE_TEXT, CompositeDataConstants.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(CompositeDataConstants.MESSAGE_TEXT, "" + m.getText());
            } catch (JMSException e) {
                rc.put(CompositeDataConstants.MESSAGE_TEXT, "");
            }
            return rc;
        }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQTextMessage

        try {

            connection = cf.createConnection(userName, password);
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(dest);
            ActiveMQTextMessage msg = (ActiveMQTextMessage) session.createTextMessage(body);

            for (Iterator iter = headers.entrySet().iterator(); iter.hasNext();) {
                Map.Entry entry = (Map.Entry) iter.next();
                msg.setObjectProperty((String) entry.getKey(), entry.getValue());
            }

            producer.setDeliveryMode(msg.getJMSDeliveryMode());
            producer.setPriority(msg.getPriority());
            long ttl = msg.getExpiration() - System.currentTimeMillis();
            producer.setTimeToLive(ttl > 0 ? ttl : 0);
            producer.send(msg);

            return msg.getJMSMessageID();

        } finally {
            connection.close();
        }
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

Examples of org.codehaus.activemq.message.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 {
        checkClosed();
        return new ActiveMQTextMessage();
    }
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.