Examples of JmsMessage


Examples of org.apache.camel.component.jms.JmsMessage

            boolean timeout = holder.isTimeout();
            if (timeout) {
                // no response, so lets set a timed out exception
                exchange.setException(new ExchangeTimedOutException(exchange, holder.getRequestTimeout()));
            } else {
                JmsMessage response = new JmsMessage(message, endpoint.getBinding());
                Object body = response.getBody();

                if (endpoint.isTransferException() && body instanceof Exception) {
                    if (log.isDebugEnabled()) {
                        log.debug("Reply received. Setting reply as an Exception: " + body);
                    }
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

                // no response, so lets set a timed out exception
                String msg = "reply message with correlationID: " + holder.getCorrelationId() + " not received";
                exchange.setException(new ExchangeTimedOutException(exchange, holder.getRequestTimeout(), msg));
            } else {
                JmsMessage response = new JmsMessage(message, endpoint.getBinding());
                Object body = response.getBody();

                if (endpoint.isTransferException() && body instanceof Exception) {
                    log.debug("Reply received. Setting reply as an Exception: {}", body);
                    // we got an exception back and endpoint was configured to transfer exception
                    // therefore set response as exception
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

            public void configure() throws Exception {
                from("activemq:test.a").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        // lets set the custom JMS headers using the JMS API
                        assertNotNull(ExchangeHelper.getBinding(exchange, JmsBinding.class));
                        JmsMessage in = (JmsMessage) exchange.getIn();
                        assertNotNull(in);
                        Message inMessage = in.getJmsMessage();
                        inMessage.setJMSReplyTo(replyQueue);
                        inMessage.setJMSCorrelationID(correlationID);
                        inMessage.setJMSType(messageType);
                    }
                // must set option to preserve message QoS as we send an InOnly but put a JMSReplyTo
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

            public void configure() throws Exception {
                from(uri)
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // do not mutate it
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());

                            // get header should not mutate it
                            assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
                        }
                    })
                    // removing a header should mutate it
                    .removeHeader("HEADER_1")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // it should have been mutated
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());

                            // get header should not mutate it
                            assertNull("Header should have been removed", exchange.getIn().getHeader("HEADER_1"));
                        }
                    })
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

            public void configure() throws Exception {
                from(uri)
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // do not mutate it
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());

                            // get header should not mutate it
                            assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
                        }
                    })
                    // setting a new header should mutate it
                    .setHeader("HEADER_1", constant("VALUE_2"))
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // it should have been mutated
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());

                            // get header should not mutate it
                            assertEquals("VALUE_2", exchange.getIn().getHeader("HEADER_1"));
                        }
                    })
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            assertEquals("text/plain", exchange.getIn().getHeader("Content-Type"));

                            // do not mutate it
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());
                            assertEquals("Should NOT have been muated", false, msg.shouldCreateNewMessage());
                        }
                    })
                    .to("activemq:queue:copy", "mock:result");

                from("activemq:queue:copy").to("mock:copy");
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

                    // no response, so lets set a timed out exception
                    String msg = "reply message with correlationID: " + holder.getCorrelationId() + " not received";
                    exchange.setException(new ExchangeTimedOutException(exchange, holder.getRequestTimeout(), msg));
                } else {
                    JmsMessage response = new JmsMessage(message, endpoint.getBinding());
                    Object body = response.getBody();

                    if (endpoint.isTransferException() && body instanceof Exception) {
                        log.debug("Reply received. Setting reply as an Exception: {}", body);
                        // we got an exception back and endpoint was configured to transfer exception
                        // therefore set response as exception
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

            public void configure() throws Exception {
                from(uri)
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // do not mutate it
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());

                            // get header should not mutate it
                            assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
                        }
                    })
                    // removing a header should mutate it
                    .removeHeader("HEADER_1")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // it should have been mutated
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());

                            // get header should not mutate it
                            assertNull("Header should have been removed", exchange.getIn().getHeader("HEADER_1"));
                        }
                    })
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

            boolean timeout = holder.isTimeout();
            if (timeout) {
                // no response, so lets set a timed out exception
                exchange.setException(new ExchangeTimedOutException(exchange, holder.getRequestTimeout()));
            } else {
                JmsMessage response = new JmsMessage(message, endpoint.getBinding());
                Object body = response.getBody();

                if (endpoint.isTransferException() && body instanceof Exception) {
                    log.debug("Reply received. Setting reply as an Exception: {}", body);
                    // we got an exception back and endpoint was configured to transfer exception
                    // therefore set response as exception
View Full Code Here

Examples of org.apache.camel.component.jms.JmsMessage

            public void configure() throws Exception {
                from(uri)
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // do not mutate it
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());

                            // get header should not mutate it
                            assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
                        }
                    })
                    // setting a new header should mutate it
                    .setHeader("HEADER_1", constant("VALUE_2"))
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // it should have been mutated
                            JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
                            assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());

                            // get header should not mutate it
                            assertEquals("VALUE_2", exchange.getIn().getHeader("HEADER_1"));
                        }
                    })
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.