Examples of JmsMessage


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());
                    // the JmsBinding is designed to be "pull-based": it will populate the Camel message on demand
                    // therefore, we link Exchange and OUT message before continuing, so that the JmsBinding has full access
                    // to everything it may need, and can populate headers, properties, etc. accordingly (solves CAMEL-6218).
                    exchange.setOut(response);
                    Object body = response.getBody();

                    if (endpoint.isTransferException() && body instanceof Exception) {
                        log.debug("Reply was an Exception. Setting the Exception on the Exchange: {}", 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 process(Exchange exchange) throws Exception {
                                // assert camel id is based on jms id
                                String camelId = exchange.getIn().getMessageId();
                                assertNotNull(camelId);

                                JmsMessage jms = (JmsMessage) exchange.getIn();
                                String jmsId = jms.getJmsMessage().getJMSMessageID();
                                assertNotNull(jmsId);

                                assertEquals(jmsId, camelId);
                            }
                        })
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

                from("activemq:topic:ActiveMQ.Advisory.Queue?cacheLevelName=CACHE_CONSUMER").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        Message in = exchange.getIn();
                        if (in instanceof JmsMessage) {
                            JmsMessage jmsMessage = (JmsMessage) in;
                            javax.jms.Message value = jmsMessage.getJmsMessage();
                            if (value instanceof ActiveMQMessage) {
                                ActiveMQMessage activeMQMessage = (ActiveMQMessage) value;
                                DataStructure structure = activeMQMessage.getDataStructure();
                                if (structure instanceof DestinationInfo) {
                                    DestinationInfo destinationInfo = (DestinationInfo) structure;
View Full Code Here

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

            public void configure() throws Exception {
                // do not map jms message as we want to tamper with the JMS message directly, and not use the Camel API for that
                from("activemq:test.a?mapJmsMessage=false").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        // lets set the custom JMS headers using the JMS API
                        JmsMessage jmsMessage = assertIsInstanceOf(JmsMessage.class, exchange.getIn());

                        jmsMessage.getJmsMessage().setJMSReplyTo(replyQueue);
                        jmsMessage.getJmsMessage().setJMSCorrelationID(correlationID);
                        jmsMessage.getJmsMessage().setJMSType(messageType);                    }
                // force sending the incoming JMS Message, as we want to tamper with the JMS API directly
                // instead of using the Camel API for setting JMS headers.
                }).to("activemq:test.b?preserveMessageQos=true&forceSendOriginalMessage=true");

                from("activemq:test.b").to("mock:result");
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());
                        }
                    })
                    .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

                            public void process(Exchange exchange) throws Exception {
                                // assert camel id is based on jms id
                                String camelId = exchange.getIn().getMessageId();
                                assertNotNull(camelId);

                                JmsMessage jms = (JmsMessage) exchange.getIn();
                                String jmsId = jms.getJmsMessage().getJMSMessageID();
                                assertNotNull(jmsId);

                                assertEquals(jmsId, camelId);
                            }
                        })
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

                    // 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());
                    // the JmsBinding is designed to be "pull-based": it will populate the Camel message on demand
                    // therefore, we link Exchange and OUT message before continuing, so that the JmsBinding has full access
                    // to everything it may need, and can populate headers, properties, etc. accordingly (solves CAMEL-6218).
                    exchange.setOut(response);
                    Object body = response.getBody();

                    if (endpoint.isTransferException() && body instanceof Exception) {
                        log.debug("Reply was an Exception. Setting the Exception on the Exchange: {}", body);
                        // we got an exception back and endpoint was configured to transfer exception
                        // therefore set response as exception
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.