mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 19:17:52 +00:00
Update mqtt client and google protobuf versions
This commit is contained in:
@@ -68,7 +68,6 @@ import com.telecominfraproject.wlan.firmware.models.FirmwareTrackRecord;
|
||||
import com.telecominfraproject.wlan.firmware.models.FirmwareVersion;
|
||||
import com.telecominfraproject.wlan.location.models.Location;
|
||||
import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
|
||||
import com.telecominfraproject.wlan.manufacturer.ManufacturerInterface;
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController.ListOfEquipmentCommandResponses;
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>opensync-gateway</artifactId>
|
||||
<name>opensync-gateway</name>
|
||||
<description>Redirector and Controller for OpenSync</description>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>opensync-gateway</artifactId>
|
||||
<name>opensync-gateway</name>
|
||||
<description>Redirector and Controller for OpenSync</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -23,34 +25,35 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.vmware.ovsdb</groupId>
|
||||
<artifactId>ovsdb-client</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>com.vmware.ovsdb</groupId>
|
||||
<artifactId>ovsdb-client</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- MQTT dependencies BEGIN -->
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-opensync-protobuf</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-opensync-protobuf</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java-util -->
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java-util</artifactId>
|
||||
<version>3.11.1</version>
|
||||
<version>3.12.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.fusesource.mqtt-client</groupId>
|
||||
<artifactId>mqtt-client</artifactId>
|
||||
<version>1.12</version>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
<!-- MQTT dependencies END -->
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@ import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.fusesource.mqtt.client.BlockingConnection;
|
||||
import org.fusesource.mqtt.client.FutureConnection;
|
||||
import org.fusesource.mqtt.client.MQTT;
|
||||
import org.fusesource.mqtt.client.Message;
|
||||
@@ -82,10 +80,11 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
}
|
||||
|
||||
Runnable mqttClientRunnable = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (keepReconnecting) {
|
||||
BlockingConnection connection = null;
|
||||
FutureConnection futureConnection = null;
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
|
||||
@@ -131,10 +130,9 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
|
||||
// TODO: revisit this blocking connection, change it to
|
||||
// futureConnection
|
||||
FutureConnection futureConnection = mqtt.futureConnection();
|
||||
futureConnection = mqtt.futureConnection();
|
||||
futureConnection.connect();
|
||||
// connection = mqtt.blockingConnection();
|
||||
// connection.connect();
|
||||
|
||||
LOG.info("Connected to MQTT broker at {}", mqtt.getHost());
|
||||
|
||||
// Subscribe to topics:
|
||||
@@ -161,7 +159,6 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
// main loop - receive messages
|
||||
while (true) {
|
||||
Message mqttMsg = futureConnection.receive().await();
|
||||
// Message mqttMsg = connection.receive(5, TimeUnit.SECONDS);
|
||||
|
||||
if (mqttMsg == null) {
|
||||
continue;
|
||||
@@ -197,28 +194,36 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
try {
|
||||
|
||||
encodedMsg = Report.parseFrom(payload);
|
||||
|
||||
MQTT_LOG.info("topic = {} Report = {}", mqttMsg.getTopic(),
|
||||
jsonPrinter.print(encodedMsg));
|
||||
|
||||
|
||||
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(), (Report) encodedMsg);
|
||||
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
// not a plume_stats report, attempt to
|
||||
// not a opensync_stats report, attempt to
|
||||
// deserialize as network_metadata
|
||||
encodedMsg = FlowReport.parseFrom(payload);
|
||||
|
||||
MQTT_LOG.info("topic = {} FlowReport = {}", mqttMsg.getTopic(),
|
||||
jsonPrinter.print(encodedMsg));
|
||||
|
||||
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(),
|
||||
(FlowReport) encodedMsg);
|
||||
} catch (Exception e1) {
|
||||
|
||||
try {
|
||||
// not a plume_stats report and not
|
||||
// not a opensync_stats report and not
|
||||
// network_metadata report, attempt to
|
||||
// deserialize as WCStatsReport
|
||||
encodedMsg = WCStatsReport.parseFrom(payload);
|
||||
|
||||
MQTT_LOG.info("topic = {} IpDnsTelemetry = {}", mqttMsg.getTopic(),
|
||||
jsonPrinter.print(encodedMsg));
|
||||
|
||||
|
||||
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(),
|
||||
(WCStatsReport) encodedMsg);
|
||||
} catch (Exception e2) {
|
||||
@@ -234,8 +239,8 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
LOG.error("Exception in MQTT receiver", e);
|
||||
} finally {
|
||||
try {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
if (futureConnection != null) {
|
||||
futureConnection.disconnect();
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
// do nothing
|
||||
|
||||
Reference in New Issue
Block a user