achilleasa / dart_amqp

Dart AMQP client implementing protocol version 0.9.1
MIT License
79 stars 40 forks source link

Lost connection to the server #92

Closed yapiyapo5 closed 1 year ago

yapiyapo5 commented 1 year ago

Hello,

I have a RabbitMQ broker in localhost in the port 15672 and I am trying to connect using your library to be able to send messages through AMQP.

I could do it with python but in flutter I am not be able to connect.

void main() async {
  ConnectionSettings connectionSettings = ConnectionSettings(
    authProvider: PlainAuthenticator("user","password"),
    host: 'localhost',
    port: 15672
  );
  Client client = Client(settings: connectionSettings);
  await client.connect();
  Channel channel = await client.channel();
  Queue queue = await channel.queue("hello");
  queue.publish("Hello World!");
  print(" [x] Sent 'Hello World!'");
  await client.close();
}

All the credentials are ok and the broker is up. if I write "localhost" the system throws "ConnectionFailedException: Could not connect to 127.0.0.1:15672 after 1 attempts. Giving up" and if I put my ip address, it throws "FatalException: Lost connection to the server".