| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | |
| | | |
| | | @Autowired |
| | | private DispatcherPublisher publisher; |
| | | |
| | | @Autowired |
| | | private SystemProperties systemProperties; |
| | | |
| | | @Autowired |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | @Value("${spring.rabbitmq.enable}") |
| | | private Boolean flag; |
| | | |
| | | |
| | | @PostConstruct |
| | |
| | | if (!Cools.isEmpty(protocol.getAgvNo())) { |
| | | AgvPackage agvPackage = ProtocolUtils.installDownProtocol(protocol); |
| | | publisher.publish(agvPackage); |
| | | if (rabbitTemplate.isRunning()) { |
| | | if (flag && rabbitTemplate.isRunning()) { |
| | | // 写入队列 |
| | | rabbitTemplate.convertAndSend(RabbitmqConstant.TOPIC_EXCHANGE, RabbitmqConstant.ROUTING_KEY_DOWN.replaceFirst(RabbitmqConstant.SPILT_REGEX, protocol.getAgvNo()).replaceFirst(RabbitmqConstant.SPILT_REGEX, agvPackage.getHeader().getProtocolType().name()),new DeviceMessage(agvPackage.getSourceHexStr())); |
| | | } else { |