| | |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.gateway.config.SystemProperties; |
| | | import com.zy.acs.gateway.constant.ProtocolType; |
| | | import com.zy.acs.gateway.constant.RabbitmqConstant; |
| | | import com.zy.acs.gateway.domain.AgvPackage; |
| | | import com.zy.acs.gateway.job.DispatcherPublisher; |
| | | import com.zy.acs.gateway.utils.ProtocolUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Autowired |
| | | private SystemProperties systemProperties; |
| | | |
| | | @Autowired |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | |
| | | @PostConstruct |
| | | private void start(){ |
| | | thread = new Thread(() -> { |
| | |
| | | log.info("监听器 >>> {}", JSON.toJSONString(protocol)); |
| | | } |
| | | if (!Cools.isEmpty(protocol.getAgvNo())) { |
| | | publisher.publish(ProtocolUtils.installDownProtocol(protocol)); |
| | | AgvPackage agvPackage = ProtocolUtils.installDownProtocol(protocol); |
| | | publisher.publish(agvPackage); |
| | | // 写入队列 |
| | | rabbitTemplate.convertAndSend(RabbitmqConstant.TOPIC_EXCHANGE, RabbitmqConstant.ROUTING_KEY_DOWN.replaceFirst(RabbitmqConstant.SPILT_REGEX, protocol.getAgvNo()).replaceFirst(RabbitmqConstant.SPILT_REGEX, agvPackage.getHeader().getProtocolType().name()), agvPackage.getBody().getMessageBody()); |
| | | |
| | | } |
| | | } |
| | | // 间隔 |
| | | try { |
| | | Thread.sleep(500); |
| | | Thread.sleep(300); |
| | | } catch (Exception ignore) {} |
| | | } |
| | | }); |