|
@@ -1,46 +0,0 @@
|
|
|
-package com.xy.producer;
|
|
|
-
|
|
|
-import com.xy.configuration.MqttConfigUtils;
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
-import org.springframework.context.annotation.Configuration;
|
|
|
-import org.springframework.integration.annotation.IntegrationComponentScan;
|
|
|
-import org.springframework.integration.annotation.ServiceActivator;
|
|
|
-import org.springframework.integration.channel.DirectChannel;
|
|
|
-import org.springframework.messaging.MessageChannel;
|
|
|
-import org.springframework.messaging.MessageHandler;
|
|
|
-
|
|
|
-@Configuration
|
|
|
-@IntegrationComponentScan
|
|
|
-public class MqttConsumeErrorDataProducerConfiguration {
|
|
|
-
|
|
|
- /**
|
|
|
- * topic
|
|
|
- */
|
|
|
- public final static String TOPIC = "mqttConsumeErrorData";
|
|
|
-
|
|
|
- /**
|
|
|
- * 出站通道名(生产者)发布的bean名称
|
|
|
- */
|
|
|
- public static final String CHANNEL_NAME_OUT = TOPIC + "MqttOutboundChannel";
|
|
|
-
|
|
|
-
|
|
|
- /*******************************生产者*******************************************/
|
|
|
-
|
|
|
- /**
|
|
|
- * MQTT信息通道(生产者)
|
|
|
- */
|
|
|
- @Bean(name = CHANNEL_NAME_OUT)
|
|
|
- public MessageChannel mqttOutboundChannel() {
|
|
|
- return new DirectChannel();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * MQTT消息处理器(生产者)
|
|
|
- */
|
|
|
- @Bean(name = TOPIC + "MqttOutbound")
|
|
|
- @ServiceActivator(inputChannel = CHANNEL_NAME_OUT)
|
|
|
- public MessageHandler mqttOutbound() {
|
|
|
- return MqttConfigUtils.mqttOutbound(TOPIC);
|
|
|
- }
|
|
|
-
|
|
|
-}
|