apply patch from https://issues.apache.org/activemq/browse/AMQ-2348 - update to camel-2.0-M3 - with thanks

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@801559 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2009-08-06 09:25:41 +00:00
parent 8c4ded486e
commit e183a824d3
4 changed files with 14 additions and 11 deletions

View File

@ -25,9 +25,10 @@ import org.apache.activemq.ActiveMQMessageProducerSupport;
import org.apache.activemq.ActiveMQSession; import org.apache.activemq.ActiveMQSession;
import org.apache.activemq.util.JMSExceptionSupport; import org.apache.activemq.util.JMSExceptionSupport;
import org.apache.camel.Endpoint; import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern; import org.apache.camel.ExchangePattern;
import org.apache.camel.Producer; import org.apache.camel.Producer;
import org.apache.camel.component.jms.JmsExchange; import org.apache.camel.component.jms.JmsMessage;
import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.ObjectHelper;
/** /**
@ -87,7 +88,8 @@ public class CamelMessageProducer extends ActiveMQMessageProducerSupport {
throw new IllegalArgumentException("Invalid destination setting: " + destination + " when expected: " + this.destination); throw new IllegalArgumentException("Invalid destination setting: " + destination + " when expected: " + this.destination);
} }
try { try {
JmsExchange exchange = new JmsExchange(endpoint, ExchangePattern.InOnly, camelDestination.getBinding(), message); Exchange exchange = endpoint.createExchange(ExchangePattern.InOnly);
exchange.setIn(new JmsMessage(message, camelDestination.getBinding()));
producer.process(exchange); producer.process(exchange);
} catch (JMSException e) { } catch (JMSException e) {
throw e; throw e;

View File

@ -30,7 +30,7 @@ import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange; import org.apache.camel.Exchange;
import org.apache.camel.Processor; import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder; import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.JmsExchange; import org.apache.camel.component.jms.JmsMessage;
import org.apache.camel.component.mock.AssertionClause; import org.apache.camel.component.mock.AssertionClause;
import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -85,12 +85,11 @@ public class ActiveMQJmsHeaderRouteTest extends ContextTestSupport {
from("activemq:test.a").process(new Processor() { from("activemq:test.a").process(new Processor() {
public void process(Exchange exchange) throws Exception { public void process(Exchange exchange) throws Exception {
// lets set the custom JMS headers using the JMS API // lets set the custom JMS headers using the JMS API
JmsExchange jmsExchange = assertIsInstanceOf(JmsExchange.class, exchange); JmsMessage jmsMessage = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
Message inMessage = jmsExchange.getInMessage(); jmsMessage.getJmsMessage().setJMSReplyTo(replyQueue);
inMessage.setJMSReplyTo(replyQueue); jmsMessage.getJmsMessage().setJMSCorrelationID(correlationID);
inMessage.setJMSCorrelationID(correlationID); jmsMessage.getJmsMessage().setJMSType(messageType);
inMessage.setJMSType(messageType);
} }
}).to("activemq:test.b?preserveMessageQos=true"); }).to("activemq:test.b?preserveMessageQos=true");

View File

@ -19,11 +19,13 @@ package org.apache.activemq.camel.component;
import java.util.List; import java.util.List;
import org.apache.activemq.util.ByteSequence; import org.apache.activemq.util.ByteSequence;
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport; import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange; import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder; import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.AssertionClause; import org.apache.camel.component.mock.AssertionClause;
import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
/** /**
* @version $Revision$ * @version $Revision$
@ -39,7 +41,7 @@ public class JournalRouteTest extends ContextTestSupport {
resultEndpoint.expectedMessageCount(1); resultEndpoint.expectedMessageCount(1);
AssertionClause firstMessageExpectations = resultEndpoint.message(0); AssertionClause firstMessageExpectations = resultEndpoint.message(0);
firstMessageExpectations.header("journal").isEqualTo("activemq.journal:target/test.a"); firstMessageExpectations.header("journal").isEqualTo("activemq.journal://target/test.a");
firstMessageExpectations.header("location").isNotNull(); firstMessageExpectations.header("location").isNotNull();
firstMessageExpectations.body().isInstanceOf(ByteSequence.class); firstMessageExpectations.body().isInstanceOf(ByteSequence.class);

View File

@ -43,7 +43,7 @@
<aopalliance-version>1.0</aopalliance-version> <aopalliance-version>1.0</aopalliance-version>
<axion-version>1.0-M3-dev</axion-version> <axion-version>1.0-M3-dev</axion-version>
<axis-version>1.2-RC1</axis-version> <axis-version>1.2-RC1</axis-version>
<camel-version>2.0-M2</camel-version> <camel-version>2.0-M3</camel-version>
<cglib-version>2.0</cglib-version> <cglib-version>2.0</cglib-version>
<commons-beanutils-version>1.6.1</commons-beanutils-version> <commons-beanutils-version>1.6.1</commons-beanutils-version>
<commons-collections-version>3.2.1</commons-collections-version> <commons-collections-version>3.2.1</commons-collections-version>