如何配置与RabbitMQ代理的连接

时间:2017-08-14 21:26:24

标签: java rabbitmq client

当代理处于关闭状态时,我一直在尝试连接RabbitMQ。到目前为止,我有:

    com.rabbitmq.client.ConnectionFactory factory = new 
    com.rabbitmq.client.ConnectionFactory();
    factory.setHost("localhost");
    factory.setPort(5672);
    factory.setAutomaticRecoveryEnabled(true);
    factory.setNetworkRecoveryInterval(100000);

    factory.setConnectionTimeout(100000);
    factory.setHandshakeTimeout(100000);

    return factory.newConnection();

但是当应用程序启动时执行factory.newConnection()。这是堆栈跟踪:

Caused by: java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:124)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:120)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:362)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:63)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:99)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:918)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:877)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:835)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:987)
at com.app.RabbitMqConectionFactory.provide(RabbitMqConectionFactory.java:41)
... 75 more
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:443)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:306)
... 82 more
Caused by: java.io.EOFException
at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:290)
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:580)
at java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案