Skip to content

Commit b432135

Browse files
committed
mqtt related services not require the core mqtts properties to be set
1 parent 940dbf1 commit b432135

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ Software and the Larger Work(s), and to sublicense the foregoing rights on
4949
import io.micronaut.context.annotation.Requires;
5050
import io.micronaut.mqtt.annotation.MqttSubscriber;
5151
import io.micronaut.mqtt.annotation.Topic;
52-
import io.micronaut.mqtt.annotation.v5.MqttProperties;
53-
import io.micronaut.mqtt.annotation.v5.MqttProperty;
5452
import io.micronaut.scheduling.TaskExecutors;
5553
import io.micronaut.scheduling.annotation.ExecuteOn;
5654
import io.micronaut.serde.ObjectMapper;
@@ -59,10 +57,13 @@ Software and the Larger Work(s), and to sublicense the foregoing rights on
5957

6058
@Log
6159
@MqttSubscriber
62-
@MqttProperties({ @MqttProperty(name = "username", value = "${device.id}"),
63-
@MqttProperty(name = "password", value = "ExamplePassword") })
60+
6461
@Requires(property = DeviceSettings.PREFIX + ".id")
6562
@Requires(property = "mqtt.commandhandler.enabled", value = "true", defaultValue = "true")
63+
@Requires(property = "mqtt.client.client-id")
64+
@Requires(property = "mqtt.client.user-name")
65+
@Requires(property = "mqtt.client.password")
66+
@Requires(property = "mqtt.client.server-uri")
6667
public class MqttCommandHandler {
6768
@Inject
6869
public MqttCommandResponsePublisher responsePublisher;

IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Software and the Larger Work(s), and to sublicense the foregoing rights on
4949

5050
@MqttPublisher
5151
@Requires(property = DeviceSettings.PREFIX + ".id")
52+
@Requires(property = "mqtt.client.client-id")
53+
@Requires(property = "mqtt.client.user-name")
54+
@Requires(property = "mqtt.client.password")
55+
@Requires(property = "mqtt.client.server-uri")
5256
public interface MqttCommandResponsePublisher {
5357
@Topic("house/sonnencommandresponse/${" + DeviceSettings.PREFIX + ".id}")
5458
@ExecuteOn(TaskExecutors.IO)

IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttReferenceMonitor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ Software and the Larger Work(s), and to sublicense the foregoing rights on
4747
@MqttSubscriber
4848
@Requires(property = DeviceSettings.PREFIX + ".id")
4949
@Requires(property = "mqtt.monitorreference.enabled", value = "true", defaultValue = "false")
50+
@Requires(property = "mqtt.client.client-id")
51+
@Requires(property = "mqtt.client.user-name")
52+
@Requires(property = "mqtt.client.password")
53+
@Requires(property = "mqtt.client.server-uri")
5054
/*
5155
* get the data sent to the topics as a string, this means you can then use it
5256
* for examples entries in the IoT adaptors

IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ Software and the Larger Work(s), and to sublicense the foregoing rights on
5050

5151
@MqttPublisher
5252
@Requires(property = DeviceSettings.PREFIX + ".id")
53+
@Requires(property = "mqtt.client.client-id")
54+
@Requires(property = "mqtt.client.user-name")
55+
@Requires(property = "mqtt.client.password")
56+
@Requires(property = "mqtt.client.server-uri")
5357
public interface MqttSonnenBatteryPublisher {
5458
@Topic("house/sonnenconfiguration/${" + DeviceSettings.PREFIX + ".id}")
5559
@ExecuteOn(TaskExecutors.IO)

IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Software and the Larger Work(s), and to sublicense the foregoing rights on
4848
@Log
4949
@MqttSubscriber
5050
@Requires(property = "mqtt.monitoruploads.enabled", value = "true", defaultValue = "false")
51+
@Requires(property = "mqtt.client.client-id")
52+
@Requires(property = "mqtt.client.user-name")
53+
@Requires(property = "mqtt.client.password")
54+
@Requires(property = "mqtt.client.server-uri")
5155
public class MqttUploadMonitor {
5256
@Topic("house/sonnenconfiguration/${" + DeviceSettings.PREFIX + ".id}")
5357
public void receiveConfig(SonnenConfiguration config) {

0 commit comments

Comments
 (0)