Package org.apache.camel.component.jms

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


        return new RouteBuilder() {
            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
            JmsMessage jmsMessage = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
           
                        jmsMessage.getJmsMessage().setJMSReplyTo(replyQueue);
                        jmsMessage.getJmsMessage().setJMSCorrelationID(correlationID);
                        jmsMessage.getJmsMessage().setJMSType(messageType);
                    }
                }).to("activemq:test.b?preserveMessageQos=true");

                from("activemq:test.b").to("mock:result");
            }
View Full Code Here


       
        // Send a message to the JMS endpoint
        JmsEndpoint endpoint = (JmsEndpoint) container.getEndpoint("jms:test");       
        Producer<JmsExchange> producer = endpoint.createProducer();
        JmsExchange exchange = producer.createExchange();
        JmsMessage in = exchange.getIn();
        in.setBody("Hello");
        in.setHeader("cheese", 123);
        producer.process(exchange);
       
        // The Activated endpoint should send it to the pojo due to the configured route.
        assertTrue("The message ware received by the Pojo", receivedCountDown.await(5, TimeUnit.SECONDS));
       
View Full Code Here

                            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

                    // 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

        return new RouteBuilder() {
            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
            JmsMessage jmsMessage = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
           
                        jmsMessage.getJmsMessage().setJMSReplyTo(replyQueue);
                        jmsMessage.getJmsMessage().setJMSCorrelationID(correlationID);
                        jmsMessage.getJmsMessage().setJMSType(messageType);
                    }
                }).to("activemq:test.b?preserveMessageQos=true");

                from("activemq:test.b").to("mock:result");
            }
View Full Code Here

        return new RouteBuilder() {
            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
            JmsMessage jmsMessage = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
           
                        jmsMessage.getJmsMessage().setJMSReplyTo(replyQueue);
                        jmsMessage.getJmsMessage().setJMSCorrelationID(correlationID);
                        jmsMessage.getJmsMessage().setJMSType(messageType);
                    }
                }).to("activemq:test.b?preserveMessageQos=true");

                from("activemq:test.b").to("mock:result");
            }
View Full Code Here

                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

            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

                // 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

            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

TOP

Related Classes of org.apache.camel.component.jms.JmsMessage

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.