Moved packages from old io.moquette.server to new io.moquette.broker
This commit is contained in:
@@ -15,8 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
import io.moquette.broker.security.IAuthorizatorPolicy;
|
||||||
import io.netty.handler.codec.mqtt.MqttQoS;
|
import io.netty.handler.codec.mqtt.MqttQoS;
|
||||||
import io.netty.handler.codec.mqtt.MqttSubscribeMessage;
|
import io.netty.handler.codec.mqtt.MqttSubscribeMessage;
|
||||||
import io.netty.handler.codec.mqtt.MqttTopicSubscription;
|
import io.netty.handler.codec.mqtt.MqttTopicSubscription;
|
||||||
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static io.moquette.spi.impl.Utils.messageId;
|
import static io.moquette.broker.Utils.messageId;
|
||||||
import static io.netty.handler.codec.mqtt.MqttQoS.FAILURE;
|
import static io.netty.handler.codec.mqtt.MqttQoS.FAILURE;
|
||||||
|
|
||||||
final class Authorizator {
|
final class Authorizator {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
import io.netty.channel.ChannelDuplexHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
|
|
||||||
class BrokerConfiguration {
|
class BrokerConfiguration {
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -13,10 +13,10 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.server.netty;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import com.bugsnag.Bugsnag;
|
import com.bugsnag.Bugsnag;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
+7
-8
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@@ -34,8 +34,7 @@ import java.util.Collections;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.spi.security.ISslContextCreator;
|
|
||||||
import io.netty.handler.ssl.ClientAuth;
|
import io.netty.handler.ssl.ClientAuth;
|
||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
import io.netty.handler.ssl.SslContextBuilder;
|
import io.netty.handler.ssl.SslContextBuilder;
|
||||||
@@ -46,16 +45,16 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moquette server implementation to load SSL certificate from local filesystem path configured in
|
* Moquette integration implementation to load SSL certificate from local filesystem path configured in
|
||||||
* config file.
|
* config file.
|
||||||
*/
|
*/
|
||||||
public class DefaultMoquetteSslContextCreator implements ISslContextCreator {
|
class DefaultMoquetteSslContextCreator implements ISslContextCreator {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(DefaultMoquetteSslContextCreator.class);
|
private static final Logger LOG = LoggerFactory.getLogger(DefaultMoquetteSslContextCreator.class);
|
||||||
|
|
||||||
private final IConfig props;
|
private final IConfig props;
|
||||||
|
|
||||||
public DefaultMoquetteSslContextCreator(IConfig props) {
|
DefaultMoquetteSslContextCreator(IConfig props) {
|
||||||
this.props = Objects.requireNonNull(props);
|
this.props = Objects.requireNonNull(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +130,7 @@ public class DefaultMoquetteSslContextCreator implements ISslContextCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OpenSSL provider does not support the {@link KeyManagerFactory}, so we have to lookup the server
|
* The OpenSSL provider does not support the {@link KeyManagerFactory}, so we have to lookup the integration
|
||||||
* certificate and key in order to provide it to OpenSSL.
|
* certificate and key in order to provide it to OpenSSL.
|
||||||
* <p>
|
* <p>
|
||||||
* TODO: SNI is currently not supported, we use only the first found private key.
|
* TODO: SNI is currently not supported, we use only the first found private key.
|
||||||
@@ -153,7 +152,7 @@ public class DefaultMoquetteSslContextCreator implements ISslContextCreator {
|
|||||||
private static void addClientAuthentication(KeyStore ks, SslContextBuilder contextBuilder)
|
private static void addClientAuthentication(KeyStore ks, SslContextBuilder contextBuilder)
|
||||||
throws NoSuchAlgorithmException, KeyStoreException {
|
throws NoSuchAlgorithmException, KeyStoreException {
|
||||||
LOG.warn("Client authentication is enabled. The keystore will be used as a truststore.");
|
LOG.warn("Client authentication is enabled. The keystore will be used as a truststore.");
|
||||||
// use keystore as truststore, as server needs to trust certificates signed by the server certificates
|
// use keystore as truststore, as integration needs to trust certificates signed by the integration certificates
|
||||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||||
tmf.init(ks);
|
tmf.init(ks);
|
||||||
contextBuilder.clientAuth(ClientAuth.REQUIRE);
|
contextBuilder.clientAuth(ClientAuth.REQUIRE);
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||||
|
|
||||||
public interface IRetainedRepository {
|
public interface IRetainedRepository {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.security;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.server.netty.NettyUtils;
|
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
import io.netty.channel.ChannelDuplexHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.util.concurrent.EventExecutor;
|
import io.netty.util.concurrent.EventExecutor;
|
||||||
|
|||||||
@@ -15,10 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.server.netty.NettyUtils;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.impl.DebugUtils;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
@@ -154,7 +152,7 @@ final class MQTTConnection {
|
|||||||
|
|
||||||
// Generating client id.
|
// Generating client id.
|
||||||
clientId = UUID.randomUUID().toString().replace("-", "");
|
clientId = UUID.randomUUID().toString().replace("-", "");
|
||||||
LOG.debug("Client has connected with server generated id: {}, username: {}, channel: {}", clientId,
|
LOG.debug("Client has connected with integration generated id: {}, username: {}, channel: {}", clientId,
|
||||||
username, channel);
|
username, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
|
||||||
class MQTTConnectionFactory {
|
class MQTTConnectionFactory {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|||||||
@@ -15,11 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MemorySubscriptionsRepository implements ISubscriptionsRepository {
|
public class MemorySubscriptionsRepository implements ISubscriptionsRepository {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
+7
-7
@@ -14,9 +14,8 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.server.Constants;
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.util.Attribute;
|
import io.netty.util.Attribute;
|
||||||
@@ -28,12 +27,13 @@ import io.netty.util.AttributeKey;
|
|||||||
public final class NettyUtils {
|
public final class NettyUtils {
|
||||||
|
|
||||||
public static final String ATTR_USERNAME = "username";
|
public static final String ATTR_USERNAME = "username";
|
||||||
public static final String ATTR_SESSION_STOLEN = "sessionStolen";
|
|
||||||
public static final String ATTR_CHANNEL_STATUS = "channelStatus";
|
|
||||||
|
|
||||||
private static final AttributeKey<Object> ATTR_KEY_KEEPALIVE = AttributeKey.valueOf(Constants.KEEP_ALIVE);
|
private static final String ATTR_CLIENTID = "ClientID";
|
||||||
private static final AttributeKey<Object> ATTR_KEY_CLEANSESSION = AttributeKey.valueOf(Constants.CLEAN_SESSION);
|
private static final String CLEAN_SESSION = "removeTemporaryQoS2";
|
||||||
private static final AttributeKey<Object> ATTR_KEY_CLIENTID = AttributeKey.valueOf(Constants.ATTR_CLIENTID);
|
private static final String KEEP_ALIVE = "keepAlive";
|
||||||
|
private static final AttributeKey<Object> ATTR_KEY_KEEPALIVE = AttributeKey.valueOf(KEEP_ALIVE);
|
||||||
|
private static final AttributeKey<Object> ATTR_KEY_CLEANSESSION = AttributeKey.valueOf(CLEAN_SESSION);
|
||||||
|
private static final AttributeKey<Object> ATTR_KEY_CLIENTID = AttributeKey.valueOf(ATTR_CLIENTID);
|
||||||
private static final AttributeKey<Object> ATTR_KEY_USERNAME = AttributeKey.valueOf(ATTR_USERNAME);
|
private static final AttributeKey<Object> ATTR_KEY_USERNAME = AttributeKey.valueOf(ATTR_USERNAME);
|
||||||
|
|
||||||
public static Object getAttribute(ChannelHandlerContext ctx, AttributeKey<Object> key) {
|
public static Object getAttribute(ChannelHandlerContext ctx, AttributeKey<Object> key) {
|
||||||
@@ -17,12 +17,8 @@
|
|||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.server.netty.AutoFlushHandler;
|
import io.moquette.broker.metrics.*;
|
||||||
import io.moquette.server.netty.BugSnagErrorsHandler;
|
|
||||||
import io.moquette.server.netty.MoquetteIdleTimeoutHandler;
|
|
||||||
import io.moquette.server.netty.metrics.*;
|
|
||||||
import io.moquette.spi.security.ISslContextCreator;
|
|
||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.*;
|
import io.netty.channel.*;
|
||||||
@@ -172,7 +168,7 @@ class NewNettyAcceptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initFactory(String host, int port, String protocol, final PipelineInitializer pipelieInitializer) {
|
private void initFactory(String host, int port, String protocol, final PipelineInitializer pipelieInitializer) {
|
||||||
LOG.debug("Initializing server. Protocol={}", protocol);
|
LOG.debug("Initializing integration. Protocol={}", protocol);
|
||||||
ServerBootstrap b = new ServerBootstrap();
|
ServerBootstrap b = new ServerBootstrap();
|
||||||
b.group(bossGroup, workerGroup).channel(channelClass)
|
b.group(bossGroup, workerGroup).channel(channelClass)
|
||||||
.childHandler(new ChannelInitializer<SocketChannel>() {
|
.childHandler(new ChannelInitializer<SocketChannel>() {
|
||||||
@@ -187,13 +183,13 @@ class NewNettyAcceptor {
|
|||||||
.childOption(ChannelOption.TCP_NODELAY, nettyTcpNodelay)
|
.childOption(ChannelOption.TCP_NODELAY, nettyTcpNodelay)
|
||||||
.childOption(ChannelOption.SO_KEEPALIVE, nettySoKeepalive);
|
.childOption(ChannelOption.SO_KEEPALIVE, nettySoKeepalive);
|
||||||
try {
|
try {
|
||||||
LOG.debug("Binding server. host={}, port={}", host, port);
|
LOG.debug("Binding integration. host={}, port={}", host, port);
|
||||||
// Bind and start to accept incoming connections.
|
// Bind and start to accept incoming connections.
|
||||||
ChannelFuture f = b.bind(host, port);
|
ChannelFuture f = b.bind(host, port);
|
||||||
LOG.info("Server bound to host={}, port={}, protocol={}", host, port, protocol);
|
LOG.info("Server bound to host={}, port={}, protocol={}", host, port, protocol);
|
||||||
f.sync().addListener(FIRE_EXCEPTION_ON_FAILURE);
|
f.sync().addListener(FIRE_EXCEPTION_ON_FAILURE);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
LOG.error("An interruptedException was caught while initializing server. Protocol={}", protocol, ex);
|
LOG.error("An interruptedException was caught while initializing integration. Protocol={}", protocol, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.server.netty.NettyUtils;
|
|
||||||
import io.netty.channel.*;
|
import io.netty.channel.*;
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.handler.codec.mqtt.MqttMessage;
|
import io.netty.handler.codec.mqtt.MqttMessage;
|
||||||
|
|||||||
@@ -15,12 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.server.netty.NettyUtils;
|
import io.moquette.interception.BrokerInterceptor;
|
||||||
import io.moquette.spi.impl.BrokerInterceptor;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.security.IAuthorizatorPolicy;
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.handler.codec.mqtt.*;
|
import io.netty.handler.codec.mqtt.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -31,7 +30,7 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static io.moquette.spi.impl.Utils.messageId;
|
import static io.moquette.broker.Utils.messageId;
|
||||||
import static io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader.from;
|
import static io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader.from;
|
||||||
import static io.netty.handler.codec.mqtt.MqttQoS.*;
|
import static io.netty.handler.codec.mqtt.MqttQoS.*;
|
||||||
|
|
||||||
|
|||||||
@@ -16,18 +16,16 @@
|
|||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
|
import io.moquette.broker.config.*;
|
||||||
import io.moquette.interception.InterceptHandler;
|
import io.moquette.interception.InterceptHandler;
|
||||||
import io.moquette.persistence.MemoryStorageService;
|
import io.moquette.persistence.MemoryStorageService;
|
||||||
import io.moquette.server.DefaultMoquetteSslContextCreator;
|
|
||||||
import io.moquette.server.config.*;
|
|
||||||
import io.moquette.spi.ISessionsStore;
|
import io.moquette.spi.ISessionsStore;
|
||||||
import io.moquette.spi.impl.BrokerInterceptor;
|
import io.moquette.interception.BrokerInterceptor;
|
||||||
import io.moquette.spi.impl.security.*;
|
import io.moquette.broker.security.*;
|
||||||
import io.moquette.spi.impl.subscriptions.CTrieSubscriptionDirectory;
|
import io.moquette.broker.subscriptions.CTrieSubscriptionDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
import io.moquette.broker.security.IAuthorizatorPolicy;
|
||||||
import io.moquette.spi.security.ISslContextCreator;
|
|
||||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -70,7 +68,7 @@ public class Server {
|
|||||||
*/
|
*/
|
||||||
public void startServer() throws IOException {
|
public void startServer() throws IOException {
|
||||||
File defaultConfigurationFile = defaultConfigFile();
|
File defaultConfigurationFile = defaultConfigFile();
|
||||||
LOG.info("Starting Moquette server. Configuration file path={}", defaultConfigurationFile.getAbsolutePath());
|
LOG.info("Starting Moquette integration. Configuration file path={}", defaultConfigurationFile.getAbsolutePath());
|
||||||
IResourceLoader filesystemLoader = new FileResourceLoader(defaultConfigurationFile);
|
IResourceLoader filesystemLoader = new FileResourceLoader(defaultConfigurationFile);
|
||||||
final IConfig config = new ResourceLoaderConfig(filesystemLoader);
|
final IConfig config = new ResourceLoaderConfig(filesystemLoader);
|
||||||
startServer(config);
|
startServer(config);
|
||||||
@@ -88,14 +86,14 @@ public class Server {
|
|||||||
* @throws IOException in case of any IO Error.
|
* @throws IOException in case of any IO Error.
|
||||||
*/
|
*/
|
||||||
public void startServer(File configFile) throws IOException {
|
public void startServer(File configFile) throws IOException {
|
||||||
LOG.info("Starting Moquette server. Configuration file path: {}", configFile.getAbsolutePath());
|
LOG.info("Starting Moquette integration. Configuration file path: {}", configFile.getAbsolutePath());
|
||||||
IResourceLoader filesystemLoader = new FileResourceLoader(configFile);
|
IResourceLoader filesystemLoader = new FileResourceLoader(configFile);
|
||||||
final IConfig config = new ResourceLoaderConfig(filesystemLoader);
|
final IConfig config = new ResourceLoaderConfig(filesystemLoader);
|
||||||
startServer(config);
|
startServer(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the server with the given properties.
|
* Starts the integration with the given properties.
|
||||||
* <p>
|
* <p>
|
||||||
* Its suggested to at least have the following properties:
|
* Its suggested to at least have the following properties:
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -107,7 +105,7 @@ public class Server {
|
|||||||
* @throws IOException in case of any IO Error.
|
* @throws IOException in case of any IO Error.
|
||||||
*/
|
*/
|
||||||
public void startServer(Properties configProps) throws IOException {
|
public void startServer(Properties configProps) throws IOException {
|
||||||
LOG.debug("Starting Moquette server using properties object");
|
LOG.debug("Starting Moquette integration using properties object");
|
||||||
final IConfig config = new MemoryConfig(configProps);
|
final IConfig config = new MemoryConfig(configProps);
|
||||||
startServer(config);
|
startServer(config);
|
||||||
}
|
}
|
||||||
@@ -119,7 +117,7 @@ public class Server {
|
|||||||
* @throws IOException in case of any IO Error.
|
* @throws IOException in case of any IO Error.
|
||||||
*/
|
*/
|
||||||
public void startServer(IConfig config) throws IOException {
|
public void startServer(IConfig config) throws IOException {
|
||||||
LOG.debug("Starting Moquette server using IConfig instance");
|
LOG.debug("Starting Moquette integration using IConfig instance");
|
||||||
startServer(config, null);
|
startServer(config, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +130,7 @@ public class Server {
|
|||||||
* @throws IOException in case of any IO Error.
|
* @throws IOException in case of any IO Error.
|
||||||
*/
|
*/
|
||||||
public void startServer(IConfig config, List<? extends InterceptHandler> handlers) throws IOException {
|
public void startServer(IConfig config, List<? extends InterceptHandler> handlers) throws IOException {
|
||||||
LOG.debug("Starting moquette server using IConfig instance and intercept handlers");
|
LOG.debug("Starting moquette integration using IConfig instance and intercept handlers");
|
||||||
startServer(config, handlers, null, null, null);
|
startServer(config, handlers, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +179,7 @@ public class Server {
|
|||||||
acceptor.initialize(mqttHandler, config, sslCtxCreator);
|
acceptor.initialize(mqttHandler, config, sslCtxCreator);
|
||||||
|
|
||||||
final long startTime = System.currentTimeMillis() - start;
|
final long startTime = System.currentTimeMillis() - start;
|
||||||
LOG.info("Moquette server has been started successfully in {} ms", startTime);
|
LOG.info("Moquette integration has been started successfully in {} ms", startTime);
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,25 +294,25 @@ public class Server {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the broker to publish a message. It's intended for embedding applications. It can be used
|
* Use the broker to publish a message. It's intended for embedding applications. It can be used
|
||||||
* only after the server is correctly started with startServer.
|
* only after the integration is correctly started with startServer.
|
||||||
*
|
*
|
||||||
* @param msg the message to forward.
|
* @param msg the message to forward.
|
||||||
* @param clientId the id of the sending server.
|
* @param clientId the id of the sending integration.
|
||||||
* @throws IllegalStateException if the server is not yet started
|
* @throws IllegalStateException if the integration is not yet started
|
||||||
*/
|
*/
|
||||||
public void internalPublish(MqttPublishMessage msg, final String clientId) {
|
public void internalPublish(MqttPublishMessage msg, final String clientId) {
|
||||||
final int messageID = msg.variableHeader().packetId();
|
final int messageID = msg.variableHeader().packetId();
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
LOG.error("Moquette is not started, internal message cannot be published. CId: {}, messageId: {}", clientId,
|
LOG.error("Moquette is not started, internal message cannot be published. CId: {}, messageId: {}", clientId,
|
||||||
messageID);
|
messageID);
|
||||||
throw new IllegalStateException("Can't publish on a server is not yet started");
|
throw new IllegalStateException("Can't publish on a integration is not yet started");
|
||||||
}
|
}
|
||||||
LOG.trace("Internal publishing message CId: {}, messageId: {}", clientId, messageID);
|
LOG.trace("Internal publishing message CId: {}, messageId: {}", clientId, messageID);
|
||||||
dispatcher.internalPublish(msg);
|
dispatcher.internalPublish(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopServer() {
|
public void stopServer() {
|
||||||
LOG.info("Unbinding server from the configured ports");
|
LOG.info("Unbinding integration from the configured ports");
|
||||||
acceptor.close();
|
acceptor.close();
|
||||||
LOG.trace("Stopping MQTT protocol processor");
|
LOG.trace("Stopping MQTT protocol processor");
|
||||||
initialized = false;
|
initialized = false;
|
||||||
@@ -323,7 +321,7 @@ public class Server {
|
|||||||
// and SessionsRepository does not stop its tasks. Thus shutdownNow().
|
// and SessionsRepository does not stop its tasks. Thus shutdownNow().
|
||||||
scheduler.shutdownNow();
|
scheduler.shutdownNow();
|
||||||
|
|
||||||
LOG.info("Moquette server has been stopped.");
|
LOG.info("Moquette integration has been stopped.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,7 +347,7 @@ public class Server {
|
|||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
LOG.error("Moquette is not started, MQTT message interceptor cannot be added. InterceptorId={}",
|
LOG.error("Moquette is not started, MQTT message interceptor cannot be added. InterceptorId={}",
|
||||||
interceptHandler.getID());
|
interceptHandler.getID());
|
||||||
throw new IllegalStateException("Can't register interceptors on a server that is not yet started");
|
throw new IllegalStateException("Can't register interceptors on a integration that is not yet started");
|
||||||
}
|
}
|
||||||
LOG.info("Adding MQTT message interceptor. InterceptorId={}", interceptHandler.getID());
|
LOG.info("Adding MQTT message interceptor. InterceptorId={}", interceptHandler.getID());
|
||||||
interceptor.addInterceptHandler(interceptHandler);
|
interceptor.addInterceptHandler(interceptHandler);
|
||||||
@@ -364,7 +362,7 @@ public class Server {
|
|||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
LOG.error("Moquette is not started, MQTT message interceptor cannot be removed. InterceptorId={}",
|
LOG.error("Moquette is not started, MQTT message interceptor cannot be removed. InterceptorId={}",
|
||||||
interceptHandler.getID());
|
interceptHandler.getID());
|
||||||
throw new IllegalStateException("Can't deregister interceptors from a server that is not yet started");
|
throw new IllegalStateException("Can't deregister interceptors from a integration that is not yet started");
|
||||||
}
|
}
|
||||||
LOG.info("Removing MQTT message interceptor. InterceptorId={}", interceptHandler.getID());
|
LOG.info("Removing MQTT message interceptor. InterceptorId={}", interceptHandler.getID());
|
||||||
interceptor.removeInterceptHandler(interceptHandler);
|
interceptor.removeInterceptHandler(interceptHandler);
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.handler.codec.mqtt.*;
|
import io.netty.handler.codec.mqtt.*;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.broker.Session.SessionStatus;
|
import io.moquette.broker.Session.SessionStatus;
|
||||||
import io.moquette.spi.impl.BrokerInterceptor;
|
import io.moquette.interception.BrokerInterceptor;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.handler.codec.mqtt.MqttMessage;
|
import io.netty.handler.codec.mqtt.MqttMessage;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
+1
-3
@@ -14,14 +14,12 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
+1
-3
@@ -14,11 +14,9 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty.metrics;
|
package io.moquette.broker.metrics;
|
||||||
|
|
||||||
public class BytesMetrics {
|
public class BytesMetrics {
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty.metrics;
|
package io.moquette.broker.metrics;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty.metrics;
|
package io.moquette.broker.metrics;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
+3
-3
@@ -13,14 +13,14 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.server.netty.metrics;
|
package io.moquette.broker.metrics;
|
||||||
|
|
||||||
import com.codahale.metrics.Counter;
|
import com.codahale.metrics.Counter;
|
||||||
import com.codahale.metrics.Meter;
|
import com.codahale.metrics.Meter;
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import com.librato.metrics.reporter.Librato;
|
import com.librato.metrics.reporter.Librato;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.server.netty.NettyUtils;
|
import io.moquette.broker.NettyUtils;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||||
import io.netty.handler.codec.mqtt.MqttMessage;
|
import io.netty.handler.codec.mqtt.MqttMessage;
|
||||||
+3
-3
@@ -14,9 +14,9 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty.metrics;
|
package io.moquette.broker.metrics;
|
||||||
|
|
||||||
import io.moquette.server.netty.NettyUtils;
|
import io.moquette.broker.NettyUtils;
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
import io.netty.channel.ChannelDuplexHandler;
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static io.moquette.spi.impl.Utils.messageId;
|
import static io.moquette.broker.Utils.messageId;
|
||||||
import static io.netty.channel.ChannelFutureListener.CLOSE_ON_FAILURE;
|
import static io.netty.channel.ChannelFutureListener.CLOSE_ON_FAILURE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty.metrics;
|
package io.moquette.broker.metrics;
|
||||||
|
|
||||||
public class MessageMetrics {
|
public class MessageMetrics {
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty.metrics;
|
package io.moquette.broker.metrics;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.netty.metrics;
|
package io.moquette.broker.metrics;
|
||||||
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
import io.netty.channel.ChannelDuplexHandler;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
+1
-3
@@ -14,9 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
|
|
||||||
public class AcceptAllAuthenticator implements IAuthenticator {
|
public class AcceptAllAuthenticator implements IAuthenticator {
|
||||||
|
|
||||||
+3
-3
@@ -14,10 +14,10 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import static io.moquette.spi.impl.security.Authorization.Permission.READWRITE;
|
import static io.moquette.broker.security.Authorization.Permission.READWRITE;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Carries the read/write authorization to topics for the users.
|
* Carries the read/write authorization to topics for the users.
|
||||||
+3
-3
@@ -14,10 +14,10 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
+2
-3
@@ -14,12 +14,11 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import org.apache.commons.codec.binary.Hex;
|
import org.apache.commons.codec.binary.Hex;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
+2
-3
@@ -14,10 +14,9 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
|
||||||
|
|
||||||
public class DenyAllAuthorizatorPolicy implements IAuthorizatorPolicy {
|
public class DenyAllAuthorizatorPolicy implements IAuthorizatorPolicy {
|
||||||
|
|
||||||
+2
-2
@@ -14,9 +14,9 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import io.moquette.server.config.FileResourceLoader;
|
import io.moquette.broker.config.FileResourceLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load user credentials from a text file. Each line of the file is formatted as
|
* Load user credentials from a text file. Each line of the file is formatted as
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* username and password checker
|
* username and password checker
|
||||||
+2
-2
@@ -14,9 +14,9 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ACL checker.
|
* ACL checker.
|
||||||
+2
-3
@@ -14,10 +14,9 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
|
||||||
|
|
||||||
public class PermitAllAuthorizatorPolicy implements IAuthorizatorPolicy {
|
public class PermitAllAuthorizatorPolicy implements IAuthorizatorPolicy {
|
||||||
|
|
||||||
+2
-3
@@ -14,10 +14,9 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import io.moquette.server.config.IResourceLoader;
|
import io.moquette.broker.config.IResourceLoader;
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
+1
-3
@@ -13,9 +13,7 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
import io.netty.handler.codec.mqtt.MqttQoS;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
import io.moquette.broker.ISubscriptionsRepository;
|
import io.moquette.broker.ISubscriptionsRepository;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
|
|
||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
import io.moquette.broker.ISubscriptionsRepository;
|
import io.moquette.broker.ISubscriptionsRepository;
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
import io.netty.handler.codec.mqtt.MqttQoS;
|
import io.netty.handler.codec.mqtt.MqttQoS;
|
||||||
|
|
||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
class TNode extends CNode {
|
class TNode extends CNode {
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal use only class.
|
* Internal use only class.
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.subscriptions;
|
package io.moquette.broker.subscriptions;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012-2018 The original author or authors
|
|
||||||
* ------------------------------------------------------
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* and Apache License v2.0 which accompanies this distribution.
|
|
||||||
*
|
|
||||||
* The Eclipse Public License is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* The Apache License v2.0 is available at
|
|
||||||
* http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
*
|
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.moquette.connections;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class that represents the metrics of a given MQTT connection.
|
|
||||||
*/
|
|
||||||
public class MqttConnectionMetrics {
|
|
||||||
|
|
||||||
private long readKb;
|
|
||||||
private long writtenKb;
|
|
||||||
private long readMessages;
|
|
||||||
private long writtenMessages;
|
|
||||||
|
|
||||||
public MqttConnectionMetrics(long readBytes, long writtenBytes, long readMessages, long writtenMessages) {
|
|
||||||
this.readKb = readBytes / 1024;
|
|
||||||
this.writtenKb = writtenBytes / 1024;
|
|
||||||
this.readMessages = readMessages;
|
|
||||||
this.writtenMessages = writtenMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getReadKb() {
|
|
||||||
return readKb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getWrittenKb() {
|
|
||||||
return writtenKb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getReadMessages() {
|
|
||||||
return readMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getWrittenMessages() {
|
|
||||||
return writtenMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012-2018 The original author or authors
|
|
||||||
* ------------------------------------------------------
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* and Apache License v2.0 which accompanies this distribution.
|
|
||||||
*
|
|
||||||
* The Eclipse Public License is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* The Apache License v2.0 is available at
|
|
||||||
* http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
*
|
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.moquette.connections;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class that represents the overall connection status of a MQTT session. Its instances will be
|
|
||||||
* used by an external codebase when the broker is configured in embedded mode.
|
|
||||||
*/
|
|
||||||
public class MqttSession {
|
|
||||||
|
|
||||||
private boolean connectionEstablished;
|
|
||||||
private boolean cleanSession;
|
|
||||||
private int inflightMessages;
|
|
||||||
private int pendingPublishMessagesNo;
|
|
||||||
private int secondPhaseAckPendingMessages;
|
|
||||||
private Collection<MqttSubscription> activeSubscriptions;
|
|
||||||
private MqttConnectionMetrics connectionMetrics;
|
|
||||||
|
|
||||||
public boolean isConnectionEstablished() {
|
|
||||||
return connectionEstablished;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConnectionEstablished(boolean connectionEstablished) {
|
|
||||||
this.connectionEstablished = connectionEstablished;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCleanSession() {
|
|
||||||
return cleanSession;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCleanSession(boolean cleanSession) {
|
|
||||||
this.cleanSession = cleanSession;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPendingPublishMessagesNo() {
|
|
||||||
return pendingPublishMessagesNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPendingPublishMessagesNo(int pendingPublishMessagesNo) {
|
|
||||||
this.pendingPublishMessagesNo = pendingPublishMessagesNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInflightMessages() {
|
|
||||||
return inflightMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInflightMessages(int inflightMessages) {
|
|
||||||
this.inflightMessages = inflightMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSecondPhaseAckPendingMessages() {
|
|
||||||
return secondPhaseAckPendingMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecondPhaseAckPendingMessages(int secondPhaseAckPendingMessages) {
|
|
||||||
this.secondPhaseAckPendingMessages = secondPhaseAckPendingMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<MqttSubscription> getActiveSubscriptions() {
|
|
||||||
return activeSubscriptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActiveSubscriptions(Collection<MqttSubscription> activeSubscriptions) {
|
|
||||||
this.activeSubscriptions = activeSubscriptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MqttConnectionMetrics getConnectionMetrics() {
|
|
||||||
return connectionMetrics;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConnectionMetrics(MqttConnectionMetrics connectionMetrics) {
|
|
||||||
this.connectionMetrics = connectionMetrics;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012-2018 The original author or authors
|
|
||||||
* ------------------------------------------------------
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* and Apache License v2.0 which accompanies this distribution.
|
|
||||||
*
|
|
||||||
* The Eclipse Public License is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* The Apache License v2.0 is available at
|
|
||||||
* http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
*
|
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.moquette.connections;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class that represents a MQTT subscription.
|
|
||||||
*/
|
|
||||||
public class MqttSubscription {
|
|
||||||
|
|
||||||
private final String requestedQos;
|
|
||||||
private final String clientId;
|
|
||||||
private final String topicFilter;
|
|
||||||
private final boolean active;
|
|
||||||
|
|
||||||
public MqttSubscription(String requestedQos, String clientId, String topicFilter, boolean active) {
|
|
||||||
this.requestedQos = requestedQos;
|
|
||||||
this.clientId = clientId;
|
|
||||||
this.topicFilter = topicFilter;
|
|
||||||
this.active = active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRequestedQos() {
|
|
||||||
return requestedQos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClientId() {
|
|
||||||
return clientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTopicFilter() {
|
|
||||||
return topicFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isActive() {
|
|
||||||
return active;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+3
-5
@@ -14,14 +14,12 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl;
|
package io.moquette.interception;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
import io.moquette.interception.InterceptHandler;
|
|
||||||
import io.moquette.interception.Interceptor;
|
|
||||||
import io.moquette.interception.messages.*;
|
import io.moquette.interception.messages.*;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
||||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
package io.moquette.interception;
|
package io.moquette.interception;
|
||||||
|
|
||||||
import io.moquette.interception.messages.*;
|
import io.moquette.interception.messages.*;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.netty.handler.codec.mqtt.MqttMessage;
|
import io.netty.handler.codec.mqtt.MqttMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package io.moquette.interception;
|
package io.moquette.interception;
|
||||||
|
|
||||||
import io.moquette.interception.messages.InterceptAcknowledgedMessage;
|
import io.moquette.interception.messages.InterceptAcknowledgedMessage;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
||||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package io.moquette.interception.messages;
|
package io.moquette.interception.messages;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.netty.handler.codec.mqtt.MqttQoS;
|
import io.netty.handler.codec.mqtt.MqttQoS;
|
||||||
|
|
||||||
public class InterceptSubscribeMessage implements InterceptMessage {
|
public class InterceptSubscribeMessage implements InterceptMessage {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package io.moquette.persistence;
|
|||||||
|
|
||||||
import io.moquette.spi.IMatchingCondition;
|
import io.moquette.spi.IMatchingCondition;
|
||||||
import io.moquette.spi.IMessagesStore;
|
import io.moquette.spi.IMessagesStore;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,11 @@
|
|||||||
|
|
||||||
package io.moquette.persistence;
|
package io.moquette.persistence;
|
||||||
|
|
||||||
import io.moquette.server.Constants;
|
|
||||||
import io.moquette.spi.IMessagesStore.StoredMessage;
|
import io.moquette.spi.IMessagesStore.StoredMessage;
|
||||||
import io.moquette.spi.ISessionsStore;
|
import io.moquette.spi.ISessionsStore;
|
||||||
import io.moquette.spi.ISubscriptionsStore;
|
import io.moquette.spi.ISubscriptionsStore;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -33,11 +32,13 @@ public class MemorySessionStore implements ISessionsStore, ISubscriptionsStore {
|
|||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MemorySessionStore.class);
|
private static final Logger LOG = LoggerFactory.getLogger(MemorySessionStore.class);
|
||||||
|
|
||||||
|
static final int MAX_MESSAGE_QUEUE = 1024; // number of messages
|
||||||
|
|
||||||
static class Session {
|
static class Session {
|
||||||
final String clientID;
|
final String clientID;
|
||||||
final Map<Topic, Subscription> subscriptions = new ConcurrentHashMap<>();
|
final Map<Topic, Subscription> subscriptions = new ConcurrentHashMap<>();
|
||||||
boolean cleanSession;
|
boolean cleanSession;
|
||||||
final BlockingQueue<StoredMessage> queue = new ArrayBlockingQueue<>(Constants.MAX_MESSAGE_QUEUE);
|
final BlockingQueue<StoredMessage> queue = new ArrayBlockingQueue<>(MAX_MESSAGE_QUEUE);
|
||||||
final Map<Integer, StoredMessage> secondPhaseStore = new ConcurrentHashMap<>();
|
final Map<Integer, StoredMessage> secondPhaseStore = new ConcurrentHashMap<>();
|
||||||
final Map<Integer, StoredMessage> outboundFlightMessages =
|
final Map<Integer, StoredMessage> outboundFlightMessages =
|
||||||
Collections.synchronizedMap(new HashMap<Integer, StoredMessage>());
|
Collections.synchronizedMap(new HashMap<Integer, StoredMessage>());
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package io.moquette.persistence;
|
package io.moquette.persistence;
|
||||||
|
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.spi.IMessagesStore;
|
import io.moquette.spi.IMessagesStore;
|
||||||
import io.moquette.spi.ISessionsStore;
|
import io.moquette.spi.ISessionsStore;
|
||||||
import io.moquette.spi.IStore;
|
import io.moquette.spi.IStore;
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012-2018 The original author or authors
|
|
||||||
* ------------------------------------------------------
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* and Apache License v2.0 which accompanies this distribution.
|
|
||||||
*
|
|
||||||
* The Eclipse Public License is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* The Apache License v2.0 is available at
|
|
||||||
* http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
*
|
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.moquette.server;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Server constants keeper
|
|
||||||
*/
|
|
||||||
public final class Constants {
|
|
||||||
|
|
||||||
public static final String ATTR_CLIENTID = "ClientID";
|
|
||||||
public static final String CLEAN_SESSION = "removeTemporaryQoS2";
|
|
||||||
public static final String KEEP_ALIVE = "keepAlive";
|
|
||||||
public static final int MAX_MESSAGE_QUEUE = 1024; // number of messages
|
|
||||||
|
|
||||||
private Constants() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package io.moquette.spi;
|
package io.moquette.spi;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
|
|
||||||
public interface IMatchingCondition {
|
public interface IMatchingCondition {
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package io.moquette.spi;
|
package io.moquette.spi;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.handler.codec.mqtt.MqttQoS;
|
import io.netty.handler.codec.mqtt.MqttQoS;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package io.moquette.spi;
|
package io.moquette.spi;
|
||||||
|
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -17,8 +17,7 @@
|
|||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.interception.InterceptHandler;
|
import io.moquette.interception.InterceptHandler;
|
||||||
import io.moquette.spi.impl.BrokerInterceptor;
|
import io.moquette.interception.BrokerInterceptor;
|
||||||
import io.moquette.spi.impl.DebugUtils;
|
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.mqtt.*;
|
import io.netty.handler.codec.mqtt.*;
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.MockAuthenticator;
|
import io.moquette.broker.security.PermitAllAuthorizatorPolicy;
|
||||||
import io.moquette.spi.impl.security.PermitAllAuthorizatorPolicy;
|
import io.moquette.broker.subscriptions.CTrieSubscriptionDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.CTrieSubscriptionDirectory;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
||||||
@@ -28,7 +27,7 @@ import io.netty.handler.codec.mqtt.MqttVersion;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static io.moquette.spi.impl.NettyChannelAssertions.assertEqualsConnAck;
|
import static io.moquette.broker.NettyChannelAssertions.assertEqualsConnAck;
|
||||||
import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.*;
|
import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.*;
|
||||||
import static java.util.Collections.singleton;
|
import static java.util.Collections.singleton;
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
|
|||||||
@@ -15,11 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.MockAuthenticator;
|
import io.moquette.broker.security.PermitAllAuthorizatorPolicy;
|
||||||
import io.moquette.spi.impl.security.PermitAllAuthorizatorPolicy;
|
import io.moquette.broker.subscriptions.CTrieSubscriptionDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.CTrieSubscriptionDirectory;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
|
|||||||
+2
-2
@@ -14,11 +14,11 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.mqtt.MqttConnAckMessage;
|
import io.netty.handler.codec.mqtt.MqttConnAckMessage;
|
||||||
@@ -15,12 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.MockAuthenticator;
|
import io.moquette.broker.security.PermitAllAuthorizatorPolicy;
|
||||||
import io.moquette.spi.impl.security.PermitAllAuthorizatorPolicy;
|
import io.moquette.broker.subscriptions.CTrieSubscriptionDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.CTrieSubscriptionDirectory;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
|
|||||||
@@ -15,12 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.MockAuthenticator;
|
import io.moquette.broker.security.PermitAllAuthorizatorPolicy;
|
||||||
import io.moquette.spi.impl.security.PermitAllAuthorizatorPolicy;
|
import io.moquette.broker.subscriptions.CTrieSubscriptionDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.CTrieSubscriptionDirectory;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufUtil;
|
import io.netty.buffer.ByteBufUtil;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
|||||||
@@ -15,15 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.server.netty.NettyUtils;
|
import io.moquette.broker.security.PermitAllAuthorizatorPolicy;
|
||||||
import io.moquette.spi.impl.MockAuthenticator;
|
import io.moquette.broker.subscriptions.CTrieSubscriptionDirectory;
|
||||||
import io.moquette.spi.impl.security.PermitAllAuthorizatorPolicy;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.CTrieSubscriptionDirectory;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.security.IAuthorizatorPolicy;
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
|||||||
@@ -15,13 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.spi.impl.MockAuthenticator;
|
import io.moquette.broker.security.PermitAllAuthorizatorPolicy;
|
||||||
import io.moquette.spi.impl.security.PermitAllAuthorizatorPolicy;
|
import io.moquette.broker.subscriptions.CTrieSubscriptionDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.CTrieSubscriptionDirectory;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
import io.moquette.broker.subscriptions.Subscription;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
|||||||
@@ -15,12 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.moquette.broker;
|
package io.moquette.broker;
|
||||||
|
|
||||||
import io.moquette.server.netty.NettyUtils;
|
import io.moquette.broker.security.PermitAllAuthorizatorPolicy;
|
||||||
import io.moquette.spi.impl.MockAuthenticator;
|
import io.moquette.broker.subscriptions.CTrieSubscriptionDirectory;
|
||||||
import io.moquette.spi.impl.security.PermitAllAuthorizatorPolicy;
|
import io.moquette.broker.subscriptions.ISubscriptionsDirectory;
|
||||||
import io.moquette.spi.impl.subscriptions.CTrieSubscriptionDirectory;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.moquette.spi.impl.subscriptions.ISubscriptionsDirectory;
|
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
||||||
@@ -29,7 +27,7 @@ import io.netty.handler.codec.mqtt.MqttVersion;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static io.moquette.spi.impl.NettyChannelAssertions.assertEqualsConnAck;
|
import static io.moquette.broker.NettyChannelAssertions.assertEqualsConnAck;
|
||||||
import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.CONNECTION_ACCEPTED;
|
import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.CONNECTION_ACCEPTED;
|
||||||
import static java.util.Collections.singleton;
|
import static java.util.Collections.singleton;
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
|
|||||||
+4
-3
@@ -14,11 +14,12 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import org.junit.Test;
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class ClasspathResourceLoaderTest {
|
public class ClasspathResourceLoaderTest {
|
||||||
|
|
||||||
+2
-1
@@ -14,8 +14,9 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server.config;
|
package io.moquette.broker.config;
|
||||||
|
|
||||||
|
import io.moquette.broker.config.ConfigurationParser;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
+2
-2
@@ -14,10 +14,10 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
+2
-2
@@ -14,11 +14,11 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Hex;
|
import org.apache.commons.codec.binary.Hex;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
+1
-2
@@ -14,9 +14,8 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi.impl.security;
|
package io.moquette.broker.security;
|
||||||
|
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
+6
-9
@@ -14,17 +14,14 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.server.config.MemoryConfig;
|
import io.moquette.broker.config.MemoryConfig;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.persistence.MemoryMessagesStore;
|
import io.moquette.broker.security.IAuthenticator;
|
||||||
import io.moquette.persistence.MemoryStorageService;
|
import io.moquette.broker.security.IAuthorizatorPolicy;
|
||||||
import io.moquette.persistence.MemorySessionStore;
|
|
||||||
import io.moquette.spi.security.IAuthenticator;
|
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
|
||||||
import io.moquette.broker.Server;
|
import io.moquette.broker.Server;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
+2
-3
@@ -14,11 +14,10 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
@@ -95,7 +94,7 @@ public class MessageCollector implements MqttCallback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when the message sent to a server is ACKED (PUBACK or PUBCOMP by the server)
|
* Invoked when the message sent to a integration is ACKED (PUBACK or PUBCOMP by the integration)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||||
+5
-5
@@ -14,14 +14,14 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.broker.Server;
|
import io.moquette.broker.Server;
|
||||||
import io.moquette.server.config.MemoryConfig;
|
import io.moquette.broker.config.MemoryConfig;
|
||||||
import io.moquette.spi.impl.security.DBAuthenticator;
|
import io.moquette.broker.security.DBAuthenticator;
|
||||||
import io.moquette.spi.impl.security.DBAuthenticatorTest;
|
import io.moquette.broker.security.DBAuthenticatorTest;
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
|
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
+3
-3
@@ -14,10 +14,10 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.server.config.MemoryConfig;
|
import io.moquette.broker.config.MemoryConfig;
|
||||||
import io.moquette.broker.Server;
|
import io.moquette.broker.Server;
|
||||||
import org.fusesource.mqtt.client.*;
|
import org.fusesource.mqtt.client.*;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
+6
-6
@@ -14,15 +14,15 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import io.moquette.BrokerConstants;
|
import io.moquette.BrokerConstants;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.server.config.MemoryConfig;
|
import io.moquette.broker.config.MemoryConfig;
|
||||||
import io.moquette.broker.Server;
|
import io.moquette.broker.Server;
|
||||||
import io.moquette.spi.impl.security.AcceptAllAuthenticator;
|
import io.moquette.broker.security.AcceptAllAuthenticator;
|
||||||
import io.moquette.spi.impl.subscriptions.Topic;
|
import io.moquette.broker.subscriptions.Topic;
|
||||||
import io.moquette.spi.security.IAuthorizatorPolicy;
|
import io.moquette.broker.security.IAuthorizatorPolicy;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.handler.codec.mqtt.MqttMessageBuilders;
|
import io.netty.handler.codec.mqtt.MqttMessageBuilders;
|
||||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||||
+5
-5
@@ -14,11 +14,11 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import io.moquette.broker.Server;
|
import io.moquette.broker.Server;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.server.config.MemoryConfig;
|
import io.moquette.broker.config.MemoryConfig;
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
|
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
@@ -162,10 +162,10 @@ public class ServerIntegrationPahoTest {
|
|||||||
clientForSubscribe1.connect();
|
clientForSubscribe1.connect();
|
||||||
clientForSubscribe1.subscribe("topic", 0);
|
clientForSubscribe1.subscribe("topic", 0);
|
||||||
|
|
||||||
// server stop
|
// integration stop
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
System.out.println("\n\n SEVER REBOOTING \n\n");
|
System.out.println("\n\n SEVER REBOOTING \n\n");
|
||||||
// server start
|
// integration start
|
||||||
startServer();
|
startServer();
|
||||||
|
|
||||||
// clientForSubscribe2 connect and subscribe to /topic QoS2
|
// clientForSubscribe2 connect and subscribe to /topic QoS2
|
||||||
+3
-3
@@ -14,11 +14,11 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import io.moquette.broker.Server;
|
import io.moquette.broker.Server;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.server.config.MemoryConfig;
|
import io.moquette.broker.config.MemoryConfig;
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttClient;
|
import org.eclipse.paho.client.mqttv3.IMqttClient;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttClientPersistence;
|
import org.eclipse.paho.client.mqttv3.MqttClientPersistence;
|
||||||
+9
-9
@@ -14,11 +14,11 @@
|
|||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.integration;
|
||||||
|
|
||||||
import io.moquette.broker.Server;
|
import io.moquette.broker.Server;
|
||||||
import io.moquette.server.config.IConfig;
|
import io.moquette.broker.config.IConfig;
|
||||||
import io.moquette.server.config.MemoryConfig;
|
import io.moquette.broker.config.MemoryConfig;
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
|
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@@ -91,10 +91,10 @@ public class ServerIntegrationRestartTest {
|
|||||||
m_subscriber.subscribe("/topic", 1);
|
m_subscriber.subscribe("/topic", 1);
|
||||||
m_subscriber.disconnect();
|
m_subscriber.disconnect();
|
||||||
|
|
||||||
// shutdown the server
|
// shutdown the integration
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
|
|
||||||
// restart the server
|
// restart the integration
|
||||||
m_server.startServer(IntegrationUtils.prepareTestProperties());
|
m_server.startServer(IntegrationUtils.prepareTestProperties());
|
||||||
|
|
||||||
// reconnect the Subscriber subscribing to the same /topic but different QoS
|
// reconnect the Subscriber subscribing to the same /topic but different QoS
|
||||||
@@ -117,10 +117,10 @@ public class ServerIntegrationRestartTest {
|
|||||||
IMqttClient conn = subscribeAndPublish("/topic");
|
IMqttClient conn = subscribeAndPublish("/topic");
|
||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
|
|
||||||
// shutdown the server
|
// shutdown the integration
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
|
|
||||||
// restart the server
|
// restart the integration
|
||||||
m_server.startServer(IntegrationUtils.prepareTestProperties());
|
m_server.startServer(IntegrationUtils.prepareTestProperties());
|
||||||
|
|
||||||
m_publisher.connect();
|
m_publisher.connect();
|
||||||
@@ -137,10 +137,10 @@ public class ServerIntegrationRestartTest {
|
|||||||
m_subscriber.unsubscribe("/topic");
|
m_subscriber.unsubscribe("/topic");
|
||||||
m_subscriber.disconnect();
|
m_subscriber.disconnect();
|
||||||
|
|
||||||
// shutdown the server
|
// shutdown the integration
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
|
|
||||||
// restart the server
|
// restart the integration
|
||||||
m_server.startServer(IntegrationUtils.prepareTestProperties());
|
m_server.startServer(IntegrationUtils.prepareTestProperties());
|
||||||
// subscriber reconnects
|
// subscriber reconnects
|
||||||
m_subscriber = new MqttClient("tcp://localhost:1883", "Subscriber", s_dataStore);
|
m_subscriber = new MqttClient("tcp://localhost:1883", "Subscriber", s_dataStore);
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user