I'm working on some code to send heartbeat messages from consumers. Getting the following exception:
Here's the code causing the exception:Code:org.springframework.erlang.OtpIOException: failed to connect from 'rabbit-spring-monitor' to peer node 'rabbit@localhost' at org.springframework.erlang.connection.SimpleConnectionFactory.createConnection(SimpleConnectionFactory.java:65) at org.springframework.erlang.support.ErlangAccessor.createConnection(ErlangAccessor.java:43) at org.springframework.erlang.core.ErlangTemplate.execute(ErlangTemplate.java:114) at org.springframework.erlang.core.ErlangTemplate.executeErlangRpc(ErlangTemplate.java:46) at org.springframework.erlang.core.ErlangTemplate.executeAndConvertRpc(ErlangTemplate.java:98) at org.springframework.amqp.rabbit.admin.RabbitBrokerAdmin.getQueues(RabbitBrokerAdmin.java:148) at spg.poly.consumer.monitoring.HeartbeatPublisher.sendHeartbeat(HeartbeatPublisher.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273) at org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:65) at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:70) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Caused by: java.io.IOException: Cannot connect to peer node at com.ericsson.otp.erlang.AbstractConnection.doConnect(AbstractConnection.java:998) at com.ericsson.otp.erlang.AbstractConnection.<init>(AbstractConnection.java:205) at com.ericsson.otp.erlang.OtpConnection.<init>(OtpConnection.java:86) at com.ericsson.otp.erlang.OtpSelf.connect(OtpSelf.java:219) at org.springframework.erlang.connection.SimpleConnectionFactory.createConnection(SimpleConnectionFactory.java:62) ... 15 more
The broker is version 2.0 and has the default settings.Code:public void sendHeartbeat() { log.info("sending heartbeat..."); ConnectionFactory connFactory = config.connectionFactory(); RabbitBrokerAdmin admin = new RabbitBrokerAdmin(connFactory); StringBuilder msg = new StringBuilder(); msg.append("[Heartbeat] "); List<QueueInfo> queues = admin.getQueues(); for (QueueInfo qi : queues) { msg.append("consumers=").append(qi.getConsumers()); } config.rabbitTemplate().convertAndSend("heartbeat-ex", null, msg); }
Any ideas?


Reply With Quote