Package javax.jms

Examples of javax.jms.Session.createObjectMessage()


            }
           
            Session inboundSession = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
            try {
                Queue queue = inboundSession.createQueue(destination);
                ObjectMessage msg = inboundSession.createObjectMessage(me);
                // Set message priority.
                Integer priority = (Integer) me.getProperty(JbiConstants.MESSAGE_PRIORITY);
                if (null != priority) {
                    msg.setJMSPriority(priority);
                }
View Full Code Here


        } else {
            connection = managedConnectionFactory.createConnection();
        }
        try {
            Session session = connection.createSession(transacted, transacted ? Session.SESSION_TRANSACTED : Session.AUTO_ACKNOWLEDGE);
            ObjectMessage msg = session.createObjectMessage(object);
            MessageProducer producer = session.createProducer(dest);
            producer.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
            producer.send(msg);
        } finally {
            connection.close();
View Full Code Here

                    Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
                    Exception error = exchange.getError();
                    if (error == null) {
                        error = new Exception("Exchange in error");
                    }
                    response = session.createObjectMessage(error);
                    MessageProducer producer = session.createProducer(message.getJMSReplyTo());
                    if (endpoint.isUseMsgIdInResponse()) {
                        response.setJMSCorrelationID(message.getJMSMessageID());
                    } else {
                        response.setJMSCorrelationID(message.getJMSCorrelationID());
View Full Code Here

            }
        }
        Connection connection = managedConnectionFactory.createConnection();
        try {
            Session session = connection.createSession(transacted, transacted ? Session.SESSION_TRANSACTED : Session.AUTO_ACKNOWLEDGE);
            ObjectMessage msg = session.createObjectMessage(object);
            MessageProducer producer = session.createProducer(dest);
            producer.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
            producer.send(msg);
        } finally {
            connection.close();
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug(broker.getContainer().getName() + ": broadcasting info for " + event);
        }
        Session broadcastSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        try {
            ObjectMessage msg = broadcastSession.createObjectMessage(event);
            Topic broadcastTopic = broadcastSession.createTopic(broadcastDestinationName);
            MessageProducer topicProducer = broadcastSession.createProducer(broadcastTopic);
            topicProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
            topicProducer.send(msg);
        } finally {
View Full Code Here

            }

            Session inboundSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            try {
                Queue queue = inboundSession.createQueue(destination);
                ObjectMessage msg = inboundSession.createObjectMessage(me);
                MessageProducer queueProducer = inboundSession.createProducer(queue);
                queueProducer.send(msg);
            } finally {
                inboundSession.close();
            }
View Full Code Here

        connection.start();

        // Send the update to the broker
        Queue adminQueue = session.createQueue(MessageType.JMQ_ADMIN_DEST);
        MessageProducer sender = session.createProducer(adminQueue);
        ObjectMessage updateMessage = session.createObjectMessage();
        updateMessage.setJMSReplyTo(replyQueue);
        updateMessage.setIntProperty(MessageType.JMQ_MESSAGE_TYPE, MessageType.UPDATE_CLUSTER_BROKERLIST);
        updateMessage.setStringProperty(MessageType.JMQ_CLUSTER_BROKERLIST, newClusterBrokerList);
        sender.send(updateMessage, DeliveryMode.NON_PERSISTENT, 4, 0);
View Full Code Here

        connection.start();

        // Send the update to the broker
        Queue adminQueue = session.createQueue(MessageType.JMQ_ADMIN_DEST);
        MessageProducer sender = session.createProducer(adminQueue);
        ObjectMessage updateMessage = session.createObjectMessage();
        updateMessage.setJMSReplyTo(replyQueue);
        updateMessage.setIntProperty(MessageType.JMQ_MESSAGE_TYPE, MessageType.CHANGE_CLUSTER_MASTER_BROKER);
        updateMessage.setStringProperty(MessageType.JMQ_CLUSTER_OLD_MASTER_BROKER, oldMasterBroker);
        updateMessage.setStringProperty(MessageType.JMQ_CLUSTER_NEW_MASTER_BROKER, newMasterBroker);
        updateMessage.setBooleanProperty(MessageType.JMQ_JMSRA_MANAGED_BROKER, true);
View Full Code Here

            conn.start();

            for (int i = 0; i < counter; ++i) {
                SimpleTransferObject to = new SimpleTransferObject(requestName, i);

                ObjectMessage msg = sess.createObjectMessage();
                msg.setJMSReplyTo(jmsResponseQueue);
                msg.setObject(to);

                logger.info("Sending message with name " + to.getName());
                prod.send(msg, Message.DEFAULT_DELIVERY_MODE, priority, Message.DEFAULT_TIME_TO_LIVE);
View Full Code Here

        // send a message
        Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = producerSession.createProducer(destination);

        ObjectMessage request = producerSession.createObjectMessage(new SamplePojo("James", "London"));
        producer.send(request);

        // lets consume it as an object message
        Message message = objectConsumer.receive(timeout);
        assertNotNull("Should have received a message!", 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.