Browse Source

Merge pull request #1 from thingsboard/master

pull latest
pull/792/head
GreatGarlic 8 years ago
committed by GitHub
parent
commit
15f53ee899
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      application/src/main/resources/thingsboard.yml
  2. 8
      dao/src/main/java/org/thingsboard/server/dao/cassandra/AbstractCassandraCluster.java
  3. 11
      docker/tb/run-application.sh
  4. 8
      transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportServerInitializer.java
  5. 5
      transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportService.java
  6. 2
      ui/src/app/app.js

1
application/src/main/resources/thingsboard.yml

@ -87,6 +87,7 @@ mqtt:
leak_detector_level: "${NETTY_LEASK_DETECTOR_LVL:DISABLED}" leak_detector_level: "${NETTY_LEASK_DETECTOR_LVL:DISABLED}"
boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}" boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}"
worker_group_thread_count: "${NETTY_WORKER_GROUP_THREADS:12}" worker_group_thread_count: "${NETTY_WORKER_GROUP_THREADS:12}"
max_payload_size: "${NETTY_MAX_PAYLOAD_SIZE:65536}"
# MQTT SSL configuration # MQTT SSL configuration
ssl: ssl:
# Enable/disable SSL support # Enable/disable SSL support

8
dao/src/main/java/org/thingsboard/server/dao/cassandra/AbstractCassandraCluster.java

@ -60,6 +60,10 @@ public abstract class AbstractCassandraCluster {
private long initTimeout; private long initTimeout;
@Value("${cassandra.init_retry_interval_ms}") @Value("${cassandra.init_retry_interval_ms}")
private long initRetryInterval; private long initRetryInterval;
@Value("${cassandra.max_requests_per_connection_local:128}")
private int max_requests_local;
@Value("${cassandra.max_requests_per_connection_remote:128}")
private int max_requests_remote;
@Autowired @Autowired
private CassandraSocketOptions socketOpts; private CassandraSocketOptions socketOpts;
@ -90,8 +94,8 @@ public abstract class AbstractCassandraCluster {
.withClusterName(clusterName) .withClusterName(clusterName)
.withSocketOptions(socketOpts.getOpts()) .withSocketOptions(socketOpts.getOpts())
.withPoolingOptions(new PoolingOptions() .withPoolingOptions(new PoolingOptions()
.setMaxRequestsPerConnection(HostDistance.LOCAL, 32768) .setMaxRequestsPerConnection(HostDistance.LOCAL, max_requests_local)
.setMaxRequestsPerConnection(HostDistance.REMOTE, 32768)); .setMaxRequestsPerConnection(HostDistance.REMOTE, max_requests_remote));
this.clusterBuilder.withQueryOptions(queryOpts.getOpts()); this.clusterBuilder.withQueryOptions(queryOpts.getOpts());
this.clusterBuilder.withCompression(StringUtils.isEmpty(compression) ? Compression.NONE : Compression.valueOf(compression.toUpperCase())); this.clusterBuilder.withCompression(StringUtils.isEmpty(compression) ? Compression.NONE : Compression.valueOf(compression.toUpperCase()));
if (ssl) { if (ssl) {

11
docker/tb/run-application.sh

@ -18,6 +18,11 @@
dpkg -i /thingsboard.deb dpkg -i /thingsboard.deb
# Copying env variables into conf files
printenv | awk -F "=" '{print "export " $1 "='\''" $2 "'\''"}' >> /usr/share/thingsboard/conf/thingsboard.conf
cat /usr/share/thingsboard/conf/thingsboard.conf
if [ "$DATABASE_TYPE" == "cassandra" ]; then if [ "$DATABASE_TYPE" == "cassandra" ]; then
until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open\|filtered" until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open\|filtered"
do do
@ -46,12 +51,6 @@ if [ "$ADD_SCHEMA_AND_SYSTEM_DATA" == "true" ]; then
fi fi
fi fi
# Copying env variables into conf files
printenv | awk -F "=" '{print "export " $1 "='\''" $2 "'\''"}' >> /usr/share/thingsboard/conf/thingsboard.conf
cat /usr/share/thingsboard/conf/thingsboard.conf
echo "Starting 'Thingsboard' service..." echo "Starting 'Thingsboard' service..."
service thingsboard start service thingsboard start

8
transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportServerInitializer.java

@ -33,8 +33,6 @@ import org.thingsboard.server.transport.mqtt.adaptors.MqttTransportAdaptor;
*/ */
public class MqttTransportServerInitializer extends ChannelInitializer<SocketChannel> { public class MqttTransportServerInitializer extends ChannelInitializer<SocketChannel> {
private static final int MAX_PAYLOAD_SIZE = 64 * 1024 * 1024;
private final SessionMsgProcessor processor; private final SessionMsgProcessor processor;
private final DeviceService deviceService; private final DeviceService deviceService;
private final DeviceAuthService authService; private final DeviceAuthService authService;
@ -42,10 +40,11 @@ public class MqttTransportServerInitializer extends ChannelInitializer<SocketCha
private final MqttTransportAdaptor adaptor; private final MqttTransportAdaptor adaptor;
private final MqttSslHandlerProvider sslHandlerProvider; private final MqttSslHandlerProvider sslHandlerProvider;
private final QuotaService quotaService; private final QuotaService quotaService;
private final int maxPayloadSize;
public MqttTransportServerInitializer(SessionMsgProcessor processor, DeviceService deviceService, DeviceAuthService authService, RelationService relationService, public MqttTransportServerInitializer(SessionMsgProcessor processor, DeviceService deviceService, DeviceAuthService authService, RelationService relationService,
MqttTransportAdaptor adaptor, MqttSslHandlerProvider sslHandlerProvider, MqttTransportAdaptor adaptor, MqttSslHandlerProvider sslHandlerProvider,
QuotaService quotaService) { QuotaService quotaService, int maxPayloadSize) {
this.processor = processor; this.processor = processor;
this.deviceService = deviceService; this.deviceService = deviceService;
this.authService = authService; this.authService = authService;
@ -53,6 +52,7 @@ public class MqttTransportServerInitializer extends ChannelInitializer<SocketCha
this.adaptor = adaptor; this.adaptor = adaptor;
this.sslHandlerProvider = sslHandlerProvider; this.sslHandlerProvider = sslHandlerProvider;
this.quotaService = quotaService; this.quotaService = quotaService;
this.maxPayloadSize = maxPayloadSize;
} }
@Override @Override
@ -63,7 +63,7 @@ public class MqttTransportServerInitializer extends ChannelInitializer<SocketCha
sslHandler = sslHandlerProvider.getSslHandler(); sslHandler = sslHandlerProvider.getSslHandler();
pipeline.addLast(sslHandler); pipeline.addLast(sslHandler);
} }
pipeline.addLast("decoder", new MqttDecoder(MAX_PAYLOAD_SIZE)); pipeline.addLast("decoder", new MqttDecoder(maxPayloadSize));
pipeline.addLast("encoder", MqttEncoder.INSTANCE); pipeline.addLast("encoder", MqttEncoder.INSTANCE);
MqttTransportHandler handler = new MqttTransportHandler(processor, deviceService, authService, relationService, MqttTransportHandler handler = new MqttTransportHandler(processor, deviceService, authService, relationService,

5
transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportService.java

@ -82,7 +82,8 @@ public class MqttTransportService {
private Integer bossGroupThreadCount; private Integer bossGroupThreadCount;
@Value("${mqtt.netty.worker_group_thread_count}") @Value("${mqtt.netty.worker_group_thread_count}")
private Integer workerGroupThreadCount; private Integer workerGroupThreadCount;
@Value("${mqtt.netty.max_payload_size}")
private Integer maxPayloadSize;
private MqttTransportAdaptor adaptor; private MqttTransportAdaptor adaptor;
@ -106,7 +107,7 @@ public class MqttTransportService {
b.group(bossGroup, workerGroup) b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class) .channel(NioServerSocketChannel.class)
.childHandler(new MqttTransportServerInitializer(processor, deviceService, authService, relationService, .childHandler(new MqttTransportServerInitializer(processor, deviceService, authService, relationService,
adaptor, sslHandlerProvider, quotaService)); adaptor, sslHandlerProvider, quotaService, maxPayloadSize));
serverChannel = b.bind(host, port).sync().channel(); serverChannel = b.bind(host, port).sync().channel();
log.info("Mqtt transport started!"); log.info("Mqtt transport started!");

2
ui/src/app/app.js

@ -79,7 +79,7 @@ import 'font-awesome/css/font-awesome.min.css';
import 'angular-material/angular-material.min.css'; import 'angular-material/angular-material.min.css';
import 'angular-material-icons/angular-material-icons.css'; import 'angular-material-icons/angular-material-icons.css';
import 'angular-gridster/dist/angular-gridster.min.css'; import 'angular-gridster/dist/angular-gridster.min.css';
import 'v-accordion/dist/v-accordion.min.css' import 'v-accordion/dist/v-accordion.min.css';
import 'md-color-picker/dist/mdColorPicker.min.css'; import 'md-color-picker/dist/mdColorPicker.min.css';
import 'mdPickers/dist/mdPickers.min.css'; import 'mdPickers/dist/mdPickers.min.css';
import 'angular-hotkeys/build/hotkeys.min.css'; import 'angular-hotkeys/build/hotkeys.min.css';

Loading…
Cancel
Save