ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

284 views
Skip to first unread message

Konstantinos Theopoulos

unread,
Aug 25, 2019, 6:07:21 PM8/25/19
to rabbitmq-users
Hi,

im trying to connect to a friends remote server using the following code:

Enter
loop = asyncio.get_event_loop()


def on_message(message: IncomingMessage):
    with message.process():
        print("[x] %r" % message.body)


async def main():
    # Perform connection
    connection = await connect(host=rabbit_url, port=rabbit_port,
                               login=rabbit_user, password=rabbit_password, loop=loop)

    # Creating a channel
    channel = await connection.channel()
    await channel.set_qos(prefetch_count=1)

    logs_exchange = await channel.declare_exchange(
        'delalis',
        ExchangeType.FANOUT
    )

    # Declaring queue
    queue = await channel.declare_queue(exclusive=True)

    # Binding the queue to the exchange
    await queue.bind(logs_exchange)

    # Start listening the queue with name 'task_queue'
    await queue.consume(on_message)


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.create_task(main())

    # we enter a never-ending loop that waits for data
    # and runs callbacks whenever necessary.
    print(' [*] Waiting for logs. To exit press CTRL+C')
    loop.run_forever()


and im getting an error :

ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

Any help would appreciated.

Thanks.

Luke Bakken

unread,
Aug 26, 2019, 11:17:40 AM8/26/19
to rabbitmq-users
Hello,

What is logged by RabbitMQ at the same time? Does the connection go through any firewalls or load balancers?

Thanks,
Luke
Reply all
Reply to author
Forward
0 new messages