You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/08/27 09:19:50 UTC
git commit: CAMEL-7673 Introduced different topic property names to
avoid the infinit delivery of MQTT
Repository: camel
Updated Branches:
refs/heads/master 2e1f1cd9d -> 6a63eb432
CAMEL-7673 Introduced different topic property names to avoid the infinit delivery of MQTT
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6a63eb43
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6a63eb43
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6a63eb43
Branch: refs/heads/master
Commit: 6a63eb432f28c815a48425e20c296a7830d7a2c0
Parents: 2e1f1cd
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Aug 27 15:04:00 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Aug 27 15:16:06 2014 +0800
----------------------------------------------------------------------
.../apache/camel/component/mqtt/MQTTConfiguration.java | 10 ++++++++++
.../org/apache/camel/component/mqtt/MQTTEndpoint.java | 2 +-
.../org/apache/camel/component/mqtt/MQTTProducer.java | 3 ++-
3 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6a63eb43/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
index 86510b4..7c7233a 100644
--- a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
+++ b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
@@ -20,6 +20,8 @@ import org.fusesource.mqtt.client.MQTT;
import org.fusesource.mqtt.client.QoS;
public class MQTTConfiguration extends MQTT {
+ public static final String MQTT_SUBSCRIBE_TOPIC = "CamelMQTTSubscribeTopic";
+ public static final String MQTT_PUBLISH_TOPIC = "CamelMQTTPublishTopic";
/**
* These a properties that are looked for in an Exchange - to publish to
@@ -70,10 +72,18 @@ public class MQTTConfiguration extends MQTT {
this.publishTopicName = publishTopicName;
}
+ /**
+ * Please use MQTT_SUBSCRIBE_TOPIC and MQTT_PUBLISH_TOPIC to set or get the topic name
+ */
+ @Deprecated
public String getMqttTopicPropertyName() {
return mqttTopicPropertyName;
}
+ /**
+ * Please use MQTT_SUBSCRIBE_TOPIC and MQTT_PUBLISH_TOPIC to set or get the topic name
+ */
+ @Deprecated
public void setMqttTopicPropertyName(String mqttTopicPropertyName) {
this.mqttTopicPropertyName = mqttTopicPropertyName;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/6a63eb43/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java
index e264c85..9c8dd95 100644
--- a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java
+++ b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java
@@ -85,7 +85,7 @@ public class MQTTEndpoint extends DefaultEndpoint {
if (!consumers.isEmpty()) {
Exchange exchange = createExchange();
exchange.getIn().setBody(body.toByteArray());
- exchange.setProperty(configuration.getMqttTopicPropertyName(), topic.toString());
+ exchange.setProperty(MQTTConfiguration.MQTT_SUBSCRIBE_TOPIC, topic.toString());
for (MQTTConsumer consumer : consumers) {
consumer.processExchange(exchange);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/6a63eb43/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTProducer.java b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTProducer.java
index 530623a..7a1797b 100644
--- a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTProducer.java
+++ b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTProducer.java
@@ -47,7 +47,8 @@ public class MQTTProducer extends DefaultAsyncProducer implements Processor {
// where should we publish to
String topicName = configuration.getPublishTopicName();
- Object topicValue = exchange.getProperty(configuration.getMqttTopicPropertyName());
+ // get the topic name by using the header of MQTT_PUBLISH_TOPIC
+ Object topicValue = exchange.getProperty(configuration.MQTT_PUBLISH_TOPIC);
if (topicValue != null) {
topicName = topicValue.toString();
}