Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
<artifactId>library-udf</artifactId>
<version>2.0.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>mqtt</artifactId>
<version>2.0.7-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -74,6 +80,7 @@
<descriptor>src/assembly/confignode.xml</descriptor>
<descriptor>src/assembly/cli.xml</descriptor>
<descriptor>src/assembly/library-udf.xml</descriptor>
<descriptor>src/assembly/external-service-impl.xml</descriptor>
</descriptors>
<finalName>apache-iotdb-${project.version}</finalName>
</configuration>
Expand Down Expand Up @@ -107,6 +114,7 @@
<include>apache-iotdb-${project.version}-cli-bin.zip</include>
<include>apache-iotdb-${project.version}-confignode-bin.zip</include>
<include>apache-iotdb-${project.version}-library-udf-bin.zip</include>
<include>apache-iotdb-${project.version}-external-service-impl-bin.zip</include>
</includes>
</fileSet>
</fileSets>
Expand Down
4 changes: 4 additions & 0 deletions distribution/src/assembly/all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
<outputDirectory>conf</outputDirectory>
<fileMode>0755</fileMode>
</file>
<file>
<source>${maven.multiModuleProjectDirectory}/external-service-impl/mqtt/target/mqtt-${project.version}-jar-with-dependencies.jar</source>
<outputDirectory>lib</outputDirectory>
</file>
</files>
<componentDescriptors>
<componentDescriptor>common-files.xml</componentDescriptor>
Expand Down
6 changes: 6 additions & 0 deletions distribution/src/assembly/datanode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${maven.multiModuleProjectDirectory}/external-service-impl/mqtt/target/mqtt-${project.version}-jar-with-dependencies.jar</source>
<outputDirectory>lib</outputDirectory>
</file>
</files>
<componentDescriptors>
<componentDescriptor>common-files.xml</componentDescriptor>
</componentDescriptors>
Expand Down
51 changes: 51 additions & 0 deletions distribution/src/assembly/external-service-impl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->
<assembly>
<id>external-service-impl-bin</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<baseDirectory>apache-iotdb-${project.version}-external-service-impl-bin</baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/../licenses</directory>
<outputDirectory>licenses</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.basedir}/../LICENSE-binary</source>
<outputDirectory>licenses</outputDirectory>
<destName>LICENSE</destName>
</file>
<file>
<source>${project.basedir}/../NOTICE-binary</source>
<outputDirectory>licenses</outputDirectory>
<destName>NOTICE</destName>
</file>
<file>
<source>${maven.multiModuleProjectDirectory}/external-service-impl/mqtt/target/mqtt-${project.version}-jar-with-dependencies.jar</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
</assembly>
6 changes: 5 additions & 1 deletion example/mqtt-customize/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
<artifactId>customize-mqtt-example</artifactId>
<name>IoTDB: Example: Customized MQTT</name>
<dependencies>
<!-- used by the server-->
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>mqtt</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

package org.apache.iotdb.mqtt.server;

import org.apache.iotdb.db.protocol.mqtt.Message;
import org.apache.iotdb.db.protocol.mqtt.PayloadFormatter;
import org.apache.iotdb.db.protocol.mqtt.TreeMessage;
import org.apache.iotdb.mqtt.Message;
import org.apache.iotdb.mqtt.PayloadFormatter;
import org.apache.iotdb.mqtt.TreeMessage;

import io.netty.buffer.ByteBuf;
import org.apache.tsfile.external.commons.lang3.NotImplementedException;
Expand Down
177 changes: 177 additions & 0 deletions external-service-impl/mqtt/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.iotdb</groupId>
<artifactId>external-service-impl</artifactId>
<version>2.0.7-SNAPSHOT</version>
</parent>
<artifactId>mqtt</artifactId>
<name>IoTDB: External-Service-Impl: MQTT</name>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.github.moquette-io.moquette</groupId>
<artifactId>moquette-broker</artifactId>
<exclusions>
<!-- exclude dependencies has included by iotdb-server -->
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-server</artifactId>
<scope>provided</scope>
<version>2.0.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-thrift-commons</artifactId>
<version>2.0.7-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile</artifactId>
<version>${tsfile.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tsfile</groupId>
<artifactId>common</artifactId>
<version>${tsfile.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-thrift</artifactId>
<version>2.0.7-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>node-commons</artifactId>
<version>2.0.7-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>service-rpc</artifactId>
<version>2.0.7-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven.assembly.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
<!-- this is used for inheritance merges -->
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<ignoredDependencies>
<ignoredDependency>io.netty:netty-codec-mqtt</ignoredDependency>
<ignoredDependency>org.apache.tsfile:common</ignoredDependency>
</ignoredDependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.iotdb.db.protocol.mqtt;
package org.apache.iotdb.mqtt;

import org.apache.iotdb.db.auth.AuthorityChecker;
import org.apache.iotdb.rpc.TSStatusCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.iotdb.db.protocol.mqtt;
package org.apache.iotdb.mqtt;

import com.google.common.collect.Lists;
import com.google.gson.Gson;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.iotdb.db.protocol.mqtt;
package org.apache.iotdb.mqtt;

import io.netty.buffer.ByteBuf;
import org.apache.tsfile.enums.TSDataType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.iotdb.db.protocol.mqtt;
package org.apache.iotdb.mqtt;

import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.db.service;

import org.apache.iotdb.commons.service.IService;
import org.apache.iotdb.commons.service.ServiceType;
package org.apache.iotdb.mqtt;

import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.protocol.mqtt.BrokerAuthenticator;
import org.apache.iotdb.db.protocol.mqtt.MPPPublishHandler;
import org.apache.iotdb.externalservice.api.IExternalService;

import io.moquette.BrokerConstants;
import io.moquette.broker.Server;
Expand All @@ -40,12 +38,10 @@
import java.util.Properties;

/** The IoTDB MQTT Service. */
public class MQTTService implements IService {
public class MQTTService implements IExternalService {
private static final Logger LOG = LoggerFactory.getLogger(MQTTService.class);
private final Server server = new Server();

private MQTTService() {}

@Override
public void start() {
startup();
Expand Down Expand Up @@ -106,20 +102,4 @@ private IConfig createBrokerConfig(IoTDBConfig iotDBConfig) {
public void shutdown() {
server.stopServer();
}

@Override
public ServiceType getID() {
return ServiceType.MQTT_SERVICE;
}

public static MQTTService getInstance() {
return MQTTServiceHolder.INSTANCE;
}

private static class MQTTServiceHolder {

private static final MQTTService INSTANCE = new MQTTService();

private MQTTServiceHolder() {}
}
}
Loading
Loading