设备行为

This commit is contained in:
2025-08-02 09:18:31 +08:00
parent 99355e05b8
commit 8435a5b0e6
3 changed files with 25 additions and 11 deletions

View File

@ -21,6 +21,7 @@ import org.springframework.messaging.MessageHandler;
*/
@Configuration
public class CustomMqttInboundConfiguration {
@Autowired
private MqttPropertiesConfig mqttPropertiesConfig;
@Autowired
@ -28,11 +29,13 @@ public class CustomMqttInboundConfiguration {
@Autowired
private DeviceReceiverMessageHandler deviceReceiverMessageHandler;
@Bean
public MessageChannel customMqttChannel(){
return new DirectChannel();
}
@Bean
public MessageProducer customMessageProducer(){
String clientId = "custom_client_" + UUID.fastUUID();
@ -48,9 +51,11 @@ public class CustomMqttInboundConfiguration {
return adapter;
}
@Bean
@ServiceActivator(inputChannel = "customMqttChannel")
public MessageHandler customMessageHandler(){
return deviceReceiverMessageHandler;
}
}