Package org.jboss.internal.soa.esb.couriers

Examples of org.jboss.internal.soa.esb.couriers.JmsCourier


        JMSEpr epr = new JMSEpr(JMSEpr.TOPIC_TYPE, topic, "ConnectionFactory");
        deliverMessage(message, epr, properties);
    }

    private static Message receiveMessage(JMSEpr epr, long timeout) {
        JmsCourier courier = null;

        addJndiExtensions(epr);

        try {
            courier = new JmsCourier(epr, true);
        } catch (CourierException e) {
            throw new RuntimeException("Failed to create pickup courier for epr '" + epr + "': " + e.getMessage());
        }

        try {
            return courier.pickupPayload(timeout);
        } catch (CourierException e) {
            throw new RuntimeException("Failed to pickup message on JMS epr '" + epr + "': " + e.getMessage());
        } catch (CourierTimeoutException e) {
            throw new RuntimeException("Failed to pickup message on JMS epr '" + epr + "': " + e.getMessage());
        }
View Full Code Here


    }

    private static void deliverMessage(Serializable message, JMSEpr epr, KeyValuePair[] properties) {
        String destType = null;
        String destName = null;
        JmsCourier courier = null;
        ObjectMessage jmsMessage = null;

        addJndiExtensions(epr);
       
            destType = epr.getDestinationType();
        destName = epr.getDestinationName();

        try {
            courier = new JmsCourier(epr);
        } catch (CourierException e) {
            throw new RuntimeException("Failed to create JMSCourier to JMS " + destType + " '" + destName + "': " + e.getMessage());
        }

        try {
            try {
                jmsMessage = courier.getJmsSession(epr.getAcknowledgeMode()).createObjectMessage(message);
            } catch (CourierException e) {
                throw new RuntimeException("Failed to get JMS Session for sending to JMS " + destType + " '" + destName + "': " + e.getMessage());
            } catch (JMSException e) {
                throw new RuntimeException("Failed to create JMS Message for sending to JMS " + destType + " '" + destName + "': " + e.getMessage());
            }

            if(properties != null) {
                try {
                    setStringProperties(jmsMessage, properties);
                } catch (JMSException e) {
                    throw new RuntimeException("Failed to set properties on the JMS Message to JMS " + destType + " '" + destName + "': " + e.getMessage());
                }
            }

            try {
                courier.deliver(jmsMessage);
            } catch (CourierException e) {
                throw new RuntimeException("Failed to deliver JMS Message to JMS " + destType + " '" + destName + "': " + e.getMessage());
            }
        } finally {
            courier.cleanup();
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.internal.soa.esb.couriers.JmsCourier

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.