216510121 黄向新
This commit is contained in:
parent
45f4730cb3
commit
c793cac8d0
|
@ -0,0 +1,23 @@
|
|||
package cn.edu.zjvtit.cloudstorage.apiservice.rabbitmq.topic;
|
||||
|
||||
import cn.edu.zjvtit.cloudstorage.apiservice.store.DataServerStore;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
@RabbitListener(queues = "apiServers")
|
||||
public class Receiver {
|
||||
//心跳接收端关键代码
|
||||
@Autowired//自动装配
|
||||
private DataServerStore dataServerStore;//定义私有的data服务器存储
|
||||
@RabbitHandler//监听队列
|
||||
public void process(String address) {
|
||||
System.out.println("Receiver Server Heart: " + address);//输出接收的心跳地址
|
||||
dataServerStore.receivedHeart(address);//data服务器存储接收心跳地址
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue