我正在使用来自第三方消息代理的以下代码使用消息提要。我们使用
STOMP
协议和代码是使用
activemq-all
图书馆我注意到这种连接偶尔会挂起(每1-2周不进食一次)。所以我想使用STOMP协议的心跳功能,所以我添加了
heart-beat
标题为
stompConnection
如下所示:
StompConnection stompConnection = new StompConnection();
stompConnection.open(new Socket("ABC", 1234));
HashMap<String, String> headers = new HashMap<>();
headers.put("login", "abcd");
headers.put("passcode", "defghij");
headers.put("heart-beat", "0,10000");
stompConnection.connect(headers);
stompConnection.subscribe("topic1", "auto");
while(true) {
StompFrame stompMessage = stompConnection.receive(10000);
String messageBody = stompMessage.getBody();
}
现在我的问题是,有没有任何方法可以找到/跟踪我的应用程序(在java客户端之上)正在接收来自发送方的心跳?