camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-9065: Components should create Exchange from super
Date Mon, 10 Aug 2015 08:01:16 GMT
Repository: camel
Updated Branches:
  refs/heads/master 7d8a68be4 -> 46a9a5b49


CAMEL-9065: Components should create Exchange from super


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/46a9a5b4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/46a9a5b4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/46a9a5b4

Branch: refs/heads/master
Commit: 46a9a5b4926fd845042577f18ea6a935d2f5f91d
Parents: 7d8a68b
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Aug 10 10:07:05 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Aug 10 10:08:31 2015 +0200

----------------------------------------------------------------------
 .../camel/component/aws/s3/S3Endpoint.java      |  2 +-
 .../camel/component/aws/sqs/SqsEndpoint.java    |  2 +-
 .../camel/component/cache/CacheEndpoint.java    |  9 ++----
 .../file/remote/RemoteFileEndpoint.java         |  2 +-
 .../apache/camel/component/irc/IrcEndpoint.java | 29 ++++++-----------
 .../component/javaspace/JavaSpaceEndpoint.java  |  8 -----
 .../apache/camel/component/jms/JmsEndpoint.java |  2 +-
 .../camel/component/kafka/KafkaEndpoint.java    |  7 ++---
 .../camel/component/mail/MailEndpoint.java      | 13 +-------
 .../component/openshift/OpenShiftEndpoint.java  |  3 +-
 .../component/rabbitmq/RabbitMQEndpoint.java    | 13 +-------
 .../camel/component/snmp/SnmpEndpoint.java      | 33 +++-----------------
 .../camel/component/xmpp/XmppEndpoint.java      | 13 +-------
 13 files changed, 27 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
index ff69305..1698c77 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
@@ -150,7 +150,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
 
         LOG.trace("Got object [{}]", s3Object);
 
-        Exchange exchange = new DefaultExchange(this, pattern);
+        Exchange exchange = super.createExchange(pattern);
         Message message = exchange.getIn();
         message.setBody(s3Object.getObjectContent());
         message.setHeader(S3Constants.KEY, s3Object.getKey());

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
index f2f55c9..9567076 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
@@ -216,7 +216,7 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt
     }
 
     private Exchange createExchange(ExchangePattern pattern, com.amazonaws.services.sqs.model.Message
msg) {
-        Exchange exchange = new DefaultExchange(this, pattern);
+        Exchange exchange = super.createExchange(pattern);
         Message message = exchange.getIn();
         message.setBody(msg.getBody());
         message.setHeaders(new HashMap<String, Object>(msg.getAttributes()));

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java
b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java
index 5ecdb38..fd42b57 100755
--- a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java
+++ b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java
@@ -97,15 +97,12 @@ public class CacheEndpoint extends DefaultEndpoint {
         this.cacheManagerFactory = cacheManagerFactory;
     }
 
-    public Exchange createCacheExchange(String operation, String key,
-            Object value) {
-        Exchange exchange = new DefaultExchange(this.getCamelContext(),
-                getExchangePattern());
-        Message message = new DefaultMessage();
+    public Exchange createCacheExchange(String operation, String key, Object value) {
+        Exchange exchange = super.createExchange();
+        Message message = exchange.getIn();
         message.setHeader(CacheConstants.CACHE_OPERATION, operation);
         message.setHeader(CacheConstants.CACHE_KEY, key);
         message.setBody(value);
-        exchange.setIn(message);
         return exchange;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
index e91d85fa..ce6a5d8 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
@@ -73,7 +73,7 @@ public abstract class RemoteFileEndpoint<T> extends GenericFileEndpoint<T>
{
 
     @Override
     public Exchange createExchange(GenericFile<T> file) {
-        Exchange answer = new DefaultExchange(this);
+        Exchange answer = super.createExchange();
         if (file != null) {
             file.bindToExchange(answer);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
index ef92fcd..6b63c94 100644
--- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
+++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
@@ -20,7 +20,6 @@ import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
@@ -57,61 +56,61 @@ public class IrcEndpoint extends DefaultEndpoint {
     }
 
     public Exchange createExchange(ExchangePattern pattern) {
-        DefaultExchange exchange = new DefaultExchange(this, pattern);
+        Exchange exchange = super.createExchange(pattern);
         exchange.setProperty(Exchange.BINDING, getBinding());
         return exchange;
     }
 
     public Exchange createOnPrivmsgExchange(String target, IRCUser user, String msg) {
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("PRIVMSG", target, user, msg));
         return exchange;
     }
 
     public Exchange createOnNickExchange(IRCUser user, String newNick) {
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("NICK", user, newNick));
         return exchange;
     }
 
     public Exchange createOnQuitExchange(IRCUser user, String msg) {
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("QUIT", user, msg));
         return exchange;
     }
 
     public Exchange createOnJoinExchange(String channel, IRCUser user) {
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("JOIN", channel, user));
         return exchange;
     }
 
     public Exchange createOnKickExchange(String channel, IRCUser user, String whoWasKickedNick,
String msg) {
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("KICK", channel, user, whoWasKickedNick, msg));
         return exchange;
     }
 
     public Exchange createOnModeExchange(String channel, IRCUser user, IRCModeParser modeParser)
{
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("MODE", channel, user, modeParser.getLine()));
         return exchange;
     }
 
     public Exchange createOnPartExchange(String channel, IRCUser user, String msg) {
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("PART", channel, user, msg));
         return exchange;
     }
 
     public Exchange createOnReplyExchange(int num, String value, String msg) {
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("REPLY", num, value, msg));
         return exchange;
     }
 
     public Exchange createOnTopicExchange(String channel, IRCUser user, String topic) {
-        DefaultExchange exchange = getExchange();
+        Exchange exchange = createExchange();
         exchange.setIn(new IrcMessage("TOPIC", channel, user, topic));
         return exchange;
     }
@@ -153,7 +152,6 @@ public class IrcEndpoint extends DefaultEndpoint {
         this.configuration = configuration;
     }
 
-
     public void handleIrcError(int num, String msg) {
         if (IRCConstants.ERR_NICKNAMEINUSE == num) {
             handleNickInUse();
@@ -176,13 +174,6 @@ public class IrcEndpoint extends DefaultEndpoint {
         }
     }
 
-    private DefaultExchange getExchange() {
-        DefaultExchange exchange = new DefaultExchange(this, getExchangePattern());
-        exchange.setProperty(Exchange.BINDING, getBinding());
-        return exchange;
-    }
-
-
     public void joinChannels() {
         for (IrcChannel channel : configuration.getChannels()) {
             joinChannel(channel);

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceEndpoint.java
b/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceEndpoint.java
index f05d882..cb64167 100644
--- a/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceEndpoint.java
+++ b/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceEndpoint.java
@@ -16,13 +16,10 @@
  */
 package org.apache.camel.component.javaspace;
 
-import java.util.Map;
-
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
@@ -64,11 +61,6 @@ public class JavaSpaceEndpoint extends DefaultEndpoint {
         return new JavaSpaceProducer(this);
     }
 
-    @Override
-    public DefaultExchange createExchange() {
-        return new DefaultExchange(getCamelContext(), getExchangePattern());
-    }
-
     public boolean isSingleton() {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
index 96b6a6c..3edbbd1 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
@@ -288,7 +288,7 @@ public class JmsEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
 
     @Override
     public Exchange createExchange(ExchangePattern pattern) {
-        Exchange exchange = new DefaultExchange(this, pattern);
+        Exchange exchange = super.createExchange(pattern);
         exchange.setProperty(Exchange.BINDING, getBinding());
         return exchange;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
index 165c984..5dfe736 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
@@ -27,8 +27,6 @@ import org.apache.camel.MultipleConsumersSupport;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
-import org.apache.camel.impl.DefaultMessage;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 
@@ -108,9 +106,9 @@ public class KafkaEndpoint extends DefaultEndpoint implements MultipleConsumersS
     }
 
     public Exchange createKafkaExchange(MessageAndMetadata<byte[], byte[]> mm) {
-        Exchange exchange = new DefaultExchange(this, getExchangePattern());
+        Exchange exchange = super.createExchange();
 
-        Message message = new DefaultMessage();
+        Message message = exchange.getIn();
         message.setHeader(KafkaConstants.PARTITION, mm.partition());
         message.setHeader(KafkaConstants.TOPIC, mm.topic());
         message.setHeader(KafkaConstants.OFFSET, mm.offset());
@@ -118,7 +116,6 @@ public class KafkaEndpoint extends DefaultEndpoint implements MultipleConsumersS
             message.setHeader(KafkaConstants.KEY, new String(mm.key()));
         }
         message.setBody(mm.message());
-        exchange.setIn(message);
 
         return exchange;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
index 49d4e92..70d65fe 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
@@ -22,10 +22,8 @@ import javax.mail.search.SearchTerm;
 import com.sun.mail.imap.SortTerm;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.ScheduledPollEndpoint;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.UriEndpoint;
@@ -122,17 +120,8 @@ public class MailEndpoint extends ScheduledPollEndpoint {
         return false;
     }
 
-    @Override
-    public Exchange createExchange(ExchangePattern pattern) {
-        return createExchange(pattern, null);
-    }
-
     public Exchange createExchange(Message message) {
-        return createExchange(getExchangePattern(), message);
-    }
-
-    private Exchange createExchange(ExchangePattern pattern, Message message) {
-        Exchange exchange = new DefaultExchange(this, pattern);
+        Exchange exchange = super.createExchange();
         exchange.setProperty(Exchange.BINDING, getBinding());
         exchange.setIn(new MailMessage(message, getConfiguration().isMapMailMessage()));
         return exchange;

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
b/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
index faaedc0..fb57ae9 100644
--- a/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
+++ b/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
@@ -22,7 +22,6 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.ScheduledPollEndpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
@@ -77,7 +76,7 @@ public class OpenShiftEndpoint extends ScheduledPollEndpoint {
     }
 
     public Exchange createExchange(IApplication application) {
-        Exchange exchange = new DefaultExchange(this);
+        Exchange exchange = super.createExchange();
         exchange.getIn().setBody(application);
         return exchange;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
index 5b49e42..271ac6c 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
@@ -51,7 +51,6 @@ import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.TypeConversionException;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.DefaultMessage;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
@@ -180,15 +179,13 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
     }
 
     public Exchange createRabbitExchange(Envelope envelope, AMQP.BasicProperties properties,
byte[] body) {
-        Exchange exchange = new DefaultExchange(getCamelContext(), getExchangePattern());
-
+        Exchange exchange = super.createExchange();
         setRabbitExchange(exchange, envelope, properties, body);
         return exchange;
     }
 
     /**
      * Gets the message converter to convert between rabbit and camel
-     * @return
      */
     protected RabbitMQMessageConverter getMessageConverter() {
         return messageConverter;
@@ -255,10 +252,6 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
 
     /**
      * Sends the body that is on the exchange
-     * @param camelExchange
-     * @param channel
-     * @param properties
-     * @throws IOException
      */
     public void publishExchangeToChannel(Exchange camelExchange, Channel channel, String
routingKey) throws IOException {
         Message msg;
@@ -305,7 +298,6 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
         Boolean mandatory = camelExchange.getIn().getHeader(RabbitMQConstants.MANDATORY,
isMandatory(), Boolean.class);
         Boolean immediate = camelExchange.getIn().getHeader(RabbitMQConstants.IMMEDIATE,
isImmediate(), Boolean.class);
 
-
         LOG.debug("Sending message to exchange: {} with CorrelationId = {}", rabbitExchange,
properties.getCorrelationId());
 
         channel.basicPublish(rabbitExchange, routingKey, mandatory, immediate, properties,
body);
@@ -313,9 +305,6 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
 
     /**
      * Extracts name of the rabbitmq exchange
-     * 
-     * @param msg
-     * @return
      */
     protected String getExchangeName(Message msg) {
         String exchangeName = msg.getHeader(RabbitMQConstants.EXCHANGE_NAME, String.class);

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java
b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java
index 55a8c02..c7dc15d 100644
--- a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java
+++ b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java
@@ -20,10 +20,8 @@ import java.net.URI;
 
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.DefaultPollingEndpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
@@ -123,7 +121,9 @@ public class SnmpEndpoint extends DefaultPollingEndpoint {
      * @return an exchange
      */
     public Exchange createExchange(PDU pdu) {
-        return createExchange(getExchangePattern(), pdu);
+        Exchange exchange = super.createExchange();
+        exchange.setIn(new SnmpMessage(pdu));
+        return exchange;
     }
 
     /**
@@ -134,32 +134,7 @@ public class SnmpEndpoint extends DefaultPollingEndpoint {
      * @return an exchange
      */
     public Exchange createExchange(PDU pdu, CommandResponderEvent event) {
-        return createExchange(getExchangePattern(), pdu, event);
-    }
-
-    /**
-     * creates an exchange for the given pattern and message
-     *
-     * @param pattern the message exchange pattern
-     * @param pdu     the pdu
-     * @return the exchange
-     */
-    private Exchange createExchange(ExchangePattern pattern, PDU pdu) {
-        Exchange exchange = new DefaultExchange(this, pattern);
-        exchange.setIn(new SnmpMessage(pdu));
-        return exchange;
-    }
-
-    /**
-     * creates an exchange for the given pattern and message
-     *
-     * @param pattern the message exchange pattern
-     * @param pdu     the pdu
-     * @param event   a snmp4j CommandResponderEvent
-     * @return the exchange
-     */
-    private Exchange createExchange(ExchangePattern pattern, PDU pdu, CommandResponderEvent
event) {
-        Exchange exchange = new DefaultExchange(this, pattern);
+        Exchange exchange = super.createExchange();
         exchange.setIn(new SnmpMessage(pdu, event));
         return exchange;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/46a9a5b4/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
index bc9800a..11da25c 100644
--- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
+++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
@@ -21,11 +21,9 @@ import java.util.Iterator;
 
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
@@ -135,17 +133,8 @@ public class XmppEndpoint extends DefaultEndpoint implements HeaderFilterStrateg
         return answer;
     }
 
-    @Override
-    public Exchange createExchange(ExchangePattern pattern) {
-        return createExchange(pattern, null);
-    }
-
     public Exchange createExchange(Packet packet) {
-        return createExchange(getExchangePattern(), packet);
-    }
-
-    private Exchange createExchange(ExchangePattern pattern, Packet packet) {
-        Exchange exchange = new DefaultExchange(this, getExchangePattern());
+        Exchange exchange = super.createExchange();
         exchange.setProperty(Exchange.BINDING, getBinding());
         exchange.setIn(new XmppMessage(packet));
         return exchange;


Mime
View raw message