RabbitMQ Configuration failing
I'm attempting to connect to a remote RabbitMQ service I created and deployed. My client is using Spring AMQP and I've created the following RabbitConfiguration class:
Code:
public class RabbitConfiguration {
@Bean
public ConnectionFactory connectionFactory() {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory("10.46.xxx.xxx");
connectionFactory.setPort(10001);
connectionFactory.setUsername("uEejUKacRGvjO");
connectionFactory.setPassword("pKlyhpd6K4go3");
connectionFactory.setVirtualHost("/ve2b460e7e6b24b5da88c935df63c4e86");
return connectionFactory;
}
@Bean
public AmqpAdmin amqpAdmin() {
return new RabbitAdmin(connectionFactory());
}
@Bean
public RabbitTemplate rabbitTemplate() {
RabbitTemplate templ = new RabbitTemplate(connectionFactory());
// templ.setQueue("queue-dogtag");
return templ;
}
@Bean
public AMQP.Queue myQueue() {
return new AMQP.Queue();
}
}
My code then uses this class to send a message as follows:
Code:
try {
ApplicationContext context = new AnnotationConfigApplicationContext(RabbitConfiguration.class);
amqpTemplate = context.getBean(AmqpTemplate.class);
amqpTemplate.convertAndSend("queue-dogtag", "Hello");
}
catch (Exception e) {
e.printStackTrace();
}
However, when this code runs, I consistently get the following exception:
Code:
Caused by: java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:381)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:516)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:545)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:160)
... 44 more
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; reason: java.io.EOFException
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)
... 48 more
Caused by: java.io.EOFException
at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:273)
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:131)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:508)
Any idea why this is happening?
TIA!