| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Random; |
| | | |
| | | public class TaskListener implements MessageListener { |
| | | |
| | | @Resource |
| | | RabbitTemplate rabbitTemplate; |
| | | |
| | | @Resource |
| | | CachingConnectionFactory rabbitConnectionFactory; |
| | | |
| | | @Resource |
| | | JobDao jobDao; |
| | |
| | | |
| | | rabbitTemplate.convertAndSend("monitors_data_2", "", JSON.toJSONString(msgData).getBytes()); |
| | | // rabbitTemplate.send("monitors_data_3", "", new Message(JSON.toJSONString(msgData).getBytes(), new MessageProperties())); |
| | | |
| | | int state = (new Random()).nextInt(4) % 5; |
| | | rabbitTemplate.convertAndSend("monitors_alarm", "", "{\"mac\": \"" + mac + "\", \"state\": " + state + "}"); |
| | | |
| | | jobDao.updateStateByMac(mac, state); |
| | | } |
| | | |
| | | private Map<String, Float> getAdjustData(String mac) { |